Farm ESP32 LoRa PJON base station
Base station for connecting remote sensors to Thingsboard.

Remote sensors use PJON over LoRa radio to communicate. The Thingsboard Gateway MQTT API is used to connect on the Thingsboard side.

See here for other sensors and more information on the system.

Written by Jotham Gates August 2023

Photos

Getting started

The Github repository containing all design files and code is here.

  1. Install the ESP32 Arduino boards manager.
  2. Install the following libraries using the Arduino library manager:
  3. Create a copy of credentials.example.h and name this credentials.h. Fill out the settings in this file for the WiFi network to connect to, MQTT broker and Thingsboard credentials.
  4. Upload the code to the ESP32.
  5. Assemble the electronics as shown in the schematics and optionally place inside a case.
  6. Test with other sensors and the Thingsboard server.

Schematics

The base station uses an ESP32 development board as its base. An SX1278 LoRa radio module breakout board is connected via jumper leads. LEDs are soldered along with their respective current limiting resistors to wires that can be plugged into the ESP32 board. An audio amplifier and speaker can also be connected for alarm functionality. I salvaged this from the sound effects module of a broken children's ride on toy car.

The schematic for the base station

Fun part / experiments

I originally planned to use the build in DAC of the ESP32 to play sounds on alarm conditions. At this point I haven't succeded in this (currently using the TunePlayer library to play simple monotonic songs instead). I did come across the ESP32-A2DP library that allows the use of this unit as a terrible sounding bluetooth speaker.

This sketch is the bt_music_receiver_to_internal_dac example from the ESP32-A2DP library with the addition of flashing lights.