This project is a Python-based application that allows users to control an LED strip connected to an Arduino. The application provides a graphical user interface (GUI) for selecting colors, adjusting brightness, and enabling various lighting modes such as Rainbow, Pulsating, and Ambient. The application communicates with the Arduino via a serial connection to send RGB values.
Strictly personal program. For personal learning purpose only
To run this application, you need the following Python packages:
- customtkinter
- Pillow
- pystray
- numpy
- sounddevice
- mss
- pyserial
- pyfftw
You can install these packages using pip:
pip install -r requirements.txt
Connect Red wire to Arduino Pin 5, Green to 11 and Blue to 9 respectivley
-
Color Selection: Users can select colors from a color wheel.
-
Brightness Control: Adjust the brightness of the selected color using a slider.
-
Lighting Modes:
Rainbow Mode: Cycles through a spectrum of colors.
Pulsating Mode: Changes the LED color based on audio input (bass, mids, highs).
Ambient Mode: Matches the LED color to the average color of the screen.
-
On/Off Control: Turn the LED strip on or off.
-
System Tray Integration: Minimize the application to the system tray.
User Interface of the Software
-
Purpose: Entry point of the application.
-
Key Functions:
-
Initializes the Arduino connection.
-
Creates the main application window.
-
Starts the main event loop.
-
-
Purpose: Intializes and connect to the Arduino.
-
Key Functions:
__init __: Initializes the connection to the Arduino.
send_rgb_to_arduino: Sends RGB values to the Arduino.
checkPort: Automatically detects the port where the Arduino is connected.
-
Purpose: Manages the graphical user interface.
-
Key Functions:
-
Color Wheel: Displays a color wheel for color selection.
-
Brightness Slider: Allows users to adjust the brightness.
-
Mode Switches: Toggles for Rainbow, Pulsating, and Ambient modes.
-
On/Off Button: Controls the power state of the LED strip.
-
Quit Button: Exits the application.
-
-
Purpose: Implements the core logic of the application.
-
Key Functions:
-
create_color_wheel: Generates a color wheel image.
-
get_color_from_position: Determines the color based on mouse position.
-
adjust_brightness: Adjusts the brightness of the selected color.
-
rainbow_effect: Implements the Rainbow mode.
-
pulse_on/pulse_off: Implements the Pulsating mode based on audio input.
-
AmbientMode: Implements the Ambient mode by matching the screen's average color.
-
turnoff/turnon: Controls the LED strip's power state.
-
-
Open the Arduino IDE.
-
Navigate to the arduino folder in this project and open the .ino file (e.g., LED_Control.ino).
-
Connect your Arduino to your computer.
-
Select the correct board and port from the Tools menu in the Arduino IDE.
-
Upload the sketch to your Arduino.
- Ensure your Arduino is connected to your computer and the correct port is detected by the application.
- Execute the 'Led Controller.exe' from dist folder to start the application:
- Use the color wheel to select a color. The selected color will be sent to the Arduino, and the LED strip will update accordingly.
- Use the slider to adjust the brightness of the selected color.
Toggle the switches to enable different lighting modes:
-
Rainbow Mode: Cycles through a spectrum of colors.
-
Pulsating Mode: Changes the LED color based on audio input (bass, mids, highs).
-
Ambient Mode: Matches the LED color to the average color of your screen.
- Use the On/Off button to control the power state of the LED strip.
- The application can be minimized to the system tray. Right-click the tray icon to restore the application or quit.
-
Ensure the Arduino is properly set up to receive RGB values via serial communication.
-
The Pulsating mode requires an audio input device to be connected and configured.
-
The Ambient mode captures the screen's average color and may require additional permissions on some operating systems.
Purpose: VB-Cable is a virtual audio device that allows you to route audio from one application to another. It is useful for capturing audio input for the Pulsating Mode.
Download Link: VB-Cable Virtual Audio Cable
Installation:
-
Download the VB-Cable installer from the official website.
-
Run the installer and follow the on-screen instructions.
-
After installation, VB-Cable will appear as an audio device in your system's sound settings.
Configuration:
-
Set VB-Cable as the default playback device in your system's sound settings.
-
Set VB-Cable as the default recording device to capture the audio input for the Pulsating Mode.
- Arduino Uno
- RGB LED strip (NON ADDRESABLE)
- USB cable for Arduino
- Jumper wires
- Power supply for the LED strip