Last Updated 24/10/2025

Arduino/C++ ESP32 Lessons

When learning the basics of using the Arduino IDE I would always recommend starting with the basic Arduino UNO or one of it's many clones for beginners.
Most of the lessons on the Lessons page are based around this board and it is a great beginners board and very forgiving when it comes to mistreatment both with circuits and code.

However for more advanced projects the ESP32 is a great board and the basic ESP32 Dev Module is the default board for most of my projects including nowRail.

This page deals with various issues with using the ESP32 that I have come across or people have asked for help with usually while working with nowRail or some of the other model railway projects on the Digital Town site.

ESP32 Lessons

I decided to re record and try and improve on the original series of lessons using better cameras and production software.

Lesson (Click to watch)
Lesson Resources

ESP32 analogRead()

This video covers the differences between the Arduino analogRead() and the ESP32 analogRead().

Although the function is used in exactly the same way the outputs are different due to the ESP32 having a 12 bit ADC rather than the 10 bit version of the Arduino Uno.

This video also covers the issues around using the ESP32 wifi functions alongside the ADC functions.

Click to download resources for Video

Lesson circuit diagram, click image for larger version
ESP32 analogRead() circuit

Arduino analogRead() lesson

Other information:

ESP32 Pin Out Diagram This page as Last Minute Engineers is a great resource for the various pinouts of the ESP32 Dev Module

ESP32 I2C 1602 Liquid Crystal Display

This video covers how to use the I2C 1602 Liquid Crystal Display with the ESP32.

As the I2C 1602A Display requires 5v to work a level shifter needs to be placed between the I2C 1602A and the ESP32 to prevent 5v signals being sent from the I2C 1602 dislay to the ESP32.

I have concered the use of the 1602A screen in a seperate lesson with the Arduino Uno.

The code works in the same way so for more information see:
Arduino 1602A I2C LCD Screen

Click to download resources for Video

Lesson circuit diagram, click image for larger version
ESP32 1602A Liquid Crystal Display Circiut

 

Other information:

ESP32 Pin Out Diagram This page as Last Minute Engineers is a great resource for the various pinouts of the ESP32 Dev Module

ESP32 ESP-NOW Broadcast Mode

Click to download resources for Video

This video shows how to set up and use ESP-NOW in Broadcast Mode.

ESP-NOW Broadcast mode allows almost limitless numbers of ESP32's to communicate but also has some issues that need to be thought about to make a smooth running system.

Expressif ESP-NOW documentation

For information on using FIFO (circular) buffers see:

https://www.digitaltown.co.uk/howtoFIFO.php

ESP32 ESP-NOW Broadcast Mode Simple Encryption

Click to download resources for Video

This video follows on from the ESP-NOW Broadcast Mode video.
Starting with the final sketch of that lesson this video continues with how to apply simple encryption to protect your system ID number.

Expressif ESP-NOW documentation

For information on using FIFO (circular) buffers see:

https://www.digitaltown.co.uk/howtoFIFO.php

ESP32 ESP-NOW with ESP32 V3.0.0 or greater Library
ESP32 ESP-NOW with ESP32 V3.0.0 or greater Library

In 2024 Expressif updated the libraries that the ESP32 board library was based on.

This meant that ESP32 board libraries 3.0.0 and greater have certain changes of functions that will break code written on pre version 3 libraries.

Sadly this means that onlne tutorials written on the old board managers suddenly doesn't work.

This video deals with the error message caused by the line:

esp_now_register_recv_cb(OnDataRecv);

Producing the error:

Compilation error: invalid conversion from 'void (*)(const uint8_t*, const uint8_t*, int)' {aka 'void (*)(const unsigned char*, const unsigned char*, int)'} to 'esp_now_recv_cb_t' {aka 'void (*)(const esp_now_recv_info*, const unsigned char*, int)'} [-fpermissive]

As I have come across these issues I have created short videos to explain the changes that need to be made to your code.

This video looks at changes to certain wifi features linked to ESP-NOW

Click to download resources for Video

ESP32 setting a Custom MAC Address
ESP32 setting a Custom MAC Address

In 2024 Expressif updated the libraries that the ESP32 board library was based on.

This meant that ESP32 board libraries 3.0.0 and greater have certain changes of functions that will break code written on pre version 3 libraries.

Sadly this means that onlne tutorials written on the old board managers suddenly doesn't work.

As I have come across these issues I have created short videos to explain the changes that need to be made to your code.

This video looks at changes to certain wifi features linked to setting a custom MAC address

Click to download resources for Video


 

 

Contact

If you have a particular subject you want covered please email the address in this image: and use Arduino/C++ ESP32 Lessons as a reference.
Please be aware that this is a hobby that fits around work so please be patient.