RGB LED strip controller + mini Weather station, built using the Arduino platform.
cli/
: Python scripts for building and uploading the projectsrc/
src.ino
: Entry pointconfig.h
: Pin mappings, refresh rates, device versionenv.h
: WiFi configcomponents/
: Hardware componentsdomain/
: System logic
curl -X POST '<controller_ip>/light/toggleAnimated'
curl -X POST '<controller_ip>/light/hexColor/<hex_color>'
curl -X POST '<controller_ip>/light/brightnessAnimated/<brightness>'
The project is configured to be used with the VSCode editor for editing comfort, but can definitely be
built with just the arduino-cli
and python 3
.
-
Create a copy of the
.vscode/c_cpp_properties.example.json
file and rename it to.vscode/c_cpp_properties.json
-
Install the Arduino extension
-
Install the required libraries using the "Arduino: Library Manager" command from the command palette.
- DHT sensor library by Adafruit
- AsyncTimer by Aasim-A
- ArduinoJson by Benoit Blanchon
-
Run the "Arduino: Rebuild IntelliSense Configuration" command from the command palette.
-
Create a copy of the
src/env.example.h
file and rename it tosrc/env.h
.- Fill in the required values for the WiFi SSID and password.
-
Install the
arduino-cli
tool from here -
Install the Python dependencies:
pip install -r cli/requirements.txt
- Run the
compile.py
script to build the project:
python3 cli/compile.py <version_number>
The script will create a build/bin
directory and place the binary in it.
The binary will be named <version_number.bin>
.
There are two ways to upload the binary to the micro controller:
- USB upload: Required for first-time upload or when the board is not connected to WiFi
- OTA update (Over The Air): Can be used for subsequent updates when the board is connected to your local network
The run.py
script handles both methods and includes compilation, uploading, and monitoring in a single command:
# USB upload (will also open serial monitor after upload)
python3 cli/run.py <version_number>
# OTA update
python3 cli/run.py <version_number> --ota <controller_ip>
# OTA update with custom timeout (default is 60 seconds)
python3 cli/run.py <version_number> --ota <controller_ip> --timeout 90
Examples:
# Upload v1.3.2 via USB
python3 cli/run.py v1.3.2
# Update to v1.3.2 over WiFi (controller at 192.168.1.100)
python3 cli/run.py v1.3.2 --ota 192.168.1.100
The script will:
- Compile the code for your board
- Upload it using the selected method (USB or OTA)
- For USB uploads: Open the serial monitor automatically
- For OTA updates: Wait for the update to complete and verify the board is back online
If you prefer to upload manually, you can use these commands:
arduino-cli upload -i ./build/bin/<version_number>.bin -b esp8266:esp8266:d1_mini_clone -p /dev/cu.usbserial-120
- Start the update server:
python3 cli/server.py
- Trigger the update on the controller:
curl -X POST '<controller_ip>/settings/version/update/<update_server_ip>/<update_server_port>/update'
- WeMos D1 mini (micro controller)
- DHT22 (temperature & humidity sensor)
- LM2596S Step-down voltage regulator
- IRLZ44N (N-channel, logic-level MOSFET Transistor) x 3
- 10kΩ Resistor x 4
- 5.5X2.1mm DC Power jack
- SMD 5050 RGB Strip