TTGO LoRa32 V2.1 - TTN sketch for Relays with BME280 support

I made a sketch for connecting a TTGO Paxcounter to the things network with support for a relay and a temperature sensor without the paxcounter functionality. I found a few sketches online based on the paxcounter but I didn’t find them lean and mean. There is support for the oled display wich displays the relay status, temperature, humidity and pressure.

The default configuration will send the status of the sensor and relays every 5 minutes but is fully customizable. I have it working for almost a month without any problems on a couple of paxcounter boards.

You can turn a relais on or off by sending downlink messages in the TTN Console. I added some payload formats (Decider, Converter, Validator and Encoder) to make the payload more easy to read. This is also necessary if you want to control the relais with Node-Red.

You can download it on:

2 Likes

Hi connectix,

When switching a relay via down-link messages please keep in mind the limitation of max 10 down-link messages per day. For more information see this link.

I have updated the topic title for the correct name of the board: TTGO LoRa32 V2.1.
TTGO-PAXCOUNTER-LoRa32-V2.1 is a (confusing) marketing name but not the name of the board.

2 Likes

Hello connectix, could you explain to me what command should I write in the TTN console to activate and deactivate the relay? thank you for your great contribution

Did you see this code?

So, a downlink with value 01 will switch on the relais, and anything else will switch it off.

Aside, the README mentions the following, but I failed to find any payload formats in the repository:

I added some payload formats (Decider, Converter, Validator and Encoder) to make the payload more easy to read. This is also necessary if you want to control the relais with Node-Red.