Wireless Bridge WiFi_LoRa Example User Manual
This is an example of communication between a LoRaWAN server and a WiFi device. You can write code that fits your needs based on this example.
Preparation
Hardware
LoRaWAN Gateway in normal operation on the LoRaWAN server.
Micro USB cable.
Software
Heltec ESP32 development framework and library, If you don’t know how to install, you can refer to this link:Heltec ESP32 Series Quickstart
Tip
It also supports the official Arduino framework of Espressif.
Uploading code
Connect Wireless Bridge to your computer with a USB cable and open the Arduino IDE.
Click
Tools
, selectWireless Bridge
. ToRegion
option based on your needs, both hardware support and the ability to communicate with the gateway.
Follow the path shown to open the example “LoRaWANWiFi”
Modify the relevant parameters, mainly those related to WiFi and LoRa. Try not to use the default EUI; it’s probably already taken.
Please note that the ‘Channel’ is set to be the same as the gateway.
Tip
The default frequency band is 0~ 7. If you don’t know how to set the frequency band, you can check this link:LoRaWAN example Sub-Band usage
The payload is located here:
Uploading code.
Registering devices
Registering Gateway
Please make sure that your gateway is running correctly on the LoRaWAN server. Here is the documentation for the common Heltec gateways:
Registering Wireless Bidge
According to the information such as EUI in the code, the node is registered at the server. If you don’t know how to register, follow this link:
https://docs.heltec.org/en/node/esp32/esp32_general_docs/lorawan/connect_to_gateway.html
Usage
After uploading the program to the development board, open the serial port to view the IP address of the web page. Among them, “View page IP address” is the viewing webpage for forwarding LoRa information to WiFi, and “Write page IP address” is the sending webpage for forwarding WiFi information to LoRa. The device that opens the webpage must be in the same local area network as the Wireless_Bridge.
Uplink
Send information through LoRa, and the received data will be displayed on the web page through WiFi. The default web page refresh time is 10S, and the web page refresh time can be modified in the “setTimeout” function according to specific needs.
The information issued by the webpage will be forwarded to LoRa and can be viewed in the node data. The information forwarded to LoRa needs to be decoded accordingly.
The corresponding decoding of this example is as follows:
function Decode(fPort, bytes) {
var charValue1= String.fromCharCode(bytes[0]);
var charValue2= String.fromCharCode(bytes[1]);
var charValue3= String.fromCharCode(bytes[2]);
var charValue4= String.fromCharCode(bytes[3]);
var charValue= charValue1 + charValue2 + charValue3 + charValue4;
var result={
"char":{
"charValue":charValue,
}
}
return result;
}