- Place the microprocessor (RAK11310) in the dedicated slot on the motherboard, aligning the pins and holes correctly.
- Press lightly until you hear a click, then secure it using the screws and screwdriver in the kit.
- Place the RAK12039 sensor on the dedicated slot on the board.
- Align the pins and press until you hear a click, then secure it with screws.
- Connect the optical strip to the particle sensor port (RAK12039).
- Connect the other end of the strip to the air purity sensor.
- Plug the antenna into the dedicated port on the microprocessor. Make sure it's firmly fastened.
- Glue the m-m (male-to-male) wires to the display pins using the soldering iron and fludor.
- It then solders the wires to the VCC, GND, and signal ports on the board, according to
- Diagram.
Once the assembly part is ready, we can move on to the software part, where we will need a laptop, where we will start the Arduino IDE application.
- Connect the card to your laptop via USB-C cable.
- In the Arduino IDE, go to Preferences and add the following link to the "Additional Boards Manager URLs":
- Install the WisBlock libraries and select the RAK4631 board.
- Access: https://eu1.cloud.thethings.network/
- Create a new account and app.
- Registers a device (manually) and notes the DevEUI, JoinEUI (AppEUI), and AppKey values.
Choose application and then "end devices", choose register "end device"
Choose the manual recording method
Set your device to connect to TTN by following these steps:
The example contains 3 files:
- LoRa_handler.cpp – manages LoRaWAN communication (authentication keys, network parameters).
- Main.h – contains global variables and function declarations.
- RAK4631-DeepSleep-LoRaWAN.ino – the main file that sends the data and controls the DeepSleep modes.
Update LoRa_handler.cpp with data from the TTN console:
- DevEUI
- JoinEUI
- AppKey
After uploading the code, the message "Hello" should appear in the TTN console in HEX format.
After verifying the upload of the code to the device, a check can be done in the TTN console, where a "Hello" message will be received in HEX format
Required changes:
- In RAK4631-DeepSleep-LoRaWAN.ino: read the data from the RAK12039 and send it via LoRa+ display it on OLED.
- In Main.h: Adds support for OLED and particle sensor structures.
- LoRa_handler.cpp remains largely unchanged.
- In the TTN console, go to:Application → Payload Formatters → Uplink
- For Formatter type, select JavaScript Formatter.
- Inserts the code to decode the data sent by the sensor.
- Download and extract the TTN-WebHook-Site.zip file from GitHub.
- Open the terminal in that directory and run:
pgsql
npm init -y
npm install express body-parser
Node server.js
- In another terminal:
yaml
CopyEdit
ngrok http 3000
- Copy the link generated by Ngrok and use it for WebHook in TTN.
- Go to the app in TTN → WebHooks → Add WebHook
- Select Custom WebHook
- Complements:
- WebHook name (ex: AirMonitorWebhook)
- Base URL: https://xxx.ngrok-free.app/api/ttn-webhook (make sure to manually add "/api/ttn-webhook")
- Check Uplink Message
- Click Add WebHook
After this step, the data will be transmitted to your local server and visible through your browser.
Gîngu Ion Sorinel
Comments