RC Controlled Rgb Led Strip Using ATmega

RC-Controlled-Rgb-Led-Strip

Create your own rc controlled led-strip for individual room illumination!

Most rgb-led-strips are controlled by an infrared remote control. To turn it off or on or change the color, you have to stay in front of the receiver. This is boring and not really smart. To control the light in a cooler way, i developed a rc controlled board to set the right color of the strip. The rc code can be send from a raspberry pi, think of IFTTT. That’s a lot smarter than the ir remote control.

RC Controlled Rgb Led Strip

Things you need:

  • rgb-led-strip, for example this would do the trick
  • ATTiny85
  • 433 MHz receiver (and optionally sender)
  • 5v regulator (L7805)
  • 3 NPN transistors, i used a darlingtonarray
  • 1 µF capacitor
  • 10 µF capacitor
  • 12v power supply
  • strip circuid board
  • several wires
  • ATTiny programmer, arduino-mega or arduino-uno
  • optionally raspberry pi to send signals

Step 1: Solder the Circuid Board

Solder the Circuit Board

If you have all the components, you must solder the circuid board.

The led-strip needs 12v, the ATTiny and the rc receiver need 5v, because of that, the circuid gets 12v.

For the ATTiny and the rc receiver i use the 5v regulator, my circuid was inspired by sooraj619

The board switches the three colors red green and blue to the led-strip in a timetable of 3 ms. Each color in the right percentage to achieve the specified color. Because of a duration of the timetable with 3 ms, you don’t see switching the three colors red green and blue, but you see just the right color (for example yellow mixed by red and green). In my toolbox there was a darlingtonarray, because of that i used this array to switch the colors. You can use any NPN transistors.

Don’t forget a 17 cm antenna on the receiver.

Step 2: Flash the ATTiny
Now it’s time to flash the ATTiny with the right arduino-sketch.

To flash the microcontroller, i used the arduino ide. I have no programmer, so i used my arduino-mega. You can use your arduino-uno or your arduino-mega to flash the ATTiny, described here or here

The sketch uses the rc switch library to receiver the signal, you can download this here.

The rc switch library was written for the arduino boards, therefore it uses some routines, that are not available in the ATTiny microcontroller. Because of the ATTiny, lines 153 to 165 initializes the interrupt in a very radically way. You also have to make the method ‘handleInterrupt’ from ‘private’ to ‘public’ in the rc switch library.

Step 3: Send a Code From Your Raspberry Pi

Send a Code From Your Raspberry Pi

Now it’s time to switch the light on.

To send a signal you must connect the rasperry pi with the rc sender. Several websites demonstrates sending rc codes with the raspberry pi. For example herehere and here. The image shows the led strip behind a tv screen, but this is a photomontage out of three images with single color.

A minimal c program to send a code can look like the following:

#include “RCSwitch.h”
#include

#include

int main(int argc, char *argv[]) {

int PIN = 0;

int message = atoi(argv[1]);

if (wiringPiSetup () == ­1) return 1;

printf(“sending message[%d]\n”, message);

RCSwitch mySwitch = RCSwitch();

mySwitch.enableTransmit(PIN);

mySwitch.send(message, 32);

}

The color is encoded in an integer value with 4 byte. The most left byte must equal to 10, see 178 in the sketch. The next three byte contains the color intensity for each color (red, green and blue).

To set a green light with 66% intensity, enter the command: sudo sendInt 167815680, where sendInt is the above compiled program.

Switch the led off with the command: sudo sendInt 167772160

Imagine possibilities with IFTTT, for example 3 seconds blue light for an email, green for a google-calendar notification. That’s a little smarter than pressing the ir remote control in front of the receiver 😉

Step 4: Create an Enclosure

Create a 3d printed enclosure.

The design has a hole for the power cable and gaps in the top to connect the led strip.

I used Fusion 360 to design the enclosure and exported the result as a .step file.

Netfabb allows the tessellation as well as the build job preparation. I attached the 3mf that contains the top and bottom of the enclosure. Netfabb also supports the gcode creation.

Finally i used a prusa i3 mk2 to print the enclosure.

Read more: RC Controlled Rgb Led Strip

Leave a Comment

Your email address will not be published. Required fields are marked *