Upgrading from an Arduino to an ESP32!

“Sheldon have you changed your wireless password again?” – Penny
“Yes, it’s \”Penny get your own WiFi\”; no spaces.” – Sheldon Cooper

I’ve been using Arduino devices for many years now, and often with the Freetronics Etherten units. I’ve recently started looking at the ESP32 microcontrollers for several reasons. The biggest reason is the increase in CPU power and memory – especially memory. The amount of Arduino programs I’ve written where you’ve needed to scrimp and save on every little byte of memory to make it work does not make it fun. I wrote an article many years ago to that effect. Additionally, the built-in WiFi and Bluetooth coupled with the ability to put it into a low power mode has me sold.

The garage door controller in my house lacks a terminal strip, so the only way I had to connect it to my home automation system was to build a circuit around one of the remote controls – controlling the remote control.

Back when I first built it, home automation software was mostly non-existent, so I had my Arduino sending data to a service/daemon that I built as part of my home automation platform. Now that I’m using Home Assistant, I’m trying to slowly replace parts of my original system with out of the box functionality. As such, not only did I move my garage door system to an ESP32 from an Arduino, I also moved it to MQTT to talk to Home Assistant and thus negating the need for my custom service/daemon to translate.

For the ESP32, I’m using the Adafruit Feather version. My garage door remote is a 12V remote, the ESP32 uses 3.3V, and the relays I’m using are 5V. I was going to use 3.3V relays, but didn’t find any that I’d be able to easily drive from the ESP32. I had some spare 5V relays, so I just used those instead. As such, I used a DC-DC converter to bring a 12V power supply down to 5V to power the Adafruit board and the relay. The Adafruit board then drops the 5V down to 3.3V for the ESP32.


Since I don’t have an ethernet socket with a link light anymore, I’ve added an LED to the side of the case just so that I can see it has power. I used a prototype circuit board to mount the DC-DC converter and headers to hold the ESP32, plus a few terminal strips to connect to the RCA sockets I’ve added to the case. The RCA sockets connect to magnetic sensors on the garage door to give me open/closed status.

Photo 2-2-19, 3 10 25 pm

I’ve then added a smaller protoshield on top of the ESP32 to hold the relay and transistor. I needed to use a transistor to turn the relay on, as it was a 5V relay and my GPIO was 3.3V.

Photo 2-2-19, 4 08 49 pm

I was quite happy with the build as its easy to take apart due to the terminal blocks. The terminal block that you can see on the top shield was for me to bring +12V to the shield direct from the 12V power supply. I didn’t have a nice way to run it from the base board up through the headers to the shield without interfering with the ESP32, but I didn’t want to hard solder it either.

The code for the ESP32 I haven’t included here, but the ESP32 examples are pretty solid. I used the Secure WiFi client so that the MQTT library could use encrypted MQTT connections, and I added Over The Air (OTA) capability so that I can upload new versions of code without needing to plug it back into a computer with the USB interface.

I’ll likely use the ESP32s more going forward. It’s great that they have WiFi, plus heaps of memory and other capabilities. However, it is a shame that they’re 3.3V given most of what I’ve built so far and the components I have in stock are all 5V. I do have many logic level converters and transistors for interfacing between them, but it was handy with the Arduino running at 5V. The other advantage the Freetronics Arduino modules had was the switch mode power supply that could take up to 20V I believe. Given I needed 12V here, I had to add an additional power supply to handle that. Everything is a trade off, but the flexibility and capability of the ESP32 is pretty awesome.

~ Mike


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s