Lora Gateway Based On Micropython Esp32
About the project
Using two LoRa nodes to send the temperature and humidity data to the gateway, and then upload it to the Internet through the gateway.
Estimated time: 3 hours
Lora has been very popular in recent years. The wireless communication module using this technology is usually cheap (using free spectrum), small in size, energy-efficient and has a long communication distance, and is mainly used for mutual communication between IoT terminals or data exchange with a host. There are many LoRa modules on the market, such as RFM96W, which is equipped with SX1278 (compatible) chip, which is very small. I use it with MakePython ESP32 as a gateway.
Next, I will use two LoRa nodes to send the temperature and humidity data to the gateway, and then upload it to the Internet through the gateway. Here you will learn how to upload remote data of multiple LoRa nodes to the cloud through the gateway.
Step 1: Supplies
- 1*MakePython Lora
MakePython ESP32 is an ESP32 board with an integrated SSD1306 OLED display.
Maduino Lora Radio is an IoT (Internet of things) Solution based on the Atmel’s Atmega328P MCU and Lora module. It can be a real project for IoT projects(especially long-range, low power application )
Step 2: LoRa Node
Schematic of Maduino Lora Radio
This is the schematic of Maduino Lora Radio.
Arduino Lora Radio module as LoRa node, we use it to send temperature and humidity data to the gateway.
(This WiKi introduces how to use Maduno Lora Radio and send and receive data)
Step 3: Node and Sensor Connection
Node and sensor connection
The VCC and GND of DHT11 are connected to 3V3 and GND of Maduino, and the DATA pin is connected to D4 of Maduino.
Node 0 is in the park, node 1 is in the office building near the company, they are about 2 kilometers apart, and then I get their temperature and humidity data at home.
Step 4: Send Data to the Gateway
Download TransmitterDHT11.ino, open it on Arduino IDE.
When adding a node, modify the node number accordingly. For example, now use 2 nodes, the first node to modify the nodenum = 0 to run the program, the second node to modify the nodenum = 1 to run the program, and so on, you can add more node.
int16_t packetnum = 0; // packet counter, we increment per xmissionint16_t nodenum = 0; //Modify the node number
Collect data and print it
String message ="#"+(String)nodenum+" Humidity:"+(String)humidity+"% Temperature:"+(String)temperature+"C"+" num:"+(String)packetnum;<br>Serial.println(message);packetnum++;
Send a message to rf95_server
uint8_t radioPacket[message.length()+1];message.toCharArray(radioPacket, message.length()+1);radioPacket[message.length()+1]= '