Summary of How to get sensor data from a remote Arduino via Wireless Lora Protocol
This example shows how to send DS18B20 temperature readings from a remote Arduino (client) to a server Arduino via LoRa (868 MHz). The server logs received data to a USB flash datalog.csv and flashes an LED when receiving packets. It uses the RadioHead library and Dragino LoRa and Yun shields; step-by-step setup, wiring, and upload instructions and example sketches are provided.
Parts used in the How to get sensor data from a remote Arduino via Wireless Lora Protocol:
- Arduino board x 2 (MEGA2560 used in example)
- Dragino LoRa Shield v1.3 x 2 (868MHz)
- Yun Shield v1.1.6 (or v2.2.4 or higher) x 1
- USB flash x 1
- DS18B20 temperature sensor x 1
- Breadboard x 1
- 868MHz antenna x 2
- USB cable x 2
- LED x 2
- 4.7k resistor x 1
- Jump wires
- Power supply
This is an example to show how to get sensor data from a remote Arduino via Wireless Lora Protocol.
The exampels requries below hardwares:
1) Client Side: Arduino + Lora Shield (868Mhz) + DS18B20 (Temperature Sensor).
2) Server Side: Arduino + Lora Shield (868Mhz) + Yun Shield + USB flash.
make sure the USB flash has this file datalog.csv in the data directory of root.
Requrie below software: Radiohead library from: http://www.airspayce.com/mikem/arduino/RadioHead/…
Client side will get the temperature and keep sending out to the server via Lora wireless. Server side will listin on the Lora wireless frequency, once it get the data from Client side, it will turn on the LED and log the sensor data to a USB flash.
Follow the next operations to complete this project.
Step 1: Preparations
In this project,you need the things below:
- Arduino board x 2 (We use the MEGA2560 here)
- Dragino Lora Shield v1.3 x 2 (We use 868MHZ here)
- Yun Shield v1.1.6 x 1
- USB flash x 1
- DS18B20 x 1 (Temperature sensor)
- Bread board x 1
- 868MHZ antenna x 2
- USB cable x 2
- LED x 2
- 4.7k resistance x 1
- Some jump wires
- Power supply
Note:
About the Yun Shiled,we must use the Yun Shield v1.1.6/Yun Shield v2.2.4 or higher version
Step 2: Connections
In this step,we need to assemble the client and the server separately.Follow above pictures,and make sure
you got everything ready.
NOTE:
- The data wire is plugged into port 3 on the Arduino (Client)
- The LED is on the GPIO 4 (Server)
- Put the ant on the boards
- Create a directory named “data” in the USB flash root and create a file data.csv in this directory.
Step 3: Codes
Power them by Power supply,and connect them to the computer via USB cable.
Client
Open the IDE(Over here,we use the version 1.6.8),choose the correct port and correct board for your client.Upload the client sktech to the arduino board,you can find the code here:
Server
Upload the server sktech to the arduino as above,youcan find the code here:
Step 4: Running Result
After the last step,you can see the LED on the server will flash once per second.Open the Serial Monitor of the client,you can see the temperature info obtained through the sensor and the communication between client and server.Open the Serial Monitor of the server,you can also get the server status.
Read more: How to get sensor data from a remote Arduino via Wireless Lora Protocol
- What hardware is required for the client side?
Arduino, Dragino LoRa Shield (868MHz), DS18B20 temperature sensor, antenna, USB cable, power supply, and jump wires as shown. - What hardware is required for the server side?
Arduino, Dragino LoRa Shield (868MHz), Yun Shield, USB flash with a data directory and data.csv, LED, antenna, USB cable, power supply, and jump wires. - Which library is required to run the example sketches?
The RadioHead library from http://www.airspayce.com/mikem/arduino/RadioHead/ is required. - Where should the data.csv file be placed on the USB flash?
Create a directory named data in the USB flash root and create a file data.csv inside that directory. - Which Arduino pin is the DS18B20 data wire connected to on the client?
The data wire is plugged into port 3 on the Arduino client. - Which pin is the LED connected to on the server?
The LED is on GPIO 4 on the server. - Which LoRa frequency is used in the example?
868MHz is used in the example. - Where can I find the client and server example code?
Client and server sketches are available on the Dragino GitHub repository under the Lora Shield Examples Lora_Temperature_RadioHead paths provided in the article. - What indicates successful reception on the server?
The server LED will flash once per second and server serial monitor shows status when data is received. - What IDE version is referenced for uploading sketches?
The article references Arduino IDE version 1.6.8 for uploading sketches.
