Notice: The Chinese New Year is coming soon! If you want your PCB order get shipped before the CNY holiday, please place your order before Jan 23rd!

Sending and Receiving Weather Data with a LoRa Module

Posted by Noah, 02/11/2017

It's an accomplishment to read weather data on the Arduino IDE. It's an even bigger one if you can transfer that data to a whole other Arduino/display device. Let's take reading the data one step further and transmit it across LoRa radio frequencies.

 

In this tutorial, we’ll use an Arduino Uno board with two LoRa Ra-01 modules to read a DHT11 module’s humidity and temperature data. One LoRa will be used as a transmitter, transferring the sensor data to the other, receiver, LoRa.

 

For this tutorial you'll need:

 

Hardware:

 

 

Software:

 

 

Note: to import the Lora Library, move the folder into the Arduino library folder in your Program Files, C Drive.

 

 

Here are the connections you'll need to make between all the devices.

 

For the DHT11 sensor module, the far-left pin is the VCC power pin, the second from the left is the data pin, the third is ignored, and the far-right pin is the GND pin. We used an adapter board in our tutorials which eliminates the pin we want to ignore.

 

Transmitter LoRa:

 

LoRa ModuleArduino Uno
GNDGND
3.3V3.3V
DIO0D2
NSSD10
SCKD13
MOSID11
MISOD12
DHT11 SensorArduino
GNDGND
3.3V3.3V
DataA0

 

Receiver LoRa (The same as Transmitter, only difference is no DHT11 parts)

 

LoRa ModuleArduino Uno
GNDGND
3.3V3.3V
DIO0D2
NSSD10
SCKD13
MOSID11
MISOD12

 

 

 

 

Once we're connected, let's flash the transmitter (sender) code to the transmitter Arduino and the receiver code to the receiver Arduino. Don't forget to restart your IDE after placing the library into the Arduino Library. You'll also need to remember to switch the ports each time you plug in the other Arduino so you don't accidentally override the other's code.

 

 

 

After the codes have been uploaded and run in each respective LoRa, switch the PORT to the receiver Arduino, and check the serial monitor. You should be getting humidity and temperature data strings.

 

 

Next challenge is to display the data on an external module!

 

12 Comment(s)

name:
26/05/2018, 11:15:36 AM
Reply

lora ra-02 send temperature direct

viky:
03/06/2018, 06:02:06 AM
Reply

Hii am using the same connection as per the instruction given above but while running the code for receiver i am getting as serial output "init failed". i need your helpArduino uno 368p lora RA01 Arduino 1.6.7

alex:
04/06/2018, 02:44:09 AM

hi Viky,It means the receiver initiation is wrong, then you will need to check the possible mistake like the connection, the soldering of Lora module, the lora module is still good or not.Alex

Albertas Galin:
07/06/2018, 02:48:36 PM
Reply

hello,1. Why we can connect arduino 5v and RA-01 3.3V directly?(without level shifter) 2. Specs says 20 dbm max. RH_RF95.setTxPower(23,true) according doc sets 23 dBm. How correctly set max Power? And what it will be? 3. In SX1278 data sheet (page 84 in my version) is stated "Duty Cycle of transmission at +20 dBm output Max 1%". Is it safe to operate at max power constantly? (for example transmitting SX1278.setModemConfig(RH_RF95::Bw125Cr48Sf4096) 60 Bytes takes about 2 seconds.Is it safe transmitting messages at max power every 3 seconds?)Thank you in advance for the answers.

alex:
08/06/2018, 02:51:54 AM

This is Alex from Smart Prototyping.com. Thanks for your message. 1. It is better to use leve shifter, then connect it to Lora module, that would be safer, connect 5V to LoRa is only for short time testing. 2. The code can set a max power, and it could change the power for the module, but it might not be the same when you use the equipment to measure the radiation power. 20dbm is the real power the manufacturer measured in the lab. 3. Yes, it is safe.

Albertas Galin:
08/06/2018, 05:53:19 AM
Reply

Thank you very much for prompt replay!

Ferhat Kortak:
21/06/2018, 10:53:29 AM
Reply

Hello, I have stucked at rf95.available(), It returns false every time. I'm sure about pin connections. Do you have any opinion?

Brendan Murray:
10/07/2018, 11:57:18 AM
Reply

Try to change LED=9 to LED=8 as I think LED=9 is a reset

gowtham:
17/09/2018, 06:28:03 AM
Reply

I need to send the data continuosly using loop. since i am a beginner i don't know how to use the syntax, so please kndly help me with the updated code using loop. Thank you.

suba:
21/09/2018, 12:24:53 PM
Reply

I cant get a full code will you please send me the full code

Cimmang:
23/10/2018, 07:25:23 AM
Reply

Aku mau bertanya bagaimana cara mengirim data yang berbeda dalam waktu yang bersamaan yang dimana saya ingin mengirim data sensor udara dan debu bersamaan menggunakan lora ro-2 Terimakasih

Ayanle:
12/01/2019, 11:03:48 AM
Reply

I am using Arduino pro mini for the sender and Arduino Uno for the receiver, I am getting nothing other than init failed! in the receiver Arduino, since the code I am using is same as yours and the connections are right, I am wondering if there is any other bug/mistake in my system.

Mikolaj:
13/01/2019, 09:28:32 AM
Reply

I'm trying to add a library and nothing ;/ arduino ide can't see this library. When i go to arduino-> sketch-> add library -> add library zip i get the info "this file don't have corect library. (this is translate from polish so your info can be little bit different) When i go to the document -> arduino -> librares and extract the zip to this folder, then i open arduino ->file->exampel and see "inconsistent", when i copy the code and paste into the arduino, i clik the "verify" or "compile" i get the error "RH_RF95.h: No such file or directory"

Aswana:
14/01/2019, 02:59:42 AM

Hi Mikolaj, I am Aswana from Smart Prototyping.com. For your issues, have you tried to update the recently installed library? Including libraries manually will need you to also manually update the library for your Arduino IDE. To do that, go to Sketch > Include Library > Manage Libraries.Wait till it finishes installing and updating then try again to run and upload the code to your device.Make sure there is no other folder after RadioHead-master when you manually extract the zip file. The directory should be RadioHead-master > all the files like examples , and etc should be in this tree after clicking the master folder.

Thien Khai:
16/01/2019, 10:09:07 AM
Reply

How do you want to display on LCD?

Leave a Comment