Skip to content

This repository contains an Arduino-based project for controlling a 4-pin non-addressable RGB LED strip. It includes functionalities for adjusting colors, brightness, and effects, with plans for real-time customization using external inputs like sound or screen capture.

Notifications You must be signed in to change notification settings

afsaldigitalart/led-strip-control-arduino

Repository files navigation

Arduino Led Strip Controller

App Icon

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

Requirements

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

Important:

Connect Red wire to Arduino Pin 5, Green to 11 and Blue to 9 respectivley

Features

  • 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 User Interface of the Software

Screenshot 2025-02-16 222726 Tray Functionality

File Overview

main.py

  • Purpose: Entry point of the application.

  • Key Functions:

    • Initializes the Arduino connection.

    • Creates the main application window.

    • Starts the main event loop.

arduino.py

  • 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.

gui.py

  • 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.

logic.py

  • 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.

Usage

1. Upload the Arduino Sketch

  • 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.

2. Connect the Arduino

  • Ensure your Arduino is connected to your computer and the correct port is detected by the application.

3. Run the Application

  • Execute the 'Led Controller.exe' from dist folder to start the application:

4. Select a Color

  • Use the color wheel to select a color. The selected color will be sent to the Arduino, and the LED strip will update accordingly.

5. Adjust Brightness

  • Use the slider to adjust the brightness of the selected color.

6. Enable Modes

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.

7. Turn On/Off

  • Use the On/Off button to control the power state of the LED strip.

8. System Tray

  • The application can be minimized to the system tray. Right-click the tray icon to restore the application or quit.

Notes

  • 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.

Pulsating Mode

VB-Cable Virtual Audio Cable

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.

Hardware Requirements

  • Arduino Uno
  • RGB LED strip (NON ADDRESABLE)
  • USB cable for Arduino
  • Jumper wires
  • Power supply for the LED strip

🔗 Links

Email

Instagram

About

This repository contains an Arduino-based project for controlling a 4-pin non-addressable RGB LED strip. It includes functionalities for adjusting colors, brightness, and effects, with plans for real-time customization using external inputs like sound or screen capture.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published