Many of this library's codecs do not talk to a web browser. They talk to real machines: programmable logic controllers (PLCs), solar inverters, power-grid sensors, building controllers, and other ESP32 boards. To use them you have to connect the ESP32 to that machine with the right wires, the right adapter chip, and the right communication settings.
This guide is the wiring-and-settings reference for every codec that needs external hardware. It assumes no prior electronics knowledge: it explains what each connection is, what part you need to buy, how to wire it, and what numbers to type into your sketch.
One rule before anything else. The ESP32's pins run at 3.3 volts and are not 5-volt tolerant. Connecting a 5 V signal, a 12/24 V industrial signal, or an RS-232/RS-485 line directly to a GPIO pin can destroy the chip. Every serial bus below needs an adapter chip (a "transceiver" or "level shifter") between the machine and the ESP32. Never skip it.
What is universal here, and what is not. Most of this guide is electrical, and electricity does not care which microcontroller you bought: RS-485 is RS-485, a twisted pair is a twisted pair, and a missing common ground breaks a link on any board. That material applies anywhere.
The concrete parts - the toolchain commands, LED_BUILTIN, the TWAI controller, ESP-NOW - are ESP32 because ESP32 is the silicon this library currently runs on. They are concrete on purpose: "your board's UART peripheral" teaches a beginner nothing, and a getting-started guide that abstracts over hardware it does not yet support would be worse, not more portable. When a second architecture lands (see ROADMAP.md), the platform-specific parts get factored into per-platform annexes and the electrical material stays exactly where it is.
The library never dictates a pinout. Every driver takes its wiring through the API - an I2C address, explicit pin numbers, or a caller-supplied bus struct - so you decide what connects where and tell the call. That is why there is no per-module wiring diagram below: there is nothing to prescribe. What each module needs is in the generated module reference.
Before wiring anything to a machine, prove the boring part works: your computer can talk to your board, and your board runs your code. Almost every "the codec doesn't work" problem turns out to be here, not in the protocol. Ten minutes now saves an evening later.
Plug the board in and list serial ports:
You want a line naming a port. What it looks like depends on the USB chip on your board:
| Board's USB chip | Typical port name | Note |
|---|---|---|
| CP210x | COM3 / /dev/ttyUSB0 | Silicon Labs; may need a driver |
| CH340 / CH343 | COM8 / /dev/ttyUSB0 | WCH; very common on low-cost boards |
| Native USB | COM4 / /dev/ttyACM0 | The chip itself is the USB device |
Nothing appears? Work through these in order, because they are ordered by how often they are the cause:
Blink is the "hello world" of hardware: it proves the toolchain compiles, the upload path works, and the board runs your code. Nothing else can be trusted until it does.
If the LED blinks, the boring part works and every later problem is a real problem.
LED_BUILTIN is not defined on every board, and some boards have no user LED at all. If it does not compile, replace it with a pin number your board's pinout diagram shows as free, and watch that pin with a multimeter or an LED and resistor instead.
These are the failures you will actually hit, and what each one means.
"Failed to connect to ESP32: Timed out waiting for packet header" The board is not in download mode. Most boards enter it automatically; some cannot.
"Serial port busy" / "Access denied" / "Resource temporarily unavailable" Something else already has the port open. A serial monitor in another window is the usual culprit; close it. On Linux, fuser /dev/ttyUSB0 names the process holding it.
Upload succeeds, then the board reboots forever Open the serial monitor and read the message. Two common ones:
Serial monitor shows nothing, or shows garbage The monitor's baud rate does not match the sketch's. Serial.begin(115200) needs the monitor at 115200. Mismatched baud produces plausible-looking nonsense where you would expect silence. The plausibility is the confusing part.
It worked yesterday and does not today Check what changed physically first: a nudged jumper wire, a different USB port, a different cable. Hardware problems are usually mechanical.
The habits below prevent most of the damage and most of the confusing failures. They are worth adopting before you need them.
Power off before you rewire. Make every connection with the board unpowered. Moving a live wire is how the short circuits happen.
Check before you power. Look at every connection once more before applying power, especially power and ground. A swapped 3.3 V and GND destroys parts instantly and silently.
Everything shares a ground. Two devices that exchange signals must have their grounds connected. Without a common ground, a "signal" has no reference and the link either does not work or behaves randomly. This is the most common wiring mistake after the USB cable.
3.3 V is not 5 V tolerant. Repeated because it matters: any 5 V, 12 V, or 24 V signal needs a level shifter or transceiver between it and a pin. Industrial gear is rarely 3.3 V.
Keep signal wires short, and keep pairs together. Long unshielded runs pick up noise. For differential buses (RS-485, CAN) the two wires of a pair must be twisted together; that pairing is what rejects interference.
Label both ends of every wire. A ten-wire harness is unreadable an hour after you build it.
Change one thing at a time. When something stops working, undo the last single change. Two simultaneous changes make it impossible to tell which one broke it.
Suspect the connection first. Loose jumpers, a not-quite-seated header, a cold solder joint, and a charge-only cable cause more failures than code does.
Every protocol codec in this library is pure: it turns a message into bytes and bytes back into a message. It does not open the serial port or the network socket for you. Your sketch owns the wire. That keeps the library deterministic and lets the same codec run over a UART, a radio, Wi-Fi, or a host test.
In practice that means three jobs are yours:
The codec does the hard part in the middle: framing, checksums/CRCs, and the wire format, all verified against the published spec. Each section below links to the matching header in src/services/ and its description in FEATURES.md.
| Family | What carries the bytes | Extra hardware you supply |
|---|---|---|
| Serial field bus | A UART pin pair, through an adapter chip | An RS-485 or RS-232 transceiver, wiring, termination |
| CAN field bus | The ESP32 TWAI controller (or MCP2515 over SPI) | A CAN transceiver (SN65HVD230), wiring, 120 ohm terminators |
| Networked | TCP or UDP over the ESP32's Wi-Fi (or wired PHY) | Usually none beyond Wi-Fi; the device and a shared network |
| Radio (ESP-NOW) | The ESP32's built-in 2.4 GHz radio | None; just a second ESP-class board as the peer |
"Flag" is the PROTOCORE_ENABLE_* macro you set to compile the codec in (all default off). "Talks to" is the machine on the other end.
| Codec | Flag | Transport | External hardware | Typical settings | Talks to |
|---|---|---|---|---|---|
| Modbus RTU | PROTOCORE_ENABLE_MODBUS_RTU | Serial (RS-485/232) | RS-485 transceiver | 19200 8E1, unit 1-247 | Modbus sensors, drives, meters |
| Modbus TCP | PROTOCORE_ENABLE_MODBUS | TCP | Wi-Fi/Ethernet | port 502 | Modbus PLCs and gateways |
| Modbus master | PROTOCORE_ENABLE_MODBUS_MASTER | TCP (client) | Wi-Fi/Ethernet | port 502 | Modbus slave devices |
| SunSpec | PROTOCORE_ENABLE_SUNSPEC | Modbus (RTU or TCP) | per Modbus row | model base reg 40000 | Solar inverters, meters, batteries |
| DF1 | PROTOCORE_ENABLE_DF1 | Serial (RS-232/485) | RS-232 or RS-485 transceiver | 19200, full-duplex | Allen-Bradley (Rockwell) PLCs |
| Host Link | PROTOCORE_ENABLE_HOSTLINK | Serial (RS-232/422/485) | transceiver | 9600 7E2, unit 00-31 | Omron PLCs (C-mode) |
| FINS | PROTOCORE_ENABLE_FINS | UDP | Wi-Fi/Ethernet | UDP port 9600 | Omron PLCs (FINS) |
| MELSEC | PROTOCORE_ENABLE_MELSEC | TCP or UDP | Wi-Fi/Ethernet | port set on the PLC | Mitsubishi PLCs (MC 3E) |
| S7comm | PROTOCORE_ENABLE_S7COMM | TCP (ISO-on-TCP) | Wi-Fi/Ethernet | port 102, rack/slot | Siemens S7-300/400/1200/1500 |
| BACnet/IP | PROTOCORE_ENABLE_BACNET | UDP | Wi-Fi/Ethernet | UDP port 47808 | Building automation controllers |
| EtherNet/IP | PROTOCORE_ENABLE_ENIP | TCP + UDP | Wi-Fi/Ethernet | TCP 44818, UDP 2222 | Allen-Bradley / ODVA devices |
| CIP | PROTOCORE_ENABLE_CIP | over EtherNet/IP | Wi-Fi/Ethernet | (rides ENIP) | CIP objects on ODVA devices |
| DNP3 | PROTOCORE_ENABLE_DNP3 | Serial or TCP | transceiver or Wi-Fi | TCP 20000, 16-bit addresses | SCADA / utility outstations |
| C37.118 | PROTOCORE_ENABLE_C37118 | Serial, TCP or UDP | transceiver or Wi-Fi | no fixed port (often 4712/4713) | Power-grid PMUs / PDCs |
| M-Bus | PROTOCORE_ENABLE_MBUS | Serial (M-Bus bus) | M-Bus level converter (TSS721) | 2400 8E1, primary addr 1-250 | Water / gas / heat / power meters |
| SDI-12 | PROTOCORE_ENABLE_SDI12 | Serial (1-wire SDI-12) | level / direction circuit | 1200 7E1, sensor addr 0-9/A-Z | Soil / water / weather sensors |
| DMX512 / RDM | PROTOCORE_ENABLE_DMX | Serial (RS-485) | RS-485 transceiver (MAX485) | 250k 8N2, up to 512 channels | Stage / architectural lighting |
| NMEA 0183 | PROTOCORE_ENABLE_NMEA0183 | Serial (UART / RS-422) | none (TTL) or RS-422 receiver | 4800 or 9600 8N1 | GPS / marine instruments |
| IO-Link | PROTOCORE_ENABLE_IOLINK | Serial (3-wire SDCI) | IO-Link transceiver (MAX14819) | 4.8 / 38.4 / 230.4 kbit/s | Smart sensors / actuators |
| IEC 60870 | PROTOCORE_ENABLE_IEC60870 | TCP (-104) / serial (-101) | Wi-Fi or RS-232/485 transceiver | TCP 2404; -101 link address | Utility RTUs / SCADA outstations |
| CANopen | PROTOCORE_ENABLE_CANOPEN | CAN (TWAI or SPI) | CAN transceiver | 125k-1M bit/s, node 1-127 | Motion drives, I/O, CANopen nodes |
| J1939 | PROTOCORE_ENABLE_J1939 | CAN (TWAI or SPI) | CAN transceiver | 250k bit/s, 29-bit ids | Trucks, tractors, gensets, marine |
| DeviceNet | PROTOCORE_ENABLE_DEVICENET | CAN (TWAI or SPI) | CAN transceiver (+ 24 V bus) | 125/250/500k, MAC 0-63 | DeviceNet I/O, drives (CIP/CAN) |
| NMEA 2000 | PROTOCORE_ENABLE_NMEA2000 | CAN (TWAI or SPI) | CAN transceiver (+ N2K tap) | 250k bit/s, Fast Packet | Marine GPS / wind / depth / engine |
| OPC UA | PROTOCORE_ENABLE_OPCUA | TCP | Wi-Fi/Ethernet | port 4840, SecurityPolicy None | OPC UA clients / SCADA |
| OPC UA client | PROTOCORE_ENABLE_OPCUA_CLIENT | TCP (client) | Wi-Fi/Ethernet | port 4840 | OPC UA servers |
| SNMP | PROTOCORE_ENABLE_SNMP | UDP | Wi-Fi/Ethernet | UDP 161 (agent), 162 (trap) | Network monitoring systems |
| ESP-NOW | PROTOCORE_ENABLE_ESPNOW | 2.4 GHz radio | none (a peer ESP board) | shared channel, peer MAC | Other ESP32 / ESP8266 boards |
A "serial field bus" sends data one bit at a time down a wire, the way the classic serial port did. Industrial buses use a tougher electrical standard than a plain UART so the signal survives long noisy cable runs. The ESP32 cannot drive those wires directly; a small transceiver chip sits between the ESP32's UART and the bus.
RS-485 is the workhorse of factory wiring. It sends each bit as the difference between two wires (called A/**D-** and B/**D+**), which rejects electrical noise and reaches over a kilometer. Many devices share one pair of wires (a "multidrop" bus), so only one device may transmit at a time.
What you need: an RS-485 transceiver. Prefer a 3.3 V part so its logic pins match the ESP32 directly: MAX3485, SP3485, ADM3485, or THVD1450. The classic MAX485 is a 5 V part; if you use one, add a logic-level shifter on its data pins. Cheap "RS-485 to TTL" breakout modules bundle the chip and the screw terminals.
The connections:
| Transceiver pin | Connect to |
|---|---|
| RO (receiver out) | ESP32 UART RX |
| DI (driver in) | ESP32 UART TX |
| DE + RE (tied together) | One ESP32 GPIO (the direction-control pin) |
| A / B | The bus pair, to the same A/B on every device |
| VCC / GND | 3.3 V and ground, shared with the ESP32 |
Because two wires carry traffic both directions, you must tell the transceiver when to talk and when to listen. That is the direction-control pin: drive the GPIO high to transmit, low to receive. (Some modules auto-switch and need no GPIO; they are simpler but slightly less reliable at high baud.)
Two more parts that matter on a real bus:
A 2-wire ("half-duplex") bus is by far the most common. A 4-wire ("full-duplex") RS-485 uses two pairs (one to transmit, one to receive) and does not need the direction pin.
RS-232 is the old PC serial port: one wire per direction, swinging between about +/-3 and +/-15 volts, point-to-point (one device per port), short cables. You need a level shifter such as the 3.3 V MAX3232 between the device's RS-232 connector and the ESP32 UART:
| MAX3232 side | Connect to |
|---|---|
| TTL T1IN | ESP32 UART TX |
| TTL R1OUT | ESP32 UART RX |
| RS-232 T1OUT/R1IN | the device's RX/TX |
| VCC/GND | 3.3 V and ground |
Cross TX to RX and RX to TX (a "null-modem" crossover) if both ends are devices. A PC-and-modem pair does not need it.
The ESP32 has three hardware UARTs. UART0 is the USB programming/console port; leave it alone. Use UART1 or UART2 for the field bus. On the classic ESP32, Serial2 defaults to GPIO16 (RX) and GPIO17 (TX), but you can map a UART to almost any free GPIO. Avoid the boot strapping pins (GPIO0, 2, 5, 12, 15) and the flash pins (GPIO6-11), and on ESP32-S3/C3 pick any free GPIO through the pin matrix.
Open the port with the baud rate and framing your device expects, then pump bytes through the codec. A half-duplex RS-485 send looks like this:
Framing (deciding where one message ends and the next begins) is the transport's job. For Modbus RTU that is the 3.5-character idle gap between frames; collect a frame, then hand it to the codec.
Both can run over serial as well as IP. Wire them like Modbus RTU (RS-485 or RS-232 transceiver) and see their entries under networked codecs for addressing and the codec calls; the framing is transport-independent.
PROTOCORE_ENABLE_MBUS. Wired M-Bus is the European utility-meter bus (water, gas, heat, electricity). Electrically it is not RS-485: it is its own powered two-wire bus where the master sends by voltage modulation and the meter replies by current modulation. So you need an M-Bus master level converter (a TSS721-based module is the cheap option) between an ESP32 UART and the bus. Wire the ESP32 TX/RX to the module's UART side and the two M-Bus terminals to the meters. Typical line settings are 2400 baud, 8E1; meters have a primary address 1-250.
The codec is the framing + record layer:
A natural wireless meter gateway: poll meters over the M-Bus and publish the readings over MQTT / HTTP. Only the LVAR raw/ASCII variable form is decoded; the BCD-length LVAR variants are not. See src/services/fieldbus/mbus/mbus.h.
PROTOCORE_ENABLE_SDI12. SDI-12 is the 1200-baud single-wire bus for soil, water, and weather sensors. One data line carries both directions (half-duplex, 7E1); the recorder addresses a sensor by one character (0-9, A-Z, a-z). The electrical layer is a 5 V line with a marking/break convention, so on a 3.3 V ESP32 you add a small level + direction circuit (a couple of transistors, or one of the ready-made SDI-12 interface boards) between a UART and the bus.
A measurement is two steps: start it, wait, then fetch:
Poll a sensor string and publish the readings over Wi-Fi. See src/server/peripherals/sdi12/sdi12.h.
PROTOCORE_ENABLE_DMX. DMX512 drives stage and architectural lighting over RS-485 at 250 kbit/s, 8N2 - so wire the same RS-485 transceiver (a MAX485 is the classic cheap part) as in the RS-485 section above. DMX is one-way and positional: each fixture listens on a start address and reads N consecutive channel slots.
RDM (ANSI E1.20) adds two-way device management on the same pair (the transceiver must be switched to receive for the reply, and RDM needs proper direction timing). Build a request with protocore_dmx_rdm_build() (set the destination / source protocore_dmx_rdm_uid(), command class, and PID) and read a reply with protocore_dmx_rdm_parse(), which checks the RDM checksum. Discover, address, and configure fixtures from a web UI - a tidy wireless lighting controller. See src/server/peripherals/dmx/dmx.h.
PROTOCORE_ENABLE_NMEA0183. The classic GPS / marine sentence protocol. A hobby GPS breakout outputs 3.3 V TTL serial that wires straight to an ESP32 RX pin (no transceiver) - typically 9600 baud, 8N1 (older units 4800). Full-size marine instruments use RS-422, so for those add an RS-422 receiver. It is mostly one-way (the receiver talks; you listen).
Decode position / speed / heading and republish it over Wi-Fi (a web map, MQTT, or an NMEA-0183-to-NMEA-2000 bridge with the codec next door). See src/services/timing_position/nmea0183/nmea0183.h.
PROTOCORE_ENABLE_IOLINK. IO-Link (SDCI) is the point-to-point link to modern smart sensors and actuators - a single device per port over a 3-wire cable (L+, L-, and the C/Q data line). The data line is not plain UART levels. It swings to the 24 V supply, so you need a dedicated IO-Link master transceiver (a MAX14819 or L6360-class chip) between an ESP32 UART and the port. The transceiver also generates the wake-up pulse and handles the line driving. The UART runs at one of the three SDCI rates (COM1 4.8 / COM2 38.4 / COM3 230.4 kbit/s).
This codec is the data-link message layer - in particular the SDCI checksum, the easy thing to get wrong:
The per-device M-sequence and ISDU layout come from the device's IODD profile. This gets a sensor's data onto Wi-Fi via a single transceiver. See src/services/fieldbus/iolink/iolink.h.
CAN (Controller Area Network) is a two-wire differential bus (CAN_H / CAN_L) used across factory automation and vehicles. It is cheap and robust, and the ESP32 already has a CAN controller built in (called TWAI), so you only add a transceiver chip to drive the differential pair.
You need a CAN transceiver between the ESP32 and the bus. Two cheap options:
Bus rules that matter: terminate both ends of the bus with a 120 ohm resistor (many breakouts have a jumper for it), keep stubs short, and set every node to the same bit rate (125 kbit/s, 250 k, 500 k, and 1 Mbit/s are common). All nodes on a CAN bus must agree on the bit rate.
PROTOCORE_ENABLE_CANOPEN. CANopen (CiA 301) is the dominant higher-layer protocol for CAN in factory automation: motion drives, I/O blocks, sensors. Each node has an id 1-127. The codec builds and parses the messages; your sketch moves the frames with the TWAI driver (or the MCP2515):
This is the classic wireless bridge: poll CANopen drives over the wire and publish their state over MQTT / HTTP / a WebSocket. SDO transfers are expedited (<= 4 octets); segmented / block transfer is a future addition. See src/services/fieldbus/canopen/canopen.h.
PROTOCORE_ENABLE_J1939. The CAN higher-layer protocol for heavy-duty vehicles, agriculture, marine, and gensets - same wiring as above (transceiver + terminators), but it uses 29-bit extended ids, almost always at 250 kbit/s. The codec packs and unpacks the id (priority / PGN / source / destination) and handles multi-packet messages:
A classic wireless gateway: decode engine / transmission / genset PGNs off the bus and publish them over MQTT or a web dashboard. See src/services/fieldbus/j1939/j1939.h.
PROTOCORE_ENABLE_DEVICENET. DeviceNet is CIP over CAN (the same CIP objects as EtherNet/IP, but on a CAN wire). Electrically it is CAN with a twist: a DeviceNet cable carries 24 V power alongside CAN_H / CAN_L. A real drop also needs the power conductors and the standard 5-pin connector - but the signalling is ordinary CAN, so the same transceiver wiring as above applies (use 125, 250, or 500 kbit/s; each node has a MAC id 0-63).
This module supplies the DeviceNet-specific link layer; you build the CIP message body with the protocore_cip_* functions (enable PROTOCORE_ENABLE_CIP):
Bridge a DeviceNet segment onto Wi-Fi the same way as the other CAN buses. See src/services/fieldbus/devicenet/devicenet.h.
PROTOCORE_ENABLE_NMEA2000. The marine instrumentation backbone (GPS, wind, depth, AIS, engine data) - electrically it is CAN at 250 kbit/s, and protocol-wise it is J1939, so the wiring is the same transceiver setup. A real N2K backbone uses a powered trunk with drop "tees". Tap a drop with your transceiver (it only needs CAN_H / CAN_L / GND - leave the N2K power to the backbone).
NMEA 2000 carries most data either in a single 8-octet frame or via Fast Packet (up to 223 octets). The codec reuses the J1939 id functions and adds Fast Packet:
Bridge the backbone onto Wi-Fi: turn boat data into a web dashboard or MQTT feed. See src/services/timing_position/nmea2000/nmea2000.h.
These codecs reach a device over a network instead of a dedicated wire. The "external hardware" is usually just the target device plus a shared network; the ESP32's built-in Wi-Fi supplies the link.
PROTOCORE_ENABLE_IEC60870. The European utility-SCADA protocol. It has two transports and this codec does both:
This makes a clean protocol-converting gateway: terminate -101 from an old RTU on the serial side and re-expose it as -104 over Wi-Fi (or vice-versa), since both share the ASDU layer. See src/services/energy/iec60870/iec60870.h.
Not everything the ESP32 talks to is an industrial machine. This library also drives the cheap sensor and actuator breakout boards you solder onto a breadboard: a clock, a presence radar, touch pads, a thermometer, a servo driver, and two kinds of meter. Unlike the field buses above, these run at 3.3 V and wire directly - no transceiver, no level shifter. Most are I2C (two shared wires); the LD2410 and a GPS are plain UART.
Each is a PROTOCORE_ENABLE_* flag (default off) with a pure, host-tested codec and a hand-held beginner example under examples/L7-Application/.
| Breakout | Flag | Bus | Address | Wiring | Measures / does |
|---|---|---|---|---|---|
| DS3231 / DS1307 | PROTOCORE_ENABLE_RTC | I2C | 0x68 | SDA 21, SCL 22 (+ coin cell) | Battery-backed wall-clock time |
| SHT3x (GY-SHT31) | PROTOCORE_ENABLE_SHT3X | I2C | 0x44 | SDA 21, SCL 22 | Temperature + humidity |
| MPR121 | PROTOCORE_ENABLE_MPR121 | I2C | 0x5A | SDA 21, SCL 22, ADDR->GND | 12 capacitive touch buttons |
| ADS1115 | PROTOCORE_ENABLE_ADS1115 | I2C | 0x48 | SDA 21, SCL 22, ADDR->GND | 16-bit analog voltage (4 channels) |
| INA219 | PROTOCORE_ENABLE_INA219 | I2C | 0x40 | SDA 21, SCL 22, Vin+/Vin- in series | Current + power of a load |
| PCA9685 | PROTOCORE_ENABLE_PCA9685 | I2C | 0x40 | SDA 21, SCL 22, V+ = servo supply | 16 PWM / servo outputs |
| LD2410 | PROTOCORE_ENABLE_LD2410 | UART | - | module TX -> GPIO 16, RX -> GPIO 17 | mmWave human presence / motion |
| GT-U7 GPS (NMEA) | PROTOCORE_ENABLE_NMEA0183 | UART | - | module TX -> GPIO 16 (9600 baud) | Position / time (NMEA 0183) |
I2C lets many chips share just two wires: SDA (data) and SCL (clock). On the classic ESP32 these default to GPIO 21 (SDA) and GPIO 22 (SCL). Wire every I2C breakout's SDA to 21 and SCL to 22 (they all share the pair), give each 3V3 and GND, and the ESP32 tells them apart by their distinct address. Most breakouts already include the small pull-up resistors I2C needs. If two boards share an address (the PCA9685 and INA219 both default to 0x40), change one with its address solder pads.
All the I2C drivers bring the bus up and address it through one shared owner (server/peripherals/i2c.h). So there is a single place to move the pins: PROTOCORE_I2C_SDA_PIN / PROTOCORE_I2C_SCL_PIN (default -1 = the platform default 21 / 22). Set both to free GPIOs to relocate the whole bus.
Two more knobs live with them. PROTOCORE_I2C_HZ (default 100000) is the bus clock; 100 kHz standard mode is what every driver here is rated for, and a device that supports 400 kHz fast mode will take it if the wiring is short and well pulled up. PROTOCORE_I2C_TIMEOUT_MS (default 50) bounds one transfer. A device that stops clocking stalls that read instead of the main loop.
Running alongside wired Ethernet. Only the classic ESP32 (WROOM/WROVER) and the ESP32-P4 have the built-in RMII Ethernet MAC that a LAN8720 PHY needs; the ESP32-S3 / C3 have no RMII MAC and do wired Ethernet over SPI with a W5500 instead. On an RMII board the LAN8720 uses GPIO 21 (TX_EN) and GPIO 22 (TXD1) - the very pins I2C defaults to - plus, on boards that route the 50 MHz RMII clock there, GPIO 16/17. So with an RMII PHY enabled you must move the peripheral buses off those pins: set -DPROTOCORE_I2C_SDA_PIN=32 -DPROTOCORE_I2C_SCL_PIN=33 (or any free pair) to relocate the I2C sensors, and pass alternate RX/TX to protocore_ld2410_begin(rx, tx) / your GPS Serial.begin(baud, SERIAL_8N1, rx, tx) (e.g. GPIO 4 / 2). Avoid the other RMII pins (19, 23, 25, 26, 27, 18) and the strapping pins (0, 2, 5, 12, 15). On an S3 with a W5500 there is no RMII clash, but still keep the I2C/UART pins clear of the SPI pins the W5500 uses.
These all follow the same shape as the field-bus codecs: a pure codec you can unit-test on a PC, and a thin binding that does the actual I2C / UART transfer on the ESP32.
These format data but do not add a new physical connection: they ride whatever transport already carries the data (MQTT, CoAP, HTTP), so their hardware needs are simply that transport's.
Field wiring lives in a harsher world than a breadboard. A few habits protect the ESP32 and keep the bus reliable:
For the security posture of each protocol (many industrial protocols have no authentication or encryption and must run on a trusted network), see SECURITY.md. For the full description and spec reference of each codec, see FEATURES.md and STANDARDS.md.
76 modules attach to something physical. Every one takes its wiring through the API - an I2C address, explicit pins, or a caller-supplied bus struct - so the library never dictates a pinout and none is documented here. Pure codecs have no bring-up call at all: you own the link.
| Module | Attaches via | Bring-up call | Feature flag |
|---|---|---|---|
| rtc | caller-supplied link | protocore_rtc_begin(const uint8_t *work) | PROTOCORE_ENABLE_RTC |
| time_source | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_TIME_SOURCE |
| Module | Attaches via | Bring-up call | Feature flag |
|---|---|---|---|
| ads1115 | caller-supplied link | protocore_ads1115_begin(uint8_t *work) | PROTOCORE_ENABLE_ADS1115 |
| dshot | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_DSHOT |
| fdc2214 | caller-supplied link | protocore_fdc2214_begin(uint8_t *work) | PROTOCORE_ENABLE_FDC2214 |
| ina219 | caller-supplied link | protocore_ina219_begin(uint8_t *work) | PROTOCORE_ENABLE_INA219 |
| ld2410 | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_LD2410 |
| ldc1614 | caller-supplied link | protocore_ldc1614_begin(uint8_t *work) | PROTOCORE_ENABLE_LDC1614 |
| mpr121 | caller-supplied link | protocore_mpr121_begin(uint8_t *work) | PROTOCORE_ENABLE_MPR121 |
| pca9685 | caller-supplied link | protocore_pca9685_begin(uint8_t *work) | PROTOCORE_ENABLE_PCA9685 |
| pn532 | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_PN532 |
| sht3x | caller-supplied link | protocore_sht3x_begin(uint8_t *work) | PROTOCORE_ENABLE_SHT3X |
| vl53l0x | caller-supplied link | protocore_vl53l0x_begin(uint8_t *work) | PROTOCORE_ENABLE_VL53L0X |
| ble_gatt | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_BLE_GATT |
| cc1101 | SPI (caller-supplied bus) | protocore_cc1101_init(const uint8_t *work, const protocore_cc1101_bus *bus, const protocore_cc1101_config *cfg) | PROTOCORE_ENABLE_CC1101 |
| enocean | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_ENOCEAN |
| espnow | caller-supplied link | protocore_espnow_begin(const uint8_t *work) | PROTOCORE_ENABLE_ESPNOW |
| lora | SPI (caller-supplied bus) | protocore_lora_init(const uint8_t *work, const protocore_lora_bus *bus, const protocore_lora_config *cfg) | PROTOCORE_ENABLE_LORA |
| nrf24 | SPI (caller-supplied bus) | protocore_nrf24_init(const uint8_t *work, const nrf_bus *bus, const nrf_config *cfg) | PROTOCORE_ENABLE_NRF24 |
| promisc | caller-supplied link | protocore_promisc_begin(uint8_t *work, uint8_t channel, protocore_promisc_sink_fn sink) | PROTOCORE_ENABLE_PROMISC |
| radio_sniff | CAN | none (pure codec) | PROTOCORE_ENABLE_RADIO_SNIFF |
| sigfox | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_SIGFOX |
| thread | caller-supplied link | protocore_thread_spinel_reader_init(const uint8_t *work, SpinelReader *r, const uint8_t *value, uint16_t len) | PROTOCORE_ENABLE_THREAD |
| wifi_sniffer | caller-supplied link | protocore_wifi_sniffer_scan_init(const uint8_t *work) | PROTOCORE_ENABLE_WIFI_SNIFFER |
| wisun | caller-supplied link | protocore_wisun_init(const uint8_t *work, WisunFan *fan, const protocore_ip *border_router, WisunNode *storage, size_t cap) | PROTOCORE_ENABLE_WISUN |
| zigbee | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_ZIGBEE |
| zwave | CAN | none (pure codec) | PROTOCORE_ENABLE_ZWAVE |
| rawl2 | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_RAWL2 |
| Module | Attaches via | Bring-up call | Feature flag |
|---|---|---|---|
| dmx | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_DMX |
| sdi12 | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_SDI12 |
| ads | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_ADS |
| bacnet | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_BACNET |
| canopen | CAN | protocore_canopen_sdo_reasm_init(const uint8_t *work) | PROTOCORE_ENABLE_CANOPEN |
| cclink | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_CCLINK |
| cia402 | CAN | none (pure codec) | PROTOCORE_ENABLE_CIA402 |
| cip | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_CIP |
| cotp | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_COTP |
| devicenet | CAN | none (pure codec) | PROTOCORE_ENABLE_DEVICENET |
| df1 | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_DF1 |
| directnet | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_DIRECTNET |
| enip | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_ENIP |
| fins | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_FINS |
| hart | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_HART |
| hostlink | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_HOSTLINK |
| interbus | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_INTERBUS |
| iolink | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_IOLINK |
| lonworks | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_LONWORKS |
| mbplus | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_MBPLUS |
| melsec | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_MELSEC |
| modbus | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_MODBUS |
| powerlink | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_POWERLINK |
| profibus | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_PROFIBUS |
| profinet | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_PROFINET |
| s7comm | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_S7COMM |
| sercos | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_SERCOS |
| snp | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_SNP |
| Module | Attaches via | Bring-up call | Feature flag |
|---|---|---|---|
| mbus | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_MBUS |
| Module | Attaches via | Bring-up call | Feature flag |
|---|---|---|---|
| j1939 | CAN | none (pure codec) | PROTOCORE_ENABLE_J1939 |
| nmea0183 | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_NMEA0183 |
| nmea2000 | CAN | none (pure codec) | PROTOCORE_ENABLE_J1939 |
| Module | Attaches via | Bring-up call | Feature flag |
|---|---|---|---|
| ad9238 | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_AD9238 |
| hmmd | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_HMMD |
| pmbus | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_PMBUS |
| rcwl0516 | caller-supplied link | protocore_rcwl0516_presence_init(const uint8_t *work, PresenceCore *c, uint32_t debounce_ms, uint32_t hold_ms, uint32_t now) | PROTOCORE_ENABLE_RCWL0516 |
| sen0192 | caller-supplied link | protocore_sen0192_motion_init(const uint8_t *work, Sen0192Motion *m, uint32_t hold_ms, embed_bool active_high) | PROTOCORE_ENABLE_SEN0192 |
| smbus | caller-supplied link | protocore_smbus_begin(const uint8_t *work) | PROTOCORE_ENABLE_SMBUS |
| gpib | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_GPIB |
| hislip | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_HISLIP |
| scpi | caller-supplied link | protocore_scpi_status_init(ScpiStatus *s) | PROTOCORE_ENABLE_SCPI |
| vxi11 | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_VXI11 |
| simatic | codec only - caller owns the link | none (pure codec) | PROTOCORE_ENABLE_SIMATIC |
| ubx | caller-supplied link | protocore_ubx_stream_init(protocore_ubx_stream *st) | PROTOCORE_ENABLE_UBX |
| Module | Attaches via | Bring-up call | Feature flag |
|---|---|---|---|
| i2c | codec only - caller owns the link | none (pure codec) | - |
| spi | codec only - caller owns the link | none (pure codec) | - |
| uart | codec only - caller owns the link | none (pure codec) | - |
| Module | Attaches via | Bring-up call | Feature flag |
|---|---|---|---|
| gnss | codec only - caller owns the link | none (pure codec) | - |