Press "Enter" to skip to content

ESP32 Programming Tips

The espBerry Project - Extending ESP32 Functionality
We have a myriad of references, but writing them down takes time…

Controller Area Network (CAN)


SAE J1939 Protocol Stack Sketch for ESP32 Using the Arduino IDESAE J1939 Protocol Stack Sketch for ESP32 Using the Arduino IDE

The  ARD1939 SAE J1939 protocol stack for Arduino was originally developed for the Arduino Uno and Arduino Mega 2560. In the meantime, I added versions for the Arduino Due and the ESP32. All technical information about ARD1939, the SAE J1939 protocol stack for Arduino, plus detailed description of implementation and available function calls is included in my book SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino. Read more…

ESP32 Triple CAN Bus Application Through Adding Two MCP2515 PortsESP32 Triple CAN Bus Application Through Adding Two MCP2515 Ports

The first question that may arise when talking about accessing the MCP2515 CAN Bus controller per ESP32 may be, “Why would you need an MCP2515 controller when the ESP32 comes with an internal CAN port?” Yes, I found this question in one of the online forums while researching this particular topic. The answer is easy: There are applications that require more than one CAN port, and the only applicable ESP32 resource to do so is the SPI interface, thus the MCP2515 – Stand-Alone CAN Controller with SPI Interface. As a matter of fact, hypothetically, you can add up to six(!) SPI-controlled CAN ports to the ESP32. However, in this post, we restrict ourselves to a total of three CAN ports. Read more…

ESP32 Development Board with NMEA 2000 & NMEA 0183 HATESP32 Development Board with NMEA 2000 & NMEA 0183 HAT

The ESP32 processor, integrating peripherals such as UART, CAN Bus, WIFI, and Bluetooth, allows a wide range of applications, and the low price adds to its popularity. There are various ESP32 development boards available in the market, such as the ESP32-WROOM-32, as shown to the left. However, compared to popular systems like the Raspberry Pi or Arduino, the hardware resources, i.e., additional peripherals, are limited.  Consequently, the thought of tapping into the vast resources of the Raspberry Pi or Arduino system makes sense. The above picture demonstrates the setup that I used to connect an NMEA 2000 and NMEA 0183 HAT with an ESP32 development board. Read more…

ESP32 with Dual Isolated CAN Port Controls Thomson Electrac Linear ActuatorESP32 with Dual Isolated CAN Port Controls Thomson Electrac Linear Actuator

For the original hardware I used our Arduino-Based ECU Development Board with Dual CAN Bus Interface. However, while the board was perfect for the software development phase of the project, I decided to go with galvanically isolated CAN ports to assure highest system reliability. For the final hardware design, I chose to create a derivative of our newest development, the espBerry. For the two isolated CAN ports, I chose the Dual Isolated CAN Bus HAT for Raspberry Pi. I extended the original espBerry baseboard, adding some digital and analog IO plus a serial connection for an external display. Read more…

DC Motor Control


ESP32 DC Motor PWM Speed Control (Pulse Width Modulation) - The Hidden FactsESP32 DC Motor PWM Speed Control (Pulse Width Modulation) – The Hidden Facts

Lately, I have worked on two projects requiring DC motor control per PWM (Pulse Width Modulation). What both projects had in common was a profound lack of documentation regarding PWM control, specifically the side effects that have a significant impact on the programming. To mention it upfront, programming PWM-based motor control using either the Arduino series of processors or the ESP32 is ridiculously easy. Read more…

Serial Communication


ESP32 WiFi, Bluetooth Classic, BLE, CAN Bus ModuleESP32 – Programming Three Serial Ports (UARTs) Using the Arduino IDE

The ESP32 processor allows mapping the three serial ports (UARTs) to any pin between GPIO0 and GPIO31. Most ESP32 development boards (including our ESP32 CAN Bus Module) offer additional ports labeled TX2/RX2 or similar, but you do not have to precisely use those pins. Every other GPIO pin can act as Serial RX/TX. Read more…

espBerry Project: ESP32 with CH9102F USB-UART Chip for Serial Speed up to 3Mbit/sespBerry Project: ESP32 with CH9102F USB-UART Chip for Serial Speed up to 3Mbit/s

The ESP32 has three UART interfaces, i.e., UART0, UART1, and UART2, which provide asynchronous communication, communicating at a speed of up to 5 Mbps. This post describes the serial port programming per UART0, using the Adafruit WCH CH9102F Friend – USB to Serial Converter, which supports up to 3 Mbps. Read more…


Electronics Projects with the ESP8266 and ESP32: Building Web Pages, Applications, and WiFi Enabled DevicesElectronics Projects with the ESP8266 and ESP32: Building Web Pages, Applications, and WiFi Enabled Devices

Copperhill Technologies highly recommends using this book for your wireless application projects. Yes, many good books and free online resources are available these days, but this is the book we are using. It made our approach to Bluetooth, BLE, and WIFI a breeze. Programming wireless applications without hassles was fun, and we will share them on this web page.

Projects throughout the book utilize the wireless functionality and processing power of the ESP microcontrollers. Projects are built in the Arduino IDE, so you don’t need to download other programming software. In addition, mobile apps are now ubiquitous, making the app build projects of the book very relevant, as are the web page design projects.

In Electronics Projects with the ESP8266 and ESP32, you’ll see how easy and practical it is to access information over the internet, develop web pages, build mobile apps to remotely control devices with speech recognition, or incorporate Google Maps in a GPS route tracking app.

More Information…

Copyright © 2023 Copperhill Technologies Corporation