The ESP32 provides a practical platform for developing SAE J1939 applications, including network interfaces, data loggers, gateways, and simulated electronic control units. Its processing power and wireless capabilities leave considerable room for application development beyond basic CAN communication.
However, CAN hardware alone does not turn an ESP32 into a J1939 device. The processor needs software that implements the protocol’s communication rules. For this project, I use ARD1939, my SAE J1939 protocol stack, together with an ESP32 CAN driver and the Arduino IDE.
The installation involves three software components: ESP32 board support for the Arduino IDE, the CAN driver, and the ARD1939 project. Understanding how these components work together makes the setup easier to follow.
CAN Hardware and J1939 Software
The original ESP32 used in this project includes a Classical CAN controller, referred to as TWAI in Espressif’s documentation. It supports the extended 29-bit CAN identifiers required for conventional SAE J1939 communication. However, it requires an external CAN transceiver to connect to the physical network. The processor’s TX and RX pins carry 3.3 V logic signals; they cannot connect directly to CAN_H and CAN_L.
For this project, I used the ESP32 WiFi, Bluetooth Classic, BLE, CAN Bus Module from Copperhill Technologies, which includes an onboard CAN transceiver.. A separate ESP32 development board and a suitable transceiver can serve the same purpose, provided the electrical connections and software pin assignments agree.
On the software side, the CAN driver handles communication with the controller. ARD1939 operates above that driver and supplies the J1939 protocol functionality. Your application then uses the stack to exchange J1939 messages.
This division matters when troubleshooting. A program that compiles successfully may still have an incorrect CAN pin assignment, while a working CAN interface does not by itself confirm that the J1939 application is configured correctly.
Preparing the Arduino IDE
Begin by installing the Arduino IDE and adding Espressif’s ESP32 board support through Boards Manager. If the ESP32 package is not available in the list, add Espressif’s board package address in the IDE’s Additional Boards Manager URLs setting, following the official installation instructions.
In Boards Manager, locate the “esp32 by Espressif Systems” package and install the version appropriate for the project. Then select the board configuration matching your hardware and choose its USB serial port. Before introducing the J1939 software, upload a simple sketch to confirm that compilation and programming work.
There is an important compatibility consideration here: the original ARD1939 ESP32 project uses an older CAN driver and a precompiled protocol component. Compatibility with every subsequent ESP32 board package should not be assumed. Espressif documents breaking changes between Arduino-ESP32 core versions 2.x and 3.0. If an older project fails to compile, investigate the software versions before changing the application code.
Once you establish a working combination, record the Arduino IDE version, ESP32 board package version, board selection, and library versions. These details make the installation reproducible.
Adding the ARD1939 Project
Download the ESP32 edition of ARD1939 provided with the original project and extract the archive into a local working folder. Preserve the supplied directory structure and open its Arduino sketch.
The ESP32 distribution includes a precompiled protocol component rather than the complete ARD1939 implementation source. Consequently, the supplied supporting files must remain available to the build process. Copying only the main sketch into a new project may leave required components behind.
Check the extracted package for installation notes and any libraries that need to be placed in the Arduino sketchbook’s libraries folder. An Arduino project archive is not necessarily a library archive, so the entire download should not automatically be installed through “Add .ZIP Library.”
Compile the supplied example before making changes. This first build establishes whether the development environment can locate the headers, CAN driver, and precompiled stack.
Using the Correct CAN Driver
For the original ESP32 implementation, I selected the ESP32 CAN Protocol Demo driver and modified it for use with ARD1939. The changes included adding CAN error reporting and making several C++ compatibility adjustments.
Those modifications are part of the integration. Replacing the project’s driver with an unrelated CAN library may require changes to the interface between the driver and the protocol stack. Even when two libraries support the same controller, their initialization, transmit, receive, and error-reporting functions can differ.
When reproducing the original project, begin with its accompanying driver files. Establish a working baseline before considering a migration to another driver.
Configuring the Hardware Interface
Before uploading the J1939 example, verify that the CAN transmit and receive GPIO assignments match the board’s wiring. On a board with an integrated transceiver, these connections are usually fixed by the hardware design.
Also check whether the transceiver has an enable or standby input that requires configuration. A correctly initialized controller cannot communicate through a transceiver that remains in standby.
The CAN bit rate must match the test network, and the driver must handle extended 29-bit identifiers. Use the settings appropriate to the supplied example and the network you intend to connect.
Running the J1939 Application
Begin with the supplied application’s existing initialization and processing sequence. Review its device identity, address settings, message handling, and transmission behavior before adapting it to your own project.
The protocol stack needs regular processing time. Preserve the example’s intended call sequence and avoid adding long delays or blocking operations that interfere with communication. Wireless connections, user interfaces, and data logging should be introduced after basic J1939 operation has been established.
Installing the stack also does not automatically provide an application that understands every engine parameter. Your program still needs to select the relevant Parameter Group Numbers, interpret their data fields, and apply the appropriate scaling and offsets.
Verifying the Installation
Use a small bench network for the initial test, with suitable termination and a second CAN interface or J1939 device. A CAN monitor provides an independent view of the messages exchanged by the ESP32.
Verify the installation in stages:
Confirm that the supplied project compiles and uploads.
Check any available startup and error messages.
Verify CAN reception and transmission.
Observe address claiming and the example’s intended J1939 traffic.
Introduce your own application changes gradually.
This sequence helps distinguish development-environment problems from wiring, driver, and protocol issues.
A Foundation for Further Development
With the hardware interface and example application working, ARD1939 provides a starting point for exploring embedded J1939 development on the ESP32. From there, the application can grow into a gateway, logger, simulator, or another purpose-built network device.
The original software is provided free of charge for demonstration and educational use, without warranty or technical support. My book, SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino, explains the ARD1939 interface and implementation concepts in greater detail. Although the original examples focus on other Arduino platforms, the protocol concepts remain relevant to the ESP32 version.





