LoRa/LoRaWAN tutorial 26: Sending Sensor Data To The Things Network
If you like this video and want to support me, go this page for my donation Paypal or crypto addresses:
https://www.youtube.com/c/mobilefish/about
This is part 26 of the LoRa/LoRaWAN tutorial.
In this video series different topics will be explained which will help you to understand LoRa/LoRaWAN.
It is recommended to watch each video sequentially as I may refer to certain LoRa/LoRaWAN topics explained earlier.
In this tutorial I will demonstrate how to send sensor data to The Things Network using my self build LoRa development board.
A button switch is used to detect a button press and a DHT11 sensor is used to measure the temperature and humidity.
Hardware setup
https://www.mobilefish.com/images/developer/lorawan_rfm95_arduino_leds_and_sensors.png
https://www.mobilefish.com/images/developer/lorawan_rfm95_arduino_leds_sensors_overview.png
Using the Tutorial 25 setup, two sensors were added to the breadboard:
- a button switch
- and a DHT11 sensor module
If the state of a pin is unknown, meaning nothing is connected to the pin, the pin is referred to as floating.
To prevent floating pins, the pin is pulled to Vcc (pin is high) or the pin is pulled to ground (pin is low).
The 10 kOhm resistor is to prevent a short circuit.
Key switch module aka button switch
Pin + connected to Arduino 3.3V
Pin middle not used
Pin - connected to Arduino GND
Price approximately € 0.25
Do not forget the 10 kΩ pull down resistor.
Digital Humidity & Temperature (DHT11) module aka DHT11 sensor.
This particular DHT11 sensor comes with a 10 kΩ pull up resistor from the data pin to Vcc.
Pin VCC connected to Arduino 3.3V
Pin DATA connected to Arduino pin 7
Pin GND connected to Arduino GND
Price approximately € 0.75
A DHT11 sensor is cheap, less precise and less accurate.
For better accuracy and precision use a DHT22.
DHT11 Specification
Supply voltage: 3 to 5.5V DC
Output: single-bus digital signal
Measuring range: humidity 20 to 90% RH, temperature 0 to 50°C
Accuracy: humidity ±5% RH, temperature ±2°C
Resolution: Humidity 1% RH, temperature 1°C
Long-term stability: less than ±1% RH / Year
Goto The Things Network console:
- Select the app: youtube_demo_app
- Select the registered device: youtube_demo_device
- Select reset frame counters. Do this each time your end device is powered up.
The selected device "youtube_demo_device" uses the OTAA method.
The DevEUI, Application EUI and AppKey are needed in the sketch, which will be explained later.
If you copy these values watch out for big-endian and little-endian notation.
When the sketch is uploaded, every 60 seconds the temperature and humidity data is displayed in The Things Network console.
To make the payload data more human readable, select tab | Payload Formats", select decode and copy and paste the decoder function from this link
https://www.mobilefish.com/download/lora/tutorial_26_decoder.txt
and paste it in this field.
Install the following libraries in the Arduino IDE (menu: Tools | Manage Libraries)
- MCCI LoRaWAN LMIC library (https://github.com/mcci-catena/arduino-lmic)
- DHT sensor library (https://github.com/adafruit/DHT-sensor-library)
- Adafruit Unified Sensor (https://github.com/adafruit/Adafruit_Sensor)
This library is needed by the DHT sensor library.
Open the Arduino IDE and copy the sketch from this link
https://www.mobilefish.com/download/lora/ttn-otaa-sensors.ino.txt
and call the sketch ttn-otaa-sensors.ino
Change the DevEUI, Application EUI and AppKey.
This sketch uses the Over-The-Air-Activation (OTAA) method.
The sketch transmits a byte value 0x01, each time the button is pressed.
It also transmits the temperature and humidity data from the DHT11 sensor, every 60 seconds.
The two leds can be switch On or Off, by sending a downlink message.
This is already demonstrated in Tutorial 25.
Connect the self build LoRa development board to your computer using the USB cable.
In the Arduino IDE, select menu Tools | Board and select: Arduino/Genuino Uno
In the Arduino IDE, select menu Tools | Port and select: your_port
Compile and upload the ttn-otaa-sensors sketch.
You should not see any errors.
In the Arduino IDE, select menu Tools | Serial Monitor
Select baud rate: 9600
Make sure a LoRa gateway is in your area and your LoRa end device can send messages to that gateway.
Go to The Things Console and see if the end device is registering.
Check if the temperature and humidity data is received every 60 seconds.
Press the switch button, in the Things Console you will see the message: "button: activated"
Check out all my other LoRa/LoRaWAN tutorial videos:
https://www.youtube.com/playlist?list=PLmL13yqb6OxdeOi97EvI8QeO8o-PqeQ0g
Subscribe to my YouTube channel:
https://www.youtube.com/channel/UCG5_CT_KjexxjbgNE4lVGkg?sub_confirmation=1
The presentation used in this video tutorial can be found at:
https://www.mobilefish.com/developer/lorawan/lorawan_quickguide_tutorial.html
#mobilefish #lora #lorawan
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «LoRa/LoRaWAN tutorial 26: Sending Sensor Data To The Things Network», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.