Web-development as life-style

Later Ctrl + ↑

Toy Traffic Light with Arduino and Lego Duplo

Demoing this to my son

Here is my small project that I made for my son’s 2nd birthday.

He is very fond of trains and cars, so I thought that a working traffic light would not hurt. I know there are some commercially produced toys, but I wanted to do something myself.

If you have religious feelings about Lego, proceed with caution – some damaging images ahead.


I just looked at a 2x4 regular Duplo block and thought that its bottom tubes resembled the traffic light tubes (kind of).

Those tubes also large and deep enough to accomodate regular 5mm LEDs.

However to place the Arduino and have some space for the wiring, I had to cut almost entirely the two and a half tubes with a Dremmel rotary bit. Even after this the block still has some rigidity:


How not to solder:

Almost ready:



Project is based on Arduino Nano which fits pretty well inside the regular Duplo block.

  • Arduino Nano V3
  • Red, Green, Yellow LEDs
  • 220 Ohm resistor (3x, for the LEDs)
  • Pushbutton
  • Battery block


One can use pretty much anything to power Arduino Nano with some LEDs. I had some CR2032s, 9v crown, Li-Ion 18650 and an 3xAAA battery block lying around.

Initially I wanted to go with CR2032 in order to reduce weight and complexity, but the ones that I had did not produce enough current.

18650 is a good choice, but would require more block processing to fit the battery.

So I went with a noname 3xAAA battery pack.


I started off with a python sketch, aiming to use ESP32 with micropython to allow over-the-air traffic pattern updates.

For some reason I had issues with ESP32 on my laptop (could not properly connect over serial, even with that bespoke UART driver).

So I went really simple, with a regular Arduino and C.



Soldering is really messy, but also the space was limited:

I’m as surprised as you are with my soldering:

Some drilling had to be applied:

Complete with some hot glue:

 No comments   8 mon   arduino   DIY   hardware   lego   projects   source-code   toy

Links January 2020

Here I’m going to collect interesting things I found during the month.

  • Cyberpunk is dead – a sad overview of cyberpunk genre development
  • Every Noise – the map of music genres with prominent artists of each one
  • DIY Air Purifier – an open source guide to build air purifier of the off-the-shelf parts
  • Crontab calculator – I forget how this works every time
  • Macintosh Switcher – history of the first application switcher in Macintosh (1984-1985)
 No comments   8 mon   links

Interesting work is a thrill and a fear

While I was translating the diPlayer post, I noticed that I have used the word scared or fear a couple times.

This led me to the thought that work for me should be connected with fear.

To be really involved I need to be scared of the result, I need to be unconfident about it.

All the projects that I remember as thrilling required from me to cope with significant fear of failure. This fear came
either from my incomplete knowledge of the field I was working in, or tight deadlines, or both.

This is important, because I have always been looking into ways to make work less boring and repetitive. But probably I will have to just bear with boring work for now (as before).

 No comments   9 mon   thoughts   work

WebSummit 2019 experience

Main stage

I visited WebSummit in November 2019 in Lisbon.

Wanted to share some pictures from it in a presentation (beware 100Mb of traffic)

Overall I expected more usefulness from the conference – more of tech talks and specifics. However this was not the case, it’s a large gathering of people from different backgrounds.

I really liked the startup expo though, there were some cool projects.

If I get the free tickets again next year (which I was happy to receive as a part of Open-Source Contributors programme), I’m not sure I would go.

diPlayer – Raspberry Pi-based player for DI.FM

diPlayer assembly

This is a desktop player for DI.FM that I made for the 20-year anniversary.

I gathered a lof of experience during this proejct:

  • learned how to solder (again)
  • familliarised myself with Python
  • wrote and debugged firmware for an Arduino Nano
  • learned to model in Fusion 360
  • found out that 3-d printing don’t happen right on the first time


Desktop player based on Raspberry Pi, that can play DI.FM channels (IceCast streams to be exact).

It is controlled with photoslides frames that have NFC-stickers on them, the stickers point to certain channels.

The player can also play other sources like Spotify, Google Play Music, Soma.fm thanks to MusicBox software.

It has a physical Play/Pause button, volume knob and a small screen that displays current track. Sound output is through audiojack or HDMI (Raspberry Pi standard).


Last year I saw these tweets:

And some comments had a link to the PlasticPlayer project.

It’s a small device based on Espruino with NFC-sensor and a screen. Upon detecting NFC-chip it gets its reference track from the database and sends the link to it to the Raspberry Pi that sits on the same network.

The author, Brendan Dawes, released all the source code and models for 3-d printing on Github, which helped me a lot.

My Attempt

I started to work on the project in June 2019.

It was around the time I just received a couple fresh ESP32 from China. I did reflashed one of them with Espruino, but even simplified code from the Brendan’s repo didn’t run.

