Robert Sontheimer’s book, Arduino & Co - Measure, Control, and Hack, was recently published in English after its success as a German book. The author takes a unique approach to developing some clever hacks for the ATmega328P-equipped Arduino Pro Mini board (or compatible). The result is a book that’s a curated collection of topics, from introductions to transistors and a variety of sensors to a complete lithium-ion charging and testing station, to name a few.
 

Author Robert Sontheimer

We wanted to know more about the background that drives his inspiration and creativity, so we asked him for this interview.

Your latest book is all about the ATmega328 microcontroller and the Pro Mini Board. For whom is this book? Do you see the target audience as electronics engineers, electronics hobbyists, or people with a programming background? Beginner or advanced?

I think the book has a lot to offer to everyone. First, I explain the different ATmega328 boards, the Arduino platform and then (as required for the respective project) a step-by-step through the programming language, and also the electronic side, how to switch with different components optimally with what transistor, read analog and digital signals, and so on.

The book goes thematically through all areas around the Arduino, with programming, electronics and practical projects alternating, as necessary. I tried very hard to create an appealing design with many pictures, drawings and photos, not just dry reading, but a book that makes you want to read more at every point.

On the one hand, it is a circuit book with many concrete projects. But above all, it should provide the basics and ideas to implement your own projects with your own ideas. There are many (hobby) electronics engineers who have never done programming, and therefore have not yet dared to try the Arduino topic. Likewise, there are many who work on the PC with C+, C++ or other programming languages, but are not familiar with electronics, and I think both groups have a lot to gain from its 331 pages.

Arduino & Co - Measure, Control, and Hack by Robert Sontheimer

 

Why did you choose the ATmega328 for this book, and why did you prefer the Arduino Pro Mini board over, say, the Arduino UNO?

Arduino Pro Mini

I like to create projects that stay built, and that's where the small, inexpensive Pro Mini is useful. That is something different than if you put together a circuit with a breadboard and jumper cables, and build something else with the same components the next day. In that case I would rather use the UNO, which I also introduce in the book, as well as the LilyPad, which is mainly suitable for battery-powered devices. The Pro Mini is therefore only a suggestion, as it is the cheapest board. But it is primarily about the ATmega328 microcontroller and the almost-identical ATmega168, which has less memory, but is often sufficient for small programs. Which board you use in the end doesn’t matter.

Often I see how some people do simple projects with bigger Arduinos — or even Raspberry Pis — where I ask myself: Why don't they just use the Pro Mini? Most of the time, it’s quite sufficient.

For example, I have already realized an 8-channel audio spectrum analyzer with 8 × 8 RGB LED fields, based on a Pro Mini, which reads in a sound signal in real time, analyzes it, and clocks the colors of all 64 LED fields (line by line) hundreds of times per second into a shift register. This seems to be an impossibility, because reading out the analog signal alone actually takes twice as much time as you have available, but with some tricks, it can actually be done with a Pro Mini.

8-channel audio spectrum analyzer with 8 × 8 RGB LED fields

I once bought my cheapest Pro Minis from China for €1.03 each. That was at the end of 2017, but those times are over, unfortunately. Nevertheless, the Pro Mini is still pretty much the cheapest board, and it’s completely sufficient for most applications. That’s why I like to use it so much.

One of the things I found unique in this book was in Chapter 4, where you describe building circuits using what you call the “thumbtack technique” – such a simple but time-saving and elegant way of building quick circuits, which I had never encountered before. Where did you get the idea for this?
 

I didn’t invent it. Back in the 80s, I took part in school projects where we built simple transistor circuits in this way. What is perhaps new is the idea that I provide exact plans that you can print out in their original size and place on the board before you press in the tacks (all precisely placed). That way, you can build the circuit directly on the placement plan.

Thumbtack construction

Perhaps I was inspired by an electronics kit that I received as a gift as a child in the 1970s. There, the construction had nothing to do with thumbtacks, but was realized using spring contacts, but also with these kits (brand Philips) first the assembly plan was put on the baseplate and then the circuit was built on top of it.

I find it funny in retrospect that last year – when I wrote the book – and I suggested the thumbtack technique, the publisher was not at all taken with it at first. They were afraid that the book might look a bit “old-fashioned.” Now, however, everyone thinks it’s great. And there’s also a circuit board for the battery charging station.

How long have you been writing published books?

Since the 90s. My first book, Designing Audio Circuits (also published by Elektor), is about the analog processing of audio signals – everything is in there, from preamplifiers to all kinds of filters and equalizers to mixing consoles. It was translated into several languages at the time, but is now sold out. (The German original is still available as an ebook.)

My second book was called Die verrücktesten Elektronik-Schaltungen (“The Craziest Electronic Circuits,” not published in English). That was about unusual ideas in the field of analog electronics, e.g. all kinds of joke circuits to play tricks on others, and how to make light audible or alienize speech, and even “negative resistance.” That, too, has long since sold out.

You've written books on both analog (audio) electronics and digital (microcontroller) topics. How did you become interested in these two different fields?

I have always been interested in both. When I was a child - still in kindergarten - I built a little house with Lego bricks, a battery and a small light that could be switched on. But, robots and computers were also a very exciting topic for me at that time, even though I had no idea about them. When I was 9, I got my first electronics kit for Christmas, with which I could build a radio with three transistors and some other components.

Later, when there were two computers at my school, I took a course and learned programming in BASIC and Assembly Language. (Computer-AG was called that.) That must have been in 1981 or 82. One year later, I bought the Sinclair ZX81, a very primitive home computer with 1 KB RAM, and then again a year later the C64, which I already used like an Arduino. The so-called User Port of the C64 provided input and output lines which could be programmed freely.

