Deployment and Development Sharing of Lo RaWAN Lighting Control Project in Exhibition Hall

Deployment and Development Sharing of Lo RaWAN Lighting Control Project in Exhibition Hall


In this article, we explore the deployment and development of a LoRaWAN-based lighting control project in?exhibition hall?of Ai-Thinker. The project utilizes LoRaWAN transmission, where a third-party client interacts with the LoRaWAN server using the MQTT protocol. Control protocols are sent down to the nodes to communicate with the control module's IO routines. This example serves as a demonstration, featuring a simple internal handshake interaction logic.


Preparation

Server Setup:

· The TTN server, a free testing option, is chosen for server setup.

· Steps include creating an account, adding a gateway, and adding a node module.

Access: https://www.thethingsnetwork.org/


Create an account


Add a?gateway

Remember the gateway eui here, please fill in the real eui parameters of the gateway


Add a node module

The node joining method is ABP, and the key is automatically generated. The key will be used in the later code.



At this point, our server setup work has been completed. We have added the necessary parameters eui of the gateway, and successfully added a device that uses ABP to access the network. Next, we configure the gateway parameters to allow the gateway to connect to our server.

?

Gateway Configuration:

Using the RG-02 gateway, configure its connection to the routing as per the provided instructions.

(1) Connect to the gateway hotspot. The hotspot starts with AiThinker and the password is 12345678.

(2) Access the gateway backend and directly enter 10.130.1.1:8000 in the browser

(3) Enter the AP page to modify the hotspot connected to the gateway and connect it to the public network router. Then you no longer need to connect to the hotspot for access. The access address can be changed to the address assigned to the gateway by the router (within the LAN)

(4) Remember to click to check and save

?

Configure gateway connection server

(1) Log in to the gateway backend and enter the lorawan configuration interface

(2) The lorawan interface can view the real EUI of the gateway. This parameter is the real parameter required for our server to join the gateway.

(3) Change the server interface of the gateway. The interface is obtained from the TTN server.

(4) Check the frequency band parameters of lora and be sure to set the 470 band without ttn

As shown below

Source Code Analysis:

Now that the server and gateway are set up, let's delve into the source code. Utilizing the official SDK, modify the code to include node key information and change the network entry method.


Modification of network entry and distribution parameters

The ABP network access parameters we use here need to be consistent with the parameters set by the server node device.


Upstream data

Downstream data


MQTT Publication of Downstream data:

Examine the MQTT downstream data?rules: TTN server MQTT rules

?

Topic Explanation:?Subscribed by the client for data interaction. The published topic is as follows:

Payload Explanation:?We deliver the following data to the above-mentioned Topic, and control the light on and off by changing the load payload information. The data is as follows:


MQTT Client:

Use the MQTT client app, IOT MQTT Panel, IOT MQTT Panel download

· Software Name:?iot MQTT Panel

· Software Size:?19.04MB

· Software Description:?An MQTT-based smart home IoT remote control application.

This application allows you to manage and visualize IoT projects based on the MQTT protocol.

With this application, you can create DIY smart home projects in just a minute. The configuration is very simple. The app information page provides detailed FAQs and user guides.

  1. Supports MQTT (TCP) and Websocket protocols (useful for special firewall restrictions on the network).
  2. SSL for secure communication.
  3. JSON support for subscribing and publishing messages.
  4. Panels automatically subscribe and/or publish topics, thus updating in real-time.
  5. Designed to work effectively with public brokers (using device prefixes).
  6. Timestamps for messages sent and received from the broker.
  7. Material design.
  8. Flexible panel width, allowing merging of any panels.
  9. Over 250 icons available for customizing specific panels.
  10. Dark theme suitable for use in low-light conditions.
  11. Clone connections, devices, or panels for easy configuration.
  12. Import/export application configurations for easy sharing across multiple devices.
  13. Runs in the background and automatically reconnects.


Conclusion:

This example provides an MQTT-controlled LoRaWAN interaction routine, covering:

· Configuration of the network server (node and gateway entry).

· Gateway backend information configuration.

· Basic modification and application of node source code routines.

· Instructions for using MQTT control protocols (recommended for mobile MQTT clients).

Feel free to explore and customize the code to suit your specific project requirements.


Data download address

Download link of IOT MQTT panel APP: https://pan.baidu.com/s/1yfza8N96ZZ5eB_ZM0JrYFA

Extraction code: eky6

Project source code acquisition address: https://github.com/Ai-Thinker-Open/Ai-Thinker-LoRaWAN-Ra-08.git



If you like the article, welcome to follow us!



Sachin Soni

Founder of techiesms

1 年

Thanks for this detailed article Good job ??

要查看或添加评论,请登录

Ai-Thinker的更多文章

社区洞察

其他会员也浏览了