Also I didn’t like that in such a simple project there will be two separate wi-fi connected devices, and I deemed suboptimal Arduino getting track data from the remote server in the face of Raspberry Pi power and possibilities.

So I rewrote and remodeled everything from scratch.

I just forked the repo and dove into unraveling all the upcoming issues.

Mistakes and Experience

On the breadboard


This is a very popular Arduino NFC-module. It took me only one a half months of unstable work (!) for me to read to the original manual.

One of the keys issues here was that the wire management – the wires should go under the antenna turning in 90°.

The wires should go under the antenna turning in 90°

NFC-module is very susceptible to electromagnetic noise from other devices and wires.


I also decided to replace the “Next Track” button with the volume knob.

On the first iteration I tried to use encoder with Arduino.

Encoder is a knob you must be familiar with from a wide range of electronics. It uses two rings inside and a cursor to determine if it goes forward or backward.

On a separate breadboard and an Arduino with only the encoder connected everything worked smoothly.

But whenever I tried to use it with my main board, together with NFC-module, screen and a couple of buttons, the volume was unstable at all, and I couldn’t use it.

I couldn’t discover why it happened. Maybe it was due to some regular voltage spikes that I could measure. Some tutorials stated that encoder needed hardware interruptions to work, and so maybe I used the wrong Arduino pins.

After some struggling, I almost gave up on the project and decided to try potentiometer.


It’s a more traditional knob, based on the resistance change inside itself.

It didn’t come out easily as well. Looked like the NFC-module emitted a lot of noise, and potentiometer readings bounced by 10% either side all the time. 10% is quite a span, which is to easy to smooth out.

At some point, I got an advice on an Arduino forum, to connect the potentiometer physically closer to the power source. It did help, just until the final assembly.


In the original Brendan’s repo (above) there is a case 3-d model. But it appeared I need more height due to the fact that I wanted to squeeze both Raspberry and Arduino inside, and also I wanted a different type of wiring on the back side.

I tried to model it at first in Blender – from my knowledge it was a popular program to make Counter-Strike skins 15 years ago.

I did a case model from scratch using the relative units. In a day the printing guys sent me a picture of a bottom lid with the Raspberry mounting holes spaced apart too much. They suggested me redoing the model in Fusion 360.

I never tried parametric modeling before and it worked like a charm. Fusion is an awesome and fast peace of software, and it took me only a complete Sunday to learn the program and model the case with exact measurements.

This time printing went smoothly in terms of dimensions. However the surface quality appeared to be poor in some places, and I couldn’t fix it afterwards.

The case before painting

I tried to sand it and apply different Dremmel rigs, but it didn’t really help. In the end I coated it multiple times with acrylic paint which made it look a little better.

Final Assembly

I had only two weeks left to the deadline (a trip to Croatia to meet my colleagues), so I was calm thinking that I have a lot of time.

By this time I got desperate a couple of times and was close to abandoning the project due to unexpected issues. Now, remembering those moments, I can’t understand why it scared me that much. My wife really helped in those moments, encouraging me to continue.

One of the first surprises was the fact that the USB-cable that I used to connect Raspberry Pi and Arduino did not fit into the case. So I soldered a shorter version of USB-A — mini-USB.

Soldering mini-USB plug

Then I soldered all the components and headers onto the circuit board, and potentiometer started to report incorrect readings again. I got some more advices on the forum, tried to put a capacitor.

In the end I replaced the potentiometer with the encoder, but this time plugged it into the Raspberry Pi. I added another small class to read the encoder readings in my Python program and it was good.

One of the iterations of my expansion boards for Raspberry Pi
One of the iterations of my expansion boards for Raspberry Pi

It was only three days before the flight, and I had more plans for the firmware updates, Raspberry Pi suddenly stopped working.

It looked very strange – I could connect via ssh, but the Musicbox web-interface was not available. The solution was too straightforward – reinstalling Raspberry Pi. Later I discovered the sd-card got corrupted due to multiple hard power-offs.

At some point it all worked together, but I didn’t have any emotions left to rejoice.

It took me about two months of almost every evening (after my main work), which came with some exhaustion.

Final layout of the player

I still did some programming right until the flight, and also had to make Python program autostart when I was in Croatia.

Cutting the NFC-cards covers, night of the flight


Ari, Andrew, me, Mich

It was a good one, despite the device looks.


P.S. Want to say thanks to my wife who cheered me up many times during this project, helping me to go forward. Thank you 😘

P.S.S. I had a couple people asking me when I’m going to make the ones for sale and I started thinking about it. Let me know using this form if you are interested.

Originally published in my older blog in Russian in October 2019.

Hello world!

This is my new blog in English.

I hope to write here every other month about my home projects and occasionally work.

I wanted to try out some of the fancier static-site generators, but ended trying Ilya Birman’s blog engine, which is easy to use, editing is accessible via mobile, so you are not tied to your desktop etc. Let’s see how it goes.

Stay tuned!

 No comments   9 mon