ARDUINO WIFI RGB LAMP [IKEA DUDERÖ MODDING]

By on February 20, 2012
Pin It

 

We create an application based on Arduino, that allows you to control brightness and color of a RGB strip LED via local network or Internet through a WiFi or Ethernet shield

RGB shield

How it works

The system that we propose is based on the Arduino UNO, on which are mounted two shield: the Ethernet or WIFI Shield, which provides the connection to LAN, and the RGB shield which mounts three power drivers to control the LED strip.
In Arduino must be loaded different sketch depending of the type of connection you choose (Ethernet or WiFi). The sketch allows you to manage communication via LAN and create a web interface (which will come to those who try to access via a local network) and run the commands received.
Arduino is like a web server, an HTML page is showed through a browser, by introducing into the address bar the IP address corresponding to the ethernet/WIFI shield.

This means that the lamp can be turned on and controlled by any device on the network or remotely via the Internet. The web page shows the current setting of R, G, B of the lamp and allows you to edit them.

 

The shield RGB

Arduino controls the LED channels by a shield very simple, containing three MOSFET enhancement-mode n-channel type P36NF06; each MOSFET is driven on the gate, through a resistor, with the logic signal that Arduino sends. To be precise, pin 3 controls T3 (red), pin 5 controls T2 (green) and pin 6 controls T1 (blue), each line has a status LED, polarized by a limiting resistor (LEDs indicate how it is behaving this channel). Note that Arduino controls the individual transistors by PWM signals, which duty cycle determines the presence and intensity of a certain color; more precisely, the width of the pulses can changes from a minimum to a maximum to decide how much light should be the group of LEDs of the respective color.

The drain of each MOSFET controls the load which must be connected with the anode to the positive line of the common power supply (+); for each channel there is a connector with a positive contact (goes on line common) and a negative (corresponding to the respective drain MOSFET).
We have provided the possibility to power the LEDs in two ways: with the power drawn by Arduino contact Vin (in which case you should close the jumper on Vin) or with a voltage supplied to the terminal PWR (PWR jumper closed on), you can opt for the first solution if you think your lamps absorbs less than 1.5 amps, but if you need more power you have give power apart from the shield, with a suitable power supply.
Note that by closing the jumper on Vin, the Arduino must be supplied at 12 V with a power supply capable of delivering all the current required.

RGB Shield

 

[code]

R1: 1 kohm
R2: 390 ohm
R3: 180 ohm
R4: 330 ohm
R5: 330 ohm
R6: 330 ohm

T1: STP36NE06
T2: STP36NE06
T3: STP36NE06

LD1: Led 5 mm blue
LD2: Led 5 mm green
LD3: Led 5 mm red

D1: 6A600

– Screw a 2

R1: 1 kohm
R2: 390 ohm
R3: 180 ohm
R4: 330 ohm
R5: 330 ohm
R6: 330 ohm

T1: STP36NE06
T2: STP36NE06
T3: STP36NE06

LD1: Led 5 mm blu (510LB7C)
LD2: Led 5 mm verde
LD3: Led 5 mm rosso

D1: 6A600

Varie:
– Screw 2 via(4 pz.)
– Strip M/F 6 via (2 pz.)
– Strip M/F 8 via (2 pz.)

[/code]

The sketch

 

 

 

 

The web page

RGB Dudero

We conclude seeing the commands and reports available on the web page, there are buttons to issue commands, the option radio to select mode and some boxes where you write parameters. We start from the top, where we find the seven buttons, each relating to a color: each of them set in the lamp the combination of the LEDs R, G and B to obtain the corresponding color; receiving the command Arduino sets its color. Below these buttons are three boxes, with the Calculate button to the right: from left to right, they represent the colors red, green and blue. In each box, you can write, with a number between 0 and 255, the intensity that we have employed the same light, for example, typing 255 in the middle box we illuminate at full intensity green light.
The value in each cell can be varied with the buttons below Red+ Green+ and Blue+ (which increases the light intensity, respectively, red, green and blue) or by Red- Green- and Blue- buttons that reduce the intensity. Clicking on the Calculate button, see what color will obtain, whereas with Set colors send a request for setting the color intensity corresponding to the combination of the three boxes.
The last section of the web page is that of the fader: it is the effect of color change continues, activated by clicking in the option box next to On the same name (Fader) to disable this function you must click Off. By activating the fader, we will see the light of the lamp shades change cyclically from the currently set color, you can also choose between multiple execution speed of the cycle, the drop down menu which is accessed by clicking the middle box inc/speed was above a Fader section.

To build the project

About Boris Landoni

