My Cart

Arduino LED Lamp Controlled with RFID TagsApril 15, 2015

RGB LED Lamp

This is another project made by the Cooking Hacks Team. To develop this project we reused an old desk lamp. They are useful and everybody needs one but, to be honest, they can be a little boring.

So we thought of somehow making it a bit more entertaining and we added several colors and a contactless way of choosing between them.

It is a RGB LED Lamp controlled with RFID tags. Making use of several cards (or tags) you can choose the color of the lamp: red, blue, green, white or random.

This time, the mind behind the project is Marcos, from the R&D department in Cooking Hacks.

But, what is RFID? RFID stands for Radio Frequency Identification. This term includes technologies that use electromagnetic fields to automatically identify and track tags attached to objects.

An RFID system consists of a reader (transceiver) and a tag (transponder). The tag usually contains a chip and an antenna: the info to identify a person or an object is stored in the chip and the antenna allows the chip to transfer the identification data to a reader.

The reader creates an electromagnetic field through its antenna, and when the tag is placed close enough to receive the signal it responds by sending back the info stored in its chip. Then the reader is able to process the information sent by the tag and transmit it to a computer program.

Recycling the old lamp

First thing we did was to look at what we had in our hands. We opened the lamp to see if we could use anything but, since we are building everything around an Arduino Uno and LED strips, there wasn't really much we could take advantage of.

RGB LED Strip

We ended up getting rid of all the electronics inside and we just made use of the lamp casing. In order to make all the different colors we are using RGB LED strips so we had to remove the bulb too.

So what's inside?

What's Inside?

The lighting is made with an RGB LED strip. This kind of LEDs actually have three different LED packed inside, one red, one green and one blue. By mixing up the light and brightness of each one of them you can obtain any color you want. For example, to make a white light we have to turn on all three LEDs with the same intensity, and, if we turn off the blue LED, mixing just red and green, we would have a yellow light.

As we said before, we replaced the bulb with a couple of LED strips that are glued to the lamp and connected through the lamp's arm to the Arduino board. The LED strip have for pins: one for each color (red, green and blue) and one for power (12V). The blue, red and green cables are plugged into the pins number 9, 10 and 11 of the Arduino, and the power pin is plugged into the Vin.

We removed the power cable too, and instead we used a 12V AC Adapter. This voltage is needed for the LED Stripes, and is available on the Vin pin.

The wireless identification is made with our RFID 13.56 MHz Module (XBee Socket). This module allows to read and write different cards. The reader antenna is glued to the casing, under the lamp's base, so it can easily read the tags. It has an Xbee Socket, that means it can't be plugged directly to the Arduino Board.

RGB LED Lamp

To do so the module is connected to a Communication Shield. This shield allows to use XBee or our Bluetooth and RFID modules. The Communication shield is then attached to the Arduino board.

Five 13.56 MHz cards are used to choose the color of the lamp. You can re-write this cards to change the stored information, so we assigned to each card a unique identification. That way, whenever you place one over the reader, the card automatically sends the data stored in its chip and the reader transmits the info to the Arduino Board. Depending on which card we are using it lights up a different color. One card is used to choose a random and changing color. It keeps that color until it detects another valid card.

You can see the LED Lamp working on this video:

Give it a go

This project was developed following our RFID 13.56 MHz Tutorial. We are glad to share the code with you:

if (state == 0)              // if so, we can be sure that we read correctly one UID
   {
      // search if the read card is inside the data base
      card = search(vCards, _UID, nCards); 
                            
     if (card != -1) {                    // if so, this is one of OUR cards
       Serial.print("\r\n  Card number ");
       Serial.print(card);
       Serial.print(" identified. Access granted.");
       hits[card]++;                      // add one more hit for the read card

       if (card == 0){
        Serial.println("Rojo");
        digitalWrite(9,HIGH);             //azul
        digitalWrite(10,LOW);             //rojo
        digitalWrite(11,HIGH);            //verde
  
       }
...

You can download the complete code here.

Check more CH Team Hacks, for instance this Resistor Cutting Robot.

Leave a Reply