Monitoring distant places was never easier. Thanks to LoRa network you can have device working years on batteries. This tutorial explains how measure and send basic environmental variables to the cloud. You can also extent this device for example to detect motion with PIR module or measure temperature with external DS18B20 temperature sensor.
UPDATE: You can now use also OTAA and JOIN commands. Added BAND command to switch to other frequencies wordwide. Now supports not only EU868 but also US915, AU915, KR920, IN865 and AS923.
Climate Module is indoor device, measures and sends:
- Pressure and Altitude
- Module rotation from accelerometer (1 - 6)
- Button press
- Battery voltage
You will need
- Core Module
- LoRa Module
- Mini Battery Module
- Climate Module
- Enclosure 102
- You will need Windows, Linux or macOS computer.
Connect all the modules on top of each other. It does not matter in what order you put modules together unless you use our enclosure with a hole for LoRa antenna.
Put the batteries in and optionally put device into the enclosure.
Download BigClown Playground multiplatform GUI tool. This tool can flash firmware. It also contains gateway for Radio Dongle and Node-RED but we will not use them because our device talks directly to LoRa gateways.
- Connect Core Module over USB to your PC and wait until the FTDI driver is installed
- Run the BigClown Playground
- Go to the Firmware tab and choose bcf-lora-climate-monitor firmware
- Choose the correct serial COM port and press "FLASH FIRMWARE" button
- After flashing, the Core Module will turn on red LED for 2 seconds
To configure they node keys you will need serial terminal application. Connect the Core Module to your computer over USB.
For configuration we use
AT commands over USB virtual serial port. Use your serial terminal application (Hterm, putty, minicom). Communication parameters are:
- Baudrate 115200
- 8 data bits, 1 stop bit, no parity
- New line
CR+LFfor transmit and for receive ( ! )
To list all possible commands use
AT$HELP. You will get:
AT$DEVEUI AT$DEVADDR AT$NWKSKEY AT$APPSKEY AT$APPKEY AT$APPEUI AT$BAND 0:AS923, 1:AU915, 5:EU868, 6:KR920, 7:IN865, 8:US915AT $MODE 0:ABP, 1:OTAAAT $JOIN Send OTAA Join packet AT$SEND Immediately send packet AT$STATUS Show status AT$BLINK LED blink 3 times AT$LED LED on/off AT+CLAC AT$HELP This help
To read the parameter use:
You receive the key:
To write the parameter:
For LoRa ABP mode you need to set these keys/values:
Also for the LoRa gateway/backend you need to get this information:
For OTAA set the MODE to 1 and the DEVICE and APP EUIs and call the AT$JOIN command to exchange the keys.
The LoRa Climate Monitor sends a LoRa packet when:
- After power-up, when the batteries are inserted
- Every 15 minutes
- After pressing the button
- When you type
AT$SENDto the console
You can also ask over serial port what is the status of sensors by typing
$STATUS: "Voltage",2.6 $STATUS: "Temperature",24.5 $STATUS: "Humidity",36.4 $STATUS: "Illuminance",115.0 $STATUS: "Pressure",97775 $STATUS: "Orientation",5 OK
Here are the received data in The Things Network
If you would like to decode data manually, in the firmware repository there is the
decode.py Python script which decodes the received binary HEX data:
hub@hpnix:~/bcf-lora-climate-monitor$ ./decode.py 011A0500F449006DBEFD Header : UPDATE Voltage : 2.6 Orientation : 5 Temperature : 24.4 Humidity : 36.5 Illuminance : 109 Pressure : 97786 hub@hpnix:~/bcf-lora-climate-monitor$ ./decode.py 021A0500F448006BBEF7 Header : BUTTON_CLICK Voltage : 2.6 Orientation : 5 Temperature : 24.4 Humidity : 36.0 Illuminance : 107 Pressure : 97774
Now that we have decoder in TTN, It is extremely easy to send data directly to Ubidots where they can be graphed and monitored. No need for any glue-logic script/service, data goes directly from TTN to Ubidots.
To set-up the Ubidots, follow intruction in screenshots below.
After you create dashboard, you can see the data in nice graphs.
You can flash other ready-to-use LoRa firmwares, just type "lora" on our github or in the firmware tab in BigClown Playground. Other functionality can be easily changed and extended in open-source firmware.
You can easily extend the project and create:
- LoRa Motion Detector
- LoRa Pulse Counter
- LoRa Button
- LoRa GPS Tracker
- LoRa tester with LCD Module
- Check out other BigClown projects.
- Take a look at the Module Overview.
- Learn about MQTTand BigClown MQTT topicsto control LEDs and relays.
- Try other integrationswith Grafana, Blynk, IFTTT, Ubidots and others.
- Use your Raspberry PIor other single board computer (SBC)as a server.
- Flash other firmwareor write your own firmwarefor the Core Module.
- Check the Core Module pinoutsand add your own buttons, relays and sensors.