Arduino moodlight, my version...

well, after about a month of waiting for delivery of my power led's, I finaly finished my long ago started project.
I use three 3W leds, one for each color. I drive them through a MOSFET and a few resistors to adjust current. You can find pictures and code on my blog. Any questions, feel free to ask :slight_smile:


Hey, did you change your design from the pictures on the website? I think the LED's you purchased could get a lot brighter with a few simple modifications.
First, use resistors designed to handle several watts of electricity, it appears as if you're using 1/2 watt resistors. Additionally you could use a lower gauge wire connected to a source capable of pumping 3+ amps of juice out. As a final step, place heatsinks on those mugs! The LED's and MOSFETS should each be placed on a large piece of metal or have heatsinks placed on them.


Well... actually I used 1/8Watt resistors, because I was still trying to adjust the values to get the right current for producing max power. And for the picture, I didn't want to burn my camera's CMOS so the led's are at about 5% ;D

the led's are at about 5%

:o :o You'll destroy your retina!! :o

That's the reason you don't look directly at the led. My idea is to put it into a plexi glass housing so it will be iluminating my room, without the option of having the led at direct sight :slight_smile:


Hi, Odisej,

If you want ultra smooth random color transitions (and have enough free memory on your arduino), feel free to use my implementation of the Perlin noise algorithm. I'm working on a 5x5 RGB led array and I'm getting great results (well, at least for me) You can see the array in action at and get the Arduino code at Google Code Archive - Long-term storage for Google Code Project Hosting. (britable 0.10.rar)

Best regards

Cool! I love mood lighting. What sort of 'stuff' will go over the LEDs? Are you going to put something like rippled glass or odd shapes on it; maybe motor-driven? Those round glass globes that go over cheap indoor light fixtures work very well and look pretty cool too.

I'm adding this to my (long and growing) list of 'want to do' Arduino projects.

I noticed you have resistors on the MOSFET gates and also in line with the LEDs. You're sort of mixing two approaches here, and your're not really driving the MOSFETs properly. I'd suggest the following for more reliability.

The gate resistors on the MOSFETs should tie the gate to the source and should be a high value such as 10k-100k. The Arduino pin will drive the gate directly. This improves the response of the MOSFET by draining off the capacitive charge on the gate when the pin goes low, and allows the pin to go high very quickly too. The gate is a very high impedance, so it will not draw any noticeable current from the pin. (in fact you may be able to eliminate that resistor completely)

The resistors in line with the LEDs should be a wattage and value that limits the current to a suitable level, as if the MOSFETs didn't exist. That way the resistors are taking the brunt of the heat and the MOSFETs will run cooler because they are just switching fully on or off, rather than acting like a throttle.

The wattage of the resistors is calculated
(PS volts - LED volts) * LED amps

The ohms is calculated
(PS volts - LED volts) / LED amps

So for example, if the LEDs were 350mA (.35A) and 3.6V each and your power supply is 12V, then:
Ohms: (12 - 3.6) / .35 = 24 ohms each
Watts: (12 - 3.6) * .35 = 2.94 watts each

This will cover for the LEDs running at 100%. If they only ever get to 75% brightness, then multiply the watts by 75%. But the ohms stays the same.


I know about resistors... but I don't stock 3W resistors, and this was a "half an hour project", well the circuit, and I took what I got. I'm going to buy some apropriate resistor this week, and hopefully design a standalone power suply. It's a "to-do" :slight_smile:

About driving the gate... I know it's "wrong" to put the resistors there, but just minutes before I found this MOSFET's, I had some power transistors there (and you should put a resistor between transistor's base and arduino, right), and I didn't remove the resistors after replacing them with MOSFET's. Are you sure about putting resistors between gate and vcc (or, as I would put it, between gate and ground)?

Thanks for the comment though! :slight_smile:


I know about resistors...

D'oh! Sorry. I figured that might be the case, and almost commented ahead of time about it. :stuck_out_tongue:

You want to bleed off the gate charge when the pin goes low (similar to a pull-down resistor).

But I'm realizing that I'm operating on not enough information. I got the impression from your pictures that you were regulating the current through the LEDs by running the MOSFETs in linear mode. But after reading that you switched from transistors to FETs, it makes more sense why you have it the way you do. I also never asked whether you are using N-channel or P-channel FETs, which makes a major difference in how you drive them.

Groan. Too much coffee for me today. If you're willing to risk any more advice from me, reply with the type of FETs and I'll think through things a little better in my next reply.