-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
Phuc Doan edited this page Feb 25, 2025
·
4 revisions
- Visual Studio Code: Install
- Install PlatformIO extension for VS Code: Install
- Clone the project into to a local repo: Tutorial
- Make sure you have the PlatformIO extension in the sidebar. Click on it.

- Choose Projects & Configuration → Add existing

- Locate and choose the directory you have just cloned.
- Close the PIO Home GUI tab and reopen it. You should now see your newly created project. Click on Open and libraries should be automatically installed.
- Compiling and uploading firmwares can be done through PlatformIO's sidebar extension, VSC's button in the top-right corner, hotkeys, or CLI.
- Optionally, install the official Serial monitor to help with debugging: Install
In your local repo, open config/common.ini. Here contains commonly adjusted variables.
- Node ID's naming scheme: S-X, with X being an integer starting from 0.
- Change pin according to your board setup.
-
timeris in seconds. -
air_valueandwater_valueare to be adjusted after calibration.
- Hub ID's naming scheme: H-X, with X being an integer starting from 0.
-
rx_hub_ioandtx_hub_ioare to communicate with the other part of the gateway. They must not be GPIO pins associated with the USB port / UART0.
- Hub ID here must match that of the other hub component.
- You may only change topic's name here, not adding/deleting. It must be consistent with the one subscribed by the Python's client.
-
rx_hubandtx_hubare similar to the mentionedrx_hub_ioandtx_hub_iorespectively. - Also create a
credentials.iniwith content copied fromcredentials.ini.dist. Modify the variables within accordingly. Should you entermqtt_usernameandmqtt_password, you will have to configure them while installing mosquitto broker.
- Clone the project
- Optionally, create and activate a virtual environment: Guide
- Run the following command to install dependencies:
pip install -r requirements.txt- In your local repo, open
config.yaml. It is similar tocommon.ini. Only name changes allowed here. - Client ID's naming scheme: C-X, with X being an int starting from 0.
- To store important credentials, create a
.envfile with the following structure:
HOST_IP=<your-mqtt-broker-ip-address>
PORT=<your-broker-compatible-port>
MQTT_USERNAME=<mqtt-broker-approved-usrname>
MQTT_PASSWORD=<mqtt-broker-approved-password>- Run the client (only after other components have been installed and initialized)
python3 main.py- Install mosquitto MQTT broker: Install
- Navigate to mosquitto installation directory. It is by default on Windows at:
C:\Program Files\mosquitto. - Create your MQTT Credentials with
mosquitto_passwdutility. This should be what you configured for all clients (Hub and Python client): Docs and Guide. - Still in the installation directory, open
mosquitto.confas Admin. Paste this in, adjust the password file and save it:
listener 1883
protocol mqtt
allow_anonymous false
password_file C:/Program Files/mosquitto/passwd - To run the broker, open the terminal as Admin and run:
mosquitto -v -c "C:\Program Files\mosquitto\mosquitto.conf"- Your WiFi connection must be at 2.4 GHz, not the common 5 GHz.
- Broadcast channel should be Auto.
- Use Mobile Hotspot to expedite these setting changes.