Arduino ProjectsLORA PROJECTS

Multiple Sensors Monitoring with Arduino Lora Nodes, SX1278 Lora

Multiple Sensors Monitoring, Description:


Multiple Sensors Monitoring with Arduino Lora Nodes- Before I am going to explain how to monitor multiple sensors using Arduino and Lora SX1278 Transceiver modules, first, a very quick recap on what I did in my last two tutorials. In my first tutorial which was based on the Arduino and SX1278 Lora transceiver modules, I explained the maximum basic things including the SX1278 Lora module Pinout, technical specifications, and its interfacing with the Arduino. I demonstrated two beginners level projects. In the Hello World project in which I was simply sending the Hello World message wirelessly to the receiver Lora module and then in the next example I modified the same program and converted it into a sensor monitoring system.

In my 2nd tutorial, I explained how to make a long range wireless two way communication system using the same 433Mhz SX1278 Lora Transceiver modules. In this project, I was simply sending the Potentiometer value from the Master Node to the Slave Node and then I was printing its value on the i2c supported Oled display module. If you remember I had told you that we can replace the potentiometer with other analog and digital sensors. So, today I will do it. Along with the Potentiometer I will also use a Flame Sensor for the fire detection and an LDR Sensor for day and night detection. So, if you are a beginner then I highly recommend you should first read my previous two tutorials on the Arduino and SX1278 Lora modules and then you can resume from here.

Multiple Sensors Monitoring

In today’s article, you will learn how to monitor multiple Sensors using Arduino and Long Range 433Mhz SX1278 Lora Transceiver modules. To the Master Lora Node an Oled display module is connected which of course we will be using for printing the sensors values and messages.

To the Lora Node1, A Potentiometer, Flame Sensor, and digital LDR Sensors are connected. Let’s go ahead and start with the Potentiometer.

Multiple Sensors Monitoring

Initially, I started with the Potentiometer, by rotating the knob of the Potentiometer I could see change in the value on the Oled display module. The value next to the Pot is the Potentiometer value. The system is quite responsive and the data is transmitted very fast, now, with this potentiometer, you can control a servo, a stepper motor, dc motor, and so on. The next value on the Oled display is the Flame Sensor value, right now you can see the value of the Flame Sensor is 56 as the sensor is detecting the fire. When there is no fire then you will see a value greater than 1000. This sensor should only be used inside or in dark place otherwise you will get wrong values as the ambient light has the infrared. I have been using this flame sensor and it’s good for beginners, you can see a change in the value when the Flame Sensor detects the fire.

Finally, I started testing the digital LDR Sensor. Current on the Oled display you can see Day is written, as there is no shadow on the LDR sensor, currently I have adjusted the Pot on the LDR sensor board and it can detect shadows. This LDR Sensor board is designed in a way that it gives only two outputs 1 or 0. So, depending on these two output states we can decide if it’s the daytime or the night time and as you can clearly see on the Oled display module, when there is no shadow on the LDR it displays day.

Multiple Sensors Monitoring

When there is a shadow then it displays night. You can adjust the sensitivity of the sensor with the help of the potentiometer, this way it will only generate the signal when there is absolutely no light at all. I checked this whole project repeatedly and it was working just great. If you want to further improve the user experience then you can add a watchdog timer in the programming, this way when the Arduino hangs, the watchdog timer will automatically reset the Arduino.

So, how it’s working? The Arduino reads all the sensors, creates a message consisting of the sensors values which are separated with commas. The final message is then send to the Master Lora Node where the message is split using Comma as the delimiter. The separated sensor values are then converted back into integer values. Some conditions are implemented and then finally, the sensors values are printed on the Oled display Module.

Now, you have got an idea of what you are going to learn after watching this video. Without any further delay, let’s get started!!!

Read my new article on Multiple Lora Nodes communication with the Master Lora Node.

Amazon Links:

LoRa SX1278 Module

Arduino Nano

Arduino Uno

SSD1306 128×64 Oled i2c display Module

Flame Sensor

LDR Sensor Board

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

Arduino Master Lora Node Circuit:

Multiple Sensors Monitoring

This is the circuit diagram of the Master Lora Node, the connection of the SX1278 Lora module remains exactly the same as explained in my previous two tutorials. This time I added the SSD1306 I2C supported Oled display Module. The VCC and GND pins of the SSD1306 Oled display module are connected with the Arduino’s 3.3V and GND pins. The SDA and SCL pins of the Oled display module are connected with the Arduino’s I2C pins A4 and A5.

The VCC of the LoRa module is connected with the 3.3V of the Arduino. The MISO Pin of the LoRa module is connected with the Arduino’s pin 12. The MOSI pin is connected with the Arduino’s pin 11. The SCLK pin of the LoRa module is connected with the Arduino’s pin 13. The NSS pin is connected with the Arduino’s pin 10 and the ground pin of the LoRa module is connected with the Arduino’s GND.

Arduino Lora Node 1 Circuit:

Multiple Sensors Monitoring

This is the circuit diagram of the Lora Node 1. The connection of the SX1278 Lora module remains exactly the same. The Potentiometer is connected with the Analog pin A2, the flame sensor is connected with the Analog pin A3, and the output of the LDR circuit is connected with the digital pin 3 of the Arduino.

Multiple Sensors Monitoring Programming:

Before, you start the programming first of all; make sure you download all the necessary.

Download: LoRa.h

Download: Adafruit_GFX.h

Download: Adafruit_SSD1306.h

Arduino Lora Node 1 Programming:

Arduino Lora Master Node Programming:

Multiple Sensor Monitoring Code explanation:

Both the codes are the modified versions of the codes I used in my previous tutorial. The sending and receiving codes remains exactly the same. There are just a few changes. On the Arduino Lora Node 1, I added two more sensors, the flame sensor and the LDR sensor. I also deleted the receiving code, because the Lora Node 1 will only transmit the data.

Inside the loop() function I am reading sensors and then I create a complete message.

As you can see the sensors values are separated using commas as the delimiter and then finally we send the complete message to the Master Lora Node.

On the Master Lora Node, I added code for the Oled display module, the master node address is the 0xFF and the Node1 address is 0xBB.

I also defined three variables for storing the values of the Potentiometer, Flame sensor, and LDR sensor.

Next, I defined a variable DayNight of the type String, I am using this variable for storing the day and night messages.

Inside the loop() function, we are continuously calling the onReceive() function, which checks if the Lora has received any data. If it has received the data then we check if the data is coming from the Node1, if yes, then read from the Lora module and the entire message is stored in the variable incoming.

Next, we split the message using comma as the delimiter and store the sensors values in variables q, r, and s. The values which are stored in these variables are of the type String, to implement any conditions we will need to convert these values into integer values. This is why I converted these values into integers and stored the final values in variables Sensor1, Sensor2, and Sensor3.

Sensor3 holds the value of 1 or 0 which is coming from the LDR Sensor board. So, I am using an if condition to check if a value of 1 or 0 is received. If a value of 1 is received then it’s night and if a value of 0 is received then it’s the day time and finally, I empty the incoming message and also print the values and messages on the Oled display module.

The getValue() function is a user-defined function which I have been using in so many projects. The purpose of this function is to split the message using any character as the delimiter, in my case I am using comma”,”, but you can also use other characters. So, that’s all about the programming.

For the practical demonstration and step by step explanation watch video tutorial on my YouTube channel. If you like the video then don’t forget to like, share, and subscribe.

Watch Video Tutorial:

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...


Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button