Boris Landoni is the technical manager of Open-Electronics.org. Skilled in the GSM field, embraces the Open Source philosophy and its projects are available to the community.
  • bob

    Would be good if you posted the code correctly, so that it can easily be copied, rather than having stupid line numbers.

    Ever heard of github?

  • You haven’t to select the text with the mouse….
    In the high/right corner there are some buttons (go up with the mouse) to copy the code ;-)

  • manrico

    if we are in presence of a wi-fi LAN, and my smartphone is connected to the web by wi-fi router,
    may some conflicts be during the communication between smartphone and arduino-wifi module?

  • No, you can cumunicate with your WIFI shield through the AP.

  • manrico

    modern wifi-home-routers request a password to the host to comunicate.
    So I have insert password into the wifi shield.
    How?
    I have also to insert the wifi shield ip into the router table?

  • Hi,
    you have to insert your WIFI parameters in these fields

    const prog_char ssid[] PROGMEM = {“AP_FES”}; // SSID access point
    unsigned char security_type = 3; // 0 -> open
    // 1 -> WEP
    // 2 -> WPA
    // 3 -> WPA2
    // Password WPA/WPA2 (max. 64 caracters)
    const prog_char security_passphrase[] PROGMEM = {“12345678”};
    // Password WEP 128-bit keys
    prog_uchar wep_keys[] PROGMEM = {0x01, 0x02, 0x03, 0x04, 0x05,
    0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

  • manrico

    Hi,
    can I bypass the wifi-home-router sending packets (by smartphone) with a MAC destination address=MAC address of WIFI Shield, and WIFI Shield sends packets to the smartphone with the MAC destination address=MAC address of smartphone?
    Is this possible?
    thanks

  • You could create an ad-hoc connection

  • Michel

    hello
    is necessary an on WiFi router connected in the room?
    if in the room there is no WiFi signal, does the project run?

    thanks
    Michel

  • yes for this sketch, but the wifi is able to create an ad hoc connection

  • Horvath Robert

    Dear project author?

    The preferred settings is stored in the device after power off? Or everytime is necessary connect the device via WIFI and configure it?

    Thank You for answer!

  • Horvath Robert

    Dear project author!

    The preferred settings is stored in the device after power off? Or everytime is necessary connect the device via WIFI and configure it?

    Thank You for answer!

  • I am grateful to get found this site. Preserve up the good postings.

  • frank

    Hi, I would like to know why the row No. 195 crashes compilation of sketca and does not go forward. What is missing in that line? thanks for your attention, I am referring to the program with the ethernet card

    • BorisLandoni

      What IDE version are you using?
      You have to use 023

  • bithead942

    First, I just wanted to commend you on an excellent idea – very inspiring. I built two of these and put them in my kids room as a night light. I could then programatically turn them on/off or dim them to save energy. It worked great, but I have made some minor improvements that I wanted to share:

    1) I found the WiFi shield to unexpectedly drop connectivity after about 12 hours. I went online and found community improvements which help to make it more stable, but ultimately could not achieve stability. My initial solution was to put the power supply on a timer that turned on in the evening and turned off in the morning – this let me control the lamp when I needed it and automatically reset the device every day to overcome the issue with the shield stability. Recently, I’ve purchased a Netgear WNCE2001 device which lets me use a Arduino Ethernet shield. This has made the whole platform very stable.
    2) I found that the string of LEDs like you suggested have made hot spots of light projected on the inside of the lamp shade. I was seeking a more uniform glow. I attempted to put a diffuser shield over top of the LEDs which helped a bit, but was still showing large hot spots. I bought an RGB LED strip from SparkFun and found that it worked perfectly with your RGB Shield. I spiral wrapped the RGB LED strip around the lamp pole and now get a much more uniform glow without hotspots.

    • BorisLandoni

      Thank you very much for the appreciation and tips.
      We are still improving the library, work in progress :-)

  • amaury

    Hello i’ve some errors when i compile the code:

    sketch_nov20a.ino: In function ‘void setup()’:

    sketch_nov20a:177: error: ‘WiServer’ was not declared in this scope

    sketch_nov20a.ino: In function ‘void loop()’:

    sketch_nov20a:196: error: ‘WiServer’ was not declared in this scope

    sketch_nov20a.ino: In function ‘void printWebPage2()’:

    sketch_nov20a:328: error: ‘WiServer’ was not declared in this scope

    sketch_nov20a.ino: In function ‘void printWebPage()’:

    sketch_nov20a:344: error: ‘WiServer’ was not declared in this scope

    i use Arduino 1.06
    Any ideas what to do???
    thx

  • edward

    Hi, BorisLandoni Nice to meet you.

    My name is Edward

    Your project “ RGB content ” is selected as a treasure of
    our WIZnet museum website as I mentioned before. I hope you have received a
    sample by now.

    Do you mind telling me if you are working on any other project these
    days?

    I will be very appreciated if you could share information of the
    project with us.

    Furthermore, I would like to introduce your completed project on
    museum and wiznetian website under your permission.

    I hope we could have further relationship and stay keep in touch.

    Thank you very much