This folder contains the implementation with a TTGO LoRa32 SX1276 (not available anymore? See Successor).
For the backend setup please follow the instructions on the main readme
- Install the ESP32 Core for Arduino (Installation with Boards Manager)
- Install the LoRa library which supports the SX1276 Chip
- Install CayenneLPP to package LoRa packets.
- Install Arduino-LMIC to send data over LoRaWan
- Copy the Template:
cp config.h.template config.h
. (This file is filled in with private data and should not be published) - Insert Application EUI (lsb), Device EUI (lsb) and App Key (msb) from the Device Overview in your TheThingsNetwork application to the
config.h
file. (Note: use the 'C-style' not Hex) - Optional: Change in
config.h
the way how to read sensordata (UART/A02YYUW or Trig/Echo) - Optional: Change the pins in
config.h
- Optional: Change cycle time in
config.h
- Optional: If you want to use a GPIO as power pin (only available for 3.3V sensor), enable it in
config.h
and define PWR_PIN. This should save more power during deep sleep, because some sensor always drain power. - Upload sketch to your board by using the
TTGO LoRa32-OLED-V1
Board from the ESP32 Core for Arduino
- Maybe you need to change the 'Region Configuration' of the Arduino-LMIC library. To change it, go to the
lmic_project_config.h
file within the LMIC Arduino library (See here). When using ABP Activation instead of OTAA Activation the TTN application does not receive packages after a restart of the device. The option 'reset frame counters' in your TTN Device Overview helps (see here).
- Connect
GND
of Sensor toGND
of Board - Connect VCC of Sensor to either
3V3
or5V
(if using a power pin, connect it to the corresponding pin, default21 (GPIO)
) - Connect
RX
of Sensor to PIN17 (U2_TXD)
- Connect
TX
of Sensor to PIN16 (U2_RXD)
You should also be able to use the other UART 1 connection of the board (Unforunately I'm not sure which PINs belong to the UART 1)
- Connect
GND
of Sensor toGND
of Board - Connect VCC of Sensor to either
3V3
or5V
(if using a power pin, connect it to the corresponding pin, default21 (GPIO)
) - Connect
Trig
of Sensor to PIN13 (GPIO)
- Connect
Echo
of Sensor to PIN12 (GPIO)
You can also use other GPIO pins which are not used internally by the board.
- Board: active -> 66mA : deep sleep -> 20mA