LoRa Based Devices - ResgreenGroup/Botway-Documentation GitHub Wiki

LoRa Based Devices

LoRa: LoRa (Long Range) Radios allow long distance (about 2KM) data links between devices. It is used in environments where WIFI may be less stable due to distances, interference, low coverage, high traffic... etc.
LoRa Gateway Device: A USB device that serves as the hub for all LoRa devices. This device connects to any computer that is on the same network as the MQTT broker and relays LoRa packets to the LoRa Gateway App.
LoRa Gateway App: A Java app that translates LoRa packets into MQTT messages allowing the LoRa devices to be recognized by BotWay.

LoRa Net Configuration

LoRaNet1

Multiple LoRa devices all talk to a single Gateway that connects to MQTT via the Gateway App.

Botway LoRa Gateway App

LoRaGatewayApp1

The LoRa Gateway App is the go-between connection from LoRa devices to BotWay. It's settings are controlled by the loraGateway.properties file described below.

LoRa Gateway App Properties File

This file defines operational parameters for the LoRa Gateway app.

<properties rev="1">
   <confirmExit>Yes</confirmExit>
   <monitorLimit>1000</monitorLimit>
   <mqtt>
      <host>127.0.0.1</host>
      <port>1883</port>
      <user/>
      <pass/>
   </mqtt>
   <gateway>
      <id>0001</id>
      <port>COM3</port>
      <baud>500000</baud>
   </gateway>
</properties>

<properties rev="1"\> Delineates a list of properties. The rev is used to track changes.

<confirmExit>Yes</confirmExit> Specifies whether to ask user if they are sure they want to exit app when closing the app.

<monitorLimit>1000</monitorLimit> Specifies the number of lines to record in the monitor panel.

<mqtt> Delineates the MQTT properties

<host>127.0.0.1</host> Specifies the IP Address of the computer running the MQTT Broker. If the Gateway app is on the same computer, 127.0.0.1 can be used.

<port>1883</port> Specifies the network port assigned to the MQTT Broker. Default is 1883

<user/> Specifies the username for connecting to the MQTT Broker. Not used by default.

<pass/> Specifies the password for connecting to the MQTT Broker. Not used by default.

<gateway> Delineates the Gateway Device properties

<id>0001</id> Specifies the Gateway's unique identifier. All LoRa devices are matched to a specific Gateway id.

<port>COM3</port> Specifies the serial communications port that the Gateway Device is plugged into. See Device Manager section for more information.

<baud>500000</baud> Specifies the "speed" of the serial port. See Device Manager section for more information.

Connecting the Gateway Device

The Gateway Device simply needs to be plugged into USB port. However, the computer may need a software driver to support the USB-to-Serial device. The appropriate driver can be downloaded directly here: USB-Serial Driver
Once the driver is installed, the plugged-in Gateway device will show up in the Windows Device Manager under Ports (COM & LPT). The driver should be listed as "Silicon Labs CP210x USB to UART Bridge (COM?)" where ? will depend on the computer.

Determining the Port: The "port" is listed in parenthesis at the end of the driver entry. In the below image, it is COM3. Ensure that the "port" setting in the loraGateway.properties file matches this name.

DeviceManager

Setting the Baud: To set the "baud" rate of the port, double-click the "Silicon Labs CP210x USB to UART Bridge (COM3)" entry to display the Properties dialog box. Move to the Port Settings tab and select the "Bits per second" that match the "baud" entry in the loraGateway.properties file. It is recommended that 500000 be used for both.

PortSettings

Running the LoRa Gateway App

Once the loraGateway.properties file settings are saved and the port is configured, run the LoRa Gateway App by double-clicking the LoRaGatway.jar file in the Botway folder. Data will be listed in the monitor to help with trouble shooting.

Botway LoRa Switch Box

The Botway LoRa Switch Box is a wirelessly controlled outlet containing two 120V outlets. A 120V device such as a fan, light, alarm... etc can be plugged into the switch box's outlet and turned on or off via BotWay Triggers.

LoRaSwitchBox4 small

LoRa Switch Box Operation: The LoRa Switch Box must be plugged into 120V to operate. Once plugged in, it will alternately flash the two indicator lights while it attempts to connect to the LoRa Gateway. If it is unable to connect within 10 seconds, it will wait between 3 to 15 seconds to attempt again. During the wait time, both lights will flash in unison. Once a connection is established, both lights will turn off. During operation, the indicator lights will illuminate to indicate that the outlets are turned on.

⚠️ **GitHub.com Fallback** ⚠️