Interfacing Lora With NodeMCU
Ra-02 Work With ESP8266 Board
In this article, I will teach you how to use the LoRa Module with a Nodemcu board. In this project, we will send a two-way message between two LoRa.
First of all, Collect the following devices -
- 2 Lora Ra-02 (Sx1278) Module
- 2 MT7681 Antenna
- 2 NodeMCU (ESP8266)
- Some Jumper Wires
- 2 Dc 5 Volt Supply For NodeMCU Either USB Or Input Pin
Now make Connections According to the table given below -
Lora Ra-02 | NodeMCU |
---|---|
3.3V | 3.3V |
GND (All Pins Compulsory) | GND |
NSS | D8 |
MOSI | D7 |
MISO | D6 |
SCK | D5 |
RST | D0 |
DIO | D2 |
Keep In Mind -
That you have to connect all GND pins of LoRa to GND of NodeMCU. If you leave even one of the pins open, your device will not work properly.
If you have looked at the datasheet of the Ra-02 model, you will find that the Ra-02 model only works between 410 - 525 MHz frequencies.
You will need to choose a frequency between these for this project. I am choosing 433 Mhz.
You have to install the LoRa library, you can download it from here and then add it to the Arduino software.
Now you have to upload the code given below in both the NodeMCU
Code -
Or
You can Download Code Here
Note -
The same code is to be uploaded on both devices.
If there is an error uploading the code, you remove nodemcu from LoRa and then upload the code and re-add LoRa after uploading.
You have selected 115200 baud rate for both serial monitors
Finally, after everything is successful, you need to open the serial monitor, if it says "Device Activated" it means all your system is working properly, now you can send and receive messages. If you see a "LoRa error" written on the serial monitor, you should thoroughly check your connections as well as the frequency recorded.
To send a message you have to go to any serial monitor, type the message in its input box, and press enter, your message will be sent to another LoRa module. and it will appear on the second serial monitor
hello sir
ReplyDeletegreeting of the day
thanks for sharing this post.
sir i was doing as you instructed but not able to get success in lora communication.
sir i am using node mcu and sx276 dragino lora bee module. can you please guide me the actual working code for my lora transmitter and receiver.
please mail me at singhalsaab4@gmail.com
Nice sir ji๐
ReplyDeleteHello sir, can this project using both different board, example Arduino uno and Node mcu?
ReplyDeleteOne question, if we program 4 devices, will it reach all 4? How can we send to a specific device? mac direction?
ReplyDelete