What did you do with the C64 back then?

With the inputs and outputs of the User Port I made everything possible, up to a simple slot machine, with which I took some money from my classmates.

On the Commodore 1520 Plotter, I replaced the stylus with a reflex light barrier (with a very small aperture) and made a primitive scanner out of it. One scan could take half a day.

On the C64, I built in a turbo switch, which overrode the PLL control of the clock frequency. So, the processor worked much faster, and I could do large calculations at almost twice the speed. I also discovered a trick with the C64’s sound chip: How I could play (via quick changes of the volume setting from 0 to 15) simple sampled sounds.

That was certainly a magical time for kids of that era with the ZX81 and the Commodore 64. Do you still have one of those machines?

Yes, I actually still have both of them, even though they have been sitting untouched in a cupboard for decades. (One of the reasons for this is that I would need a suitable TV adapter today, and that most of the old floppy disks probably wouldn’t be readable anymore).

What other microprocessors did you work with between that early Z80 / 6502 introduction and your last book on the ATmega328P-based Arduino Pro Mini?

When there were the first PCs (at that time still with MS DOS) I often programmed in GW-Basic, later mainly internet pages with Java-Script and PHP - so nothing that can be assigned to a special processor. My first Arduino projects were with the Leonardo (ATmega32U4 microcontroller). But I quickly switched to the Pro Mini with the ATmega328P, because you usually don't need the USB interface (or only for programming, which you can also do with a USB adapter).

When you see a useful device on offer, such as a clever battery charger, is your first thought that you might prefer to design and build it yourself (as you did in the book)?

Oh, yes! Then I often think of many things that could be done better. My second thought is then but how much time I would have to invest, often only for a simple device that there is already to buy for a few euro, so I usually don’t do it.

And how many of your projects are not lying in a drawer now, but are actually powered and running all over your house?

Several! For example, the “week clock,” which is not labeled from 1 to 12, but from Monday to Sunday. It only needs one hand, but besides the (rough) time, it always shows the current day of the week. Thanks to the Arduino sleep mode, I only have to recharge it every three years.

Weekly clock

A few years ago, I used stepper motors and threaded rods to build a CNC machine that can cut thin sheets of wood using lasers. Lettering can even be burned in with a grayscale, so I can even burn photos onto surfaces. This works by the device measuring the brightness several thousand times per second (i.e. how much light is reflected from the receiving surface). So, the device always knows how much has already been burned and can constantly readjust the laser strength. The laser can also be controlled in the Z direction (up and down), and an autofocus program scans the surface at various intervals with short flashes of light, measuring changes in contrast and thus the sharpness for subsequent burning. By the way, a Pro Mini also controls all of this.

We need to know what this “self-changing toilet paper filter” is all about, which you also allude to on the back of your book. What problem did that solve that wasn’t solved before?

Yes, such a laser CNC device naturally produces a lot of smoke, which then rises, clouds the laser lens, and spreads throughout the apartment. So, I built an exhaust system that draws the smoke in through a hose directly at the laser and blows it out the window through another hose. The only problem was that the blower (a kind of mini-vacuum cleaner) was quickly contaminated by the smoke particles and broke down. So, a filter had to be installed in front of it. There are high-quality filter fleeces (similar to those used in breathing masks), but they have to be changed often and are not cheap, although toilet paper is almost as good.

My solution, finally, was the “self-changing toilet paper filter,” a construction with 2 rolls of toilet paper, which lie as a filter 2-fold on top of each other, and is automatically transported a few centimeters further, whenever it is used up (i.e. when it has already absorbed too many smoke particles). This control is also done with a Pro Mini, which quite simply determines the state of the filter based on the power consumption (of the fan).

Toilet paper filter

A roll of toilet paper is hidden behind each of the large holes. The arrows on the circles indicate how the paper runs. Optionally, a third roll could be used on the far right. The whole wooden construction was cut with the laser device.

I understand you also have a magnet that “levitates” in your office. Is that the most whimsical project of yours, or are there others that make people take a second look?

I don’t know if this is the most bizarre one. There’s so much more, but this is supposed to be an interview and not another book ;-)

In the floating magnet, the so-called “Levitron,” a magnet floats under a coil whose current is always regulated so that the magnet neither rises nor falls. A magnet sensor always determines the exact current position of the magnet. In the basic version, however, the current consumption is quite high and only a small distance to the coil is possible, because otherwise the coil would have to pull even stronger and would need even more current.

In my version, I have also installed a strong permanent magnet above the coil, so that in the floating position, its attraction force corresponds exactly to the gravity of the floating magnet. One millimeter lower, the magnet would immediately fall down - one millimeter higher, it would immediately jump up to the upper magnet. Even without the coil, one or the other would happen within fractions of a second. But the coil can be controlled in both directions using an H-bridge, i.e. it can attract or repel the floating magnet. The control occurs several thousand times per second, so that only minimal correction forces are necessary. Thus, the circuit consumes very little current and runs completely silently, although the magnet floats quite far away from the coil with a distance of a few centimeters.

Levitron

The coil and the second magnet are installed in the upper wooden beam.

Given the successful publication of your book in German and English (as well as a forthcoming revised German edition), do you have any plans to publish further interesting material?

No, although there is no shortage of ideas. It’s just that I'm already in a bit of poor health, so first and foremost I’m glad I was able to get this book project done last year. This year I helped a bit with the English translation, did the layout again, and optimized the German version here and there.

I hope all readers enjoy the English edition, which is now on sale.