An RGB lamp powered by a Raspberry Pi Pico, offering seamless control via MQTT. Customize your lighting experience with simple commands for color changes, dynamic animations, and an audio visualizer mode.
- MQTT Control
- Color Selection
- Animation Selection
- Audio Visualizer Mode: Requires python-fft-streamer.
This project is part of my basic home automation suit and requires the pihub server for remote control.
- micropython (RPI_PICO_W-20240602-v1.23.0)
- mpremote
For a complete bill of materials see the hw/pcb folder.
git clone https://github.com/vladbalmos/pico-rgb-lamp
git submodule update --init --recursive
Copy device.tpl.json
to device.json
and configure your wifi & mqtt settings. See Device configuration for available options
build.ps1 -Command build
Once micropython is flashed and the source code files are copied to the device (see Building and flashing) run:
build.ps1 -Command run
This will reset the device first, copy the src/
dir to the device and then call mpremote run src/main.py
The configuration is provided in JSON format and is used to customize various aspects of the lamp, including its MQTT communication, features, and hardware setup.
- Type: String
- Description: A unique identifier for the RGB MQTT Lamp.
- Example:
"RGB_MQTT_LAMP_001"
- Type: String
- Description: The name of the RGB MQTT Lamp.
- Example:
"RGB MQTT Lamp"
- Type: String
- Description: The SSID of the WiFi network to which the lamp should connect.
- Type: String
- Description: The password for the WiFi network.
- Type: String
- Description: The IP address or domain of the MQTT server that the lamp will communicate with.
- Example:
"mqtt.example.com"
- Type: Object
- Description: Configuration related to the hardware setup and features of the lamp.
- Type: Array of integers
- Description: The GPIO pins used for controlling the RGB channels: [red pin, green pin, blue pin]
- Example:
[0, 1, 2]
- Type: Array of integers
- Description: The GPIO pins used for the rotary encoder: [clk_pin, dt_pin]
- Example:
[14, 13]
- Type: Integer
- Description: The GPIO pin used for the select switch.
- Example:
15
- Type: Boolean
- Description: Whether to invert the PWM duty cycle for LED control. Usefull when using PNP / P-MOSFET drivers
- Example:
false
- Type: Object
- Description: Configuration for the FFT (Fast Fourier Transform) streamer used in the audio visualizer. Not required - the lamp will automatically subscribe to the streamer mqtt channel and autoconfigure, see python-fft-streamer
- Type: String or null
- Description: The host for the FFT streamer.
- Example:
null
- Type: Integer or null
- Description: The port for the FFT streamer.
- Example:
null
- Type: Array of strings
- Description: A list of predefined colors available for selection. Colors are defined in hexadecimal format.
- Example:
["#ffffff", "#ff0000", "#00ff00", "#0000ff", "#ffff00", "#00ffff", "#ff00ff"]
- Type: Array of objects
- Description: A list of features that the RGB MQTT Lamp supports.
- Type: String
- Description: The name of the feature.
- Example:
"Change global color"
- Type: String
- Description: A unique identifier for the feature.
- Example:
"change_global_color"
- Type: Object
- Description: The schema that defines the configuration options for the feature.
- Type: String
- Description: The data type of the feature's configuration value.
- Example:
"color"
,"boolean"
,"json"
,"list"
- Type: Depends on
type
- Description: The default value for the feature's configuration.
- Example:
"#ff0000"
- Example:
false
- Example: JSON object with audio visualizer settings.
- Example:
"off"
- Type: Array of strings
- Description: A list of valid values for the feature.
- Example:
["off", "breathe", "wheel", "rainbow"]
- Type: Object
- Description: The MQTT topics used for subscription and publishing.
- Type: Object
- Description: MQTT topics to which the lamp subscribes.
- Type: String
- Description: The MQTT topic for manager requests.
- Example:
"acme/devices/request"
- Type: String
- Description: The MQTT topic for lighting control.
- Example:
"acme/devices/lighting"
- Type: String
- Description: The MQTT topic for device-specific requests.
- Example:
"acme/devices/lighting/name-of-device/request"
- Type: Object
- Description: MQTT topics to which the lamp publishes messages.
- Type: String
- Description: The MQTT topic for manager responses.
- Example:
"acme/devices/response"
- Type: String
- Description: The MQTT topic for device-specific responses.
- Example:
"acme/devices/lighting/name-of-device/response"