Projects
ESP32 Circuit

ESP32 Circuit

This circuit will serve as the communication circuit using the ESP32, a microcontroller with WiFi and BLE (Bluetooth Low Energy) capabilities. This circuit will send all sensor data to the IoT platform or the MQTT broker over WiFi and to the mobile app over BLE. It will receive control signals from the mobile app over BLE and remotely via MQTT over WiFi.

The ESP32 circuit will exchange data with the Nano 1 and Pico circuits over UART and with the Nano 2 circuit over LoRa.

In this step we will add the OLED display and the LED module.

See the OLED micro-circuits guide.

We will pick this circuit up again later and update the program to enable data exchange with the MQTT Broker over WiFi and data exchange with the IoT App over BLE.

⚠️

In the Node-RED variant of the solution the Nano and Pico circuits will be directly connected with USB cables to the computer running Node-RED which will exchange data with the MQTT broker. In this scenario, the ESP32 circuit is not required. However, if the ESP32 cricuit is not included, the Node-RED variant will also not support BLE communication with the mobile app.

Components

Component
FunctionVoltagePins
LoRa communication Module
(SX1278-RA02)
For LoRa communication between boards.3.3VSPI
OLED DisplayUsed to display data.3.3VI2C
LED ModuleUsed as an indicator.3.3VDigital Out

Circuit Diagram

ESP32 Circuit Diagram

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.

Board Pin
Code Pin
ModeComponentPin
D22SPI CSLora SX1278-RA02NSS
D44GPIO--
D1313Hardware UART1 TXNano 2A1 (RX)
D1414Hardware UART1 RXNano 2A2 (TX)
RX216Hardware UART2 RXPicoD4 (TX)
TX217Hardware UART2 TXPicoD7 (RX)
D1818SPI SCKLora SX1278-RA02SCK
D1919SPI CIPOLora SX1278-RA02CIPO
D2121I2C SDAOLEDSDA
D2222I2C SCLOLEDSCK
D2323SPI COPILora SX1278-RA02COPI
D2525GPIO Digital OutRGB LED ModuleGreen Cathode
D2626GPIOLora SX1278-RA02DIO0
D2727GPIOLora SX1278-RA02RST
D3232GPIO Digital OutRGB LED ModuleRed Cathode
D3333GPIO Digital OutRGB LED ModuleBlue Cathode

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.