
This project combines an infrared receiver with a tri-color RGB LED to control the light's color remotely using any standard infrared remote control, relying on pulse-width modulation (PWM) to blend colors.
Components needed
An Arduino Uno board, a 38kHz infrared receiver, a common-cathode RGB LED, an infrared remote control, and three 220-ohm resistors to protect the LED's pins.
Wiring it up
The infrared receiver connects to digital pin 11, while the LED's three pins connect to Arduino PWM pins: red to pin 9, green to pin 6, and blue to pin 5, each through a 220-ohm resistor.
How it works
Reading the remote's signal relies on the IRremote library, which decodes the incoming signal into a distinct hexadecimal code for each button on the remote. The code compares this value against a list of pre-known codes, and when it matches one of the buttons assigned to a color, a dedicated function (RGB_color) is called that sends each color channel a value between 0 and 255 via analogWrite(). Since each channel (red, green, and blue) can take 256 independent brightness levels, blending the three channels theoretically produces around 16.7 million distinct color shades.
You can find infrared receivers and RGB LEDs at Juthour Tech.
اترك تعليقا