UART Connections
Overview
While there are multiple communication protocols between boards and components, one of the simplest is UART (or Serial) Communication which requires a wired connection between the boards.
In this solution the ESP32, Nano Circuit 2 and the Pico Circuit will exchange data with each other over UART. The Nano 1 and the Pico will display the received data on the LCD, while the ESP32 will display the received data on the OLED.
The circuit diagram below shows the UART connections between the boards.
See the lesson on UART to understand the protocol.
The Nano Circuit 1 will use LoRa to exchange data with the ESP32 and so is not included here.
Connections
Each board generally has at least one set (TX and RX) of hardware UART pins. However, if the board is connected to the computer for uploading code or exchanging data with the Serial Monitor, one set of hardware UART pins is blocked.
As an alternative (or in addition) to the hardware UART pins you can define any two GPIO pins as TX and RX pins in the microcontroller program.
The ESP32 has two sets of hardware UART pins. While one is blocked for communication with the computer if connected, the other set if available for general use.
Connection Diagram
The Green (TX) and Blue (RX) wires between the Nano 1, Pico, and ESP32 are the UART connections. The Nano 2 is not connected to any board for UART, it will be connected to the ESP32 over LoRa later.
Connections
Board pin numbers are those printed on the board while code pin numbers need to be used in code (generally indicated in the pinout diagram as the GPIO pin number). They may be the same or different, depending on the board.
ESP32 Circuit
Board Pin | Code Pin | Mode | Component | Pin |
---|---|---|---|---|
D13 | 13 | Hardware UART1 TX | Nano 2 | A1 (RX) |
D14 | 14 | Hardware UART1 RX | Nano 2 | A2 (TX) |
RX2 | 16 | Hardware UART2 RX | Pico | D4 (TX) |
TX2 | 17 | Hardware UART2 TX | Pico | D7 (RX) |
Nano Circuit 1
Board Pin | Code Pin | Pin Mode | Component | Pin |
---|---|---|---|---|
A1 | A1 | Software UART RX | ESP32 | 13 (TX1) |
A2 | A2 | Software UART TX | ESP32 | 14 (RX1) |
Pico Circuit
Board Pin | Code Pin | Mode | Component | Pin |
---|---|---|---|---|
11 | 8 | Software UART TX | ESP32 | 16 (RX2) |
12 | 9 | Software UART RX | ESP 32 | 17 (TX2) |
Code
The code for this circuit is distributed across multiple files, so will not be displayed here. It will be available for download for subscribers.