Sending Sensor Data Wirelessly with LoRa SX1278 & Arduino
Sending & Receiving Sensor Data Wirelessly with LoRa Ra-02 SX1278 Module & Arduino. Use DHT11 Sensor & send Temperature Humidity value to node
- Suitable forB.Tech/Diploma LoRa/IoT students
- Build time1-2 weeks
- LevelBeginner
- Available atAjvika Labs, Kakinada
About this project
In this tutorial, we will learn about
Sending & Receiving Sensor Data
Wirelessly with
LoRa Ra-02 SX1278 Module & Arduino
. We will use
DHT11 Humidity & Temperature Sensor
& send the
Temperature
&
Humidity value
wirelessly from one Arduino to another using
SX1278 Ra-02 LoRa Module
Overview
In the last couple of years, there is a number of communication technologies available for interaction between
IoT devices
. The most popular ones are the
Wi-Fi
Technology and
Bluetooth
Module. But they have few limitations like limited range, limited access points & high power consumption. So LoRa technology is introduced by
Semtech
to fix all these issue. Using a single battery the device operates over a year.
In this tutorial, we will use
DHT11 Humidity & Temperature Sensor
and send the temperature and humidity value wirelessly from one Arduino to another Arduino Board. One
LoRa SX1278
will be used as a
transmitter
, transferring the sensor data to the other,
receiver
LoRa SX1278.
Before getting started, you can visit the following posts as well:
Interfacing SX1278 (Ra-02) LORA Module with Arduino
:
Check Here
ESP8266 & LoRa SX1278 Transmitter Receiver with DHT11
:
Check Here
ESP32 LoRa Sensor Data Monitoring on Web Server
:
Check Here
ESP32 & LoRa SX1278/76 Transmitter Receiver with OLED
:
Check Here
Bill of Materials
Following are the components required for making this project. All the components can easily be purchased from Amazon. The components purchase link is given below.
S.N.
Components
Quantity
Purchase Links
Arduino Nano Board
Amazon
AliExpress
LoRa Module SX1278
Amazon
AliExpress
DHT11 Sensor
Amazon
AliExpress
Connecting Wires
Amazon
AliExpress
Breadboard
Amazon
AliExpress
Semtech SX1278 LoRa Module
SX1278 Module
The
SX1276/77/78/79
transceivers feature the LoRa® long range modem that provides ultra-long range spread spectrum communication and high interference immunity whilst minimizing current consumption.
SX1278
can achieve a sensitivity of over
-148dBm
using a low-cost crystal. The high sensitivity combined with the integrated
+20dBm power amplifier
yields industry leading link budget making it optimal for any application requiring range or robustness. Lora SX1278 also provides significant advantages in both blocking and selectivity over conventional
modulation techniques
, solving the traditional design compromise between range, interference immunity and energy consumption. Learn more about it at:
Semtech SX1278 Datasheet
Semtech SX1278 Pinout
There are different versions and types of
SX1278 breakout board
available in market. But basically all of them has same pinout as
LoRa SX1278
is an
SPI module
. I am using this board as shown in photos below.
This module version of SX1278 has
12 pins
for interfacing with
microcontroller
& additional two pins for antenna.
DHT11 Humidity & Temperature Sensor
The
DHT11
is a basic, ultra low-cost digital
temperature and humidity sensor
. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a
digital signal
on the
data pin
(no analog input pins needed).
Its fairly simple to use, but requires careful timing to grab data. The only real downside of this sensor is you can only get new data from it once every 2 seconds, so when using the
library, sensor
readings can be up to 2 seconds old.
Sending Sensor Data Wirelessly with LoRa SX1278 & Arduino
Now let us interface SX1278 LoRa module with Arduino and DHT11 Sensor. We have to make two different setup, one as a transmitter and other as a receiver.
Arduino Lora SX1278 DHT11 Transmitter
Let us first setup the
transmitter
part first. The transmitter part contains Arduino Nano Board, DHT11 Humidity & Temperature Sensor and LoRa SX1278 Module. The circuit diagram is given below. Assemble the circuit as shown in the figure below.
The LoRa SX1278 is not 5V friendly so do not supply 5V to it else the board will get damaged. Use 3.3V of Arduino to connect it to VCC pin. Connect all the GND pins to GND. Connect the RST pin to D9 and DIO0 to D2 of Arduino. Connect the SPI Pins NSS, MOSI, MISO, SCK to Arduino D10, D11, D12, D13 of Arduino respectively as shown in the circuit diagram above.
Connect the DHT11 Humidity & Temperature Sensor VCC, Out & GND pins to VCC, A0 & GND of Arduino respectively.
Arduino Lora SX1278 Receiver
Now let us setup the Receiver part now. The receiver part contains Arduino Nano Board and LoRa SX1278 Module. The circuit diagram is given below. Assemble the circuit as shown in the figure below.
The LoRa SX1278 is not 5V friendly so do not supply 5V to it else the board will get damaged. Use 3.3V of Arduino to connect it to VCC pin. Connect all the GND pins to GND. Connect the RST pin to D9 and DIO0 to D2 of Arduino. Connect the SPI Pins NSS, MOSI, MISO, SCK to Arduino D10, D11, D12, D13 of Arduino respectively as shown in the circuit diagram above.
Source Code/Program
For communication between two
LoRa Module
, you need to have LoRa library. To get the
LoRa Library
go to library manager and search for LoRa and install it.
Once the library is installed you can upload the transmitter and receiver code and learn about Sending Sensor Data Wirelessly with LoRa SX1278 & Arduino.
Transmitter Code
#include <SPI.h>
#include <LoRa.h>
#include "DHT.h"
#define DHTPIN A0
#define DHTTYPE DHT11
DHT
dht
(
DHTPIN
DHTTYPE
)
;
int
hum
;
float
temp
;
//Stores temperature value
void
setup
(
)
{
Serial
begin
(
9600
)
;
dht
begin
(
)
;
while
(
!
Serial
)
;
Serial
println
(
"LoRa Sender"
)
;
if
(
!
LoRa
begin
(
433E6
)
)
{
Serial
println
(
"Starting LoRa failed!"
)
;
while
(
)
;
}
}
void
loop
(
)
{
temp
=
dht
readTemperature
(
)
;
hum
=
dht
readHumidity
(
)
;
Serial
println
(
"Sending packet: "
)
;
// send packet
LoRa
beginPacket
(
)
;
LoRa
(
"Humidity: "
)
;
LoRa
(
hum
)
;
LoRa
(
"%"
)
;
LoRa
(
" Temperature:"
)
;
LoRa
(
temp
)
;
LoRa
(
"C"
)
;
Serial
(
"Humidity: "
)
;
Serial
(
hum
)
;
Serial
(
"%"
)
;
Serial
(
" Temperature:"
)
;
Serial
(
temp
)
;
Serial
println
(
"C"
)
;
Serial
println
(
""
)
;
LoRa
endPacket
(
)
;
delay
(
1000
)
;
}
Receiver Code
#include <SPI.h>
#include <LoRa.h>
void
setup
(
)
{
Serial
begin
(
9600
)
;
while
(
!
Serial
)
;
Serial
println
(
"LoRa Receiver"
)
;
if
(
!
LoRa
begin
(
433E6
)
)
{
Serial
println
(
"Starting LoRa failed!"
)
;
while
(
)
;
}
}
void
loop
(
)
{
// try to parse packet
int
packetSize
=
LoRa
parsePacket
(
)
;
if
(
packetSize
)
{
// received a paket
Serial
println
(
""
)
;
Serial
println
(
"..................................."
)
;
Serial
println
(
"Received packet: "
)
;
// read packet
while
(
LoRa
available
(
)
)
{
char
incoming
=
(
char
)
LoRa
read
(
)
;
if
(
incoming
==
'c'
)
{
Serial
(
"Error"
)
;
}
else
{
Serial
(
incoming
)
;
}
}
}
}
Once the code is uploaded you can open the serial monitor and see the received data on the receiver end. You can place the transmitter to the very far end and observe the receiver data on Serial Monitor.
Video Tutorial & Guide: DHT11 Sensor with LoRa & Arduino
LoRa SX1278/76 Arduino Interfacing Tutorial | Sending Sensor Data Wirelessly with LoRa
Watch this video on YouTube
You can check this link as well:
LoRa SX1278 & ESP8266 Transmitter Receiver with DHT11 Sensor
Sending & Receiving Sensor Data
Wirelessly with
LoRa Ra-02 SX1278 Module & Arduino
. We will use
DHT11 Humidity & Temperature Sensor
& send the
Temperature
&
Humidity value
wirelessly from one Arduino to another using
SX1278 Ra-02 LoRa Module
Overview
In the last couple of years, there is a number of communication technologies available for interaction between
IoT devices
. The most popular ones are the
Wi-Fi
Technology and
Bluetooth
Module. But they have few limitations like limited range, limited access points & high power consumption. So LoRa technology is introduced by
Semtech
to fix all these issue. Using a single battery the device operates over a year.
In this tutorial, we will use
DHT11 Humidity & Temperature Sensor
and send the temperature and humidity value wirelessly from one Arduino to another Arduino Board. One
LoRa SX1278
will be used as a
transmitter
, transferring the sensor data to the other,
receiver
LoRa SX1278.
Before getting started, you can visit the following posts as well:
Interfacing SX1278 (Ra-02) LORA Module with Arduino
:
Check Here
ESP8266 & LoRa SX1278 Transmitter Receiver with DHT11
:
Check Here
ESP32 LoRa Sensor Data Monitoring on Web Server
:
Check Here
ESP32 & LoRa SX1278/76 Transmitter Receiver with OLED
:
Check Here
Bill of Materials
Following are the components required for making this project. All the components can easily be purchased from Amazon. The components purchase link is given below.
S.N.
Components
Quantity
Purchase Links
Arduino Nano Board
Amazon
AliExpress
LoRa Module SX1278
Amazon
AliExpress
DHT11 Sensor
Amazon
AliExpress
Connecting Wires
Amazon
AliExpress
Breadboard
Amazon
AliExpress
Semtech SX1278 LoRa Module
SX1278 Module
The
SX1276/77/78/79
transceivers feature the LoRa® long range modem that provides ultra-long range spread spectrum communication and high interference immunity whilst minimizing current consumption.
SX1278
can achieve a sensitivity of over
-148dBm
using a low-cost crystal. The high sensitivity combined with the integrated
+20dBm power amplifier
yields industry leading link budget making it optimal for any application requiring range or robustness. Lora SX1278 also provides significant advantages in both blocking and selectivity over conventional
modulation techniques
, solving the traditional design compromise between range, interference immunity and energy consumption. Learn more about it at:
Semtech SX1278 Datasheet
Semtech SX1278 Pinout
There are different versions and types of
SX1278 breakout board
available in market. But basically all of them has same pinout as
LoRa SX1278
is an
SPI module
. I am using this board as shown in photos below.
This module version of SX1278 has
12 pins
for interfacing with
microcontroller
& additional two pins for antenna.
DHT11 Humidity & Temperature Sensor
The
DHT11
is a basic, ultra low-cost digital
temperature and humidity sensor
. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a
digital signal
on the
data pin
(no analog input pins needed).
Its fairly simple to use, but requires careful timing to grab data. The only real downside of this sensor is you can only get new data from it once every 2 seconds, so when using the
library, sensor
readings can be up to 2 seconds old.
Sending Sensor Data Wirelessly with LoRa SX1278 & Arduino
Now let us interface SX1278 LoRa module with Arduino and DHT11 Sensor. We have to make two different setup, one as a transmitter and other as a receiver.
Arduino Lora SX1278 DHT11 Transmitter
Let us first setup the
transmitter
part first. The transmitter part contains Arduino Nano Board, DHT11 Humidity & Temperature Sensor and LoRa SX1278 Module. The circuit diagram is given below. Assemble the circuit as shown in the figure below.
The LoRa SX1278 is not 5V friendly so do not supply 5V to it else the board will get damaged. Use 3.3V of Arduino to connect it to VCC pin. Connect all the GND pins to GND. Connect the RST pin to D9 and DIO0 to D2 of Arduino. Connect the SPI Pins NSS, MOSI, MISO, SCK to Arduino D10, D11, D12, D13 of Arduino respectively as shown in the circuit diagram above.
Connect the DHT11 Humidity & Temperature Sensor VCC, Out & GND pins to VCC, A0 & GND of Arduino respectively.
Arduino Lora SX1278 Receiver
Now let us setup the Receiver part now. The receiver part contains Arduino Nano Board and LoRa SX1278 Module. The circuit diagram is given below. Assemble the circuit as shown in the figure below.
The LoRa SX1278 is not 5V friendly so do not supply 5V to it else the board will get damaged. Use 3.3V of Arduino to connect it to VCC pin. Connect all the GND pins to GND. Connect the RST pin to D9 and DIO0 to D2 of Arduino. Connect the SPI Pins NSS, MOSI, MISO, SCK to Arduino D10, D11, D12, D13 of Arduino respectively as shown in the circuit diagram above.
Source Code/Program
For communication between two
LoRa Module
, you need to have LoRa library. To get the
LoRa Library
go to library manager and search for LoRa and install it.
Once the library is installed you can upload the transmitter and receiver code and learn about Sending Sensor Data Wirelessly with LoRa SX1278 & Arduino.
Transmitter Code
#include <SPI.h>
#include <LoRa.h>
#include "DHT.h"
#define DHTPIN A0
#define DHTTYPE DHT11
DHT
dht
(
DHTPIN
DHTTYPE
)
;
int
hum
;
float
temp
;
//Stores temperature value
void
setup
(
)
{
Serial
begin
(
9600
)
;
dht
begin
(
)
;
while
(
!
Serial
)
;
Serial
println
(
"LoRa Sender"
)
;
if
(
!
LoRa
begin
(
433E6
)
)
{
Serial
println
(
"Starting LoRa failed!"
)
;
while
(
)
;
}
}
void
loop
(
)
{
temp
=
dht
readTemperature
(
)
;
hum
=
dht
readHumidity
(
)
;
Serial
println
(
"Sending packet: "
)
;
// send packet
LoRa
beginPacket
(
)
;
LoRa
(
"Humidity: "
)
;
LoRa
(
hum
)
;
LoRa
(
"%"
)
;
LoRa
(
" Temperature:"
)
;
LoRa
(
temp
)
;
LoRa
(
"C"
)
;
Serial
(
"Humidity: "
)
;
Serial
(
hum
)
;
Serial
(
"%"
)
;
Serial
(
" Temperature:"
)
;
Serial
(
temp
)
;
Serial
println
(
"C"
)
;
Serial
println
(
""
)
;
LoRa
endPacket
(
)
;
delay
(
1000
)
;
}
Receiver Code
#include <SPI.h>
#include <LoRa.h>
void
setup
(
)
{
Serial
begin
(
9600
)
;
while
(
!
Serial
)
;
Serial
println
(
"LoRa Receiver"
)
;
if
(
!
LoRa
begin
(
433E6
)
)
{
Serial
println
(
"Starting LoRa failed!"
)
;
while
(
)
;
}
}
void
loop
(
)
{
// try to parse packet
int
packetSize
=
LoRa
parsePacket
(
)
;
if
(
packetSize
)
{
// received a paket
Serial
println
(
""
)
;
Serial
println
(
"..................................."
)
;
Serial
println
(
"Received packet: "
)
;
// read packet
while
(
LoRa
available
(
)
)
{
char
incoming
=
(
char
)
LoRa
read
(
)
;
if
(
incoming
==
'c'
)
{
Serial
(
"Error"
)
;
}
else
{
Serial
(
incoming
)
;
}
}
}
}
Once the code is uploaded you can open the serial monitor and see the received data on the receiver end. You can place the transmitter to the very far end and observe the receiver data on Serial Monitor.
Video Tutorial & Guide: DHT11 Sensor with LoRa & Arduino
LoRa SX1278/76 Arduino Interfacing Tutorial | Sending Sensor Data Wirelessly with LoRa
Watch this video on YouTube
You can check this link as well:
LoRa SX1278 & ESP8266 Transmitter Receiver with DHT11 Sensor
Technologies used
Hardware components
- ESP32
- ESP8266
- Arduino
- DHT11
- OLED
- LoRa SX1278
- SX1276
Software & tools
- Arduino IDE
What you get
- Working project / hardware kit, tested before delivery
- Complete source code with explanation
- Project demo and guidance for your viva
- Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed.
Payment is in two parts:
• 50% advance to start the project
• Remaining 50% before delivery
Note:
• Documentation and PPT are not included by default
• If you need documentation/PPT, it can be arranged for extra time and cost
We'll confirm the exact timeline and cost with you after reviewing your requirements.