Using an Arduino Uno for a flickering/flame Effect on 17 3mm LEDs

Good afternoon/morning,

I am relatively new to electronics and Arduinos but I successfully wired LEDs from DC power supplies before. A bit of a background into the project at hand, I am working with a large gunpla model which I want to add LEDs to, the leds will go in each of the thrusters and have a flame flickering effect. From what I have read so far a parallel circuit on its own will be no good and be too much for the pins and processor to handle.

A fellow acquaintance of the hobby has suggested a Logic Level Mosfet, i'm not too sure what this is or really where to start so I am hoping you guys can help.

The code I will be using is the following which I hope to implement to all 17 LEDS.

// LED Fire Effect

int ledPin1 = 3;

void setup()
{
pinMode(ledPin1, OUTPUT);

}

void loop() {
analogWrite(ledPin1, random(120)+135);

delay(random(100));
}

The LEDs will be 3mm Blue, 3.0-3.2 Forward Voltage at 20ma, will want to reduce down to 10 or 5 to dull the brightness a bit.

Thank you for your time.
Nayth

What do you intend to use as a power supply and how will you wire the LEDs?

12 V can power four series connected blue LEDs, for example (and several such sets in parallel).

Sorry, forgot to include that. Will be using a 5v/1A USB Power Bank

To power everything?

Then you will need to wire the 17 LEDs and their 17 required current limiting resistors (~150 Ohms) all in parallel.

This circuit will work, but be sure to buy a logic level MOSFET.

(The 10K resistor should be connected to drive_in, not the gate.)

That is the plan, however if that is unwise which I assume it is. I could use 2 powerbanks. 1 Soley for the Arduino, the other for the Leds as an external power source.

Unless your LEDs are high-current devices, a good rule of thumb is to allow 25 - 30 mA per LED. Thus, 17 LEDs is 510mA, just over half-an-Amp. Then add in the UNO current and give yourself a safety margin: 1A @5V will run the project but not give you much headroom for future growth.

On the LED note, different color LEDs require different current limiting resistor values.

What is the purpose of the 10k resistor and why is it needed?
Asking in hope of learning.

The 10K pull down resistor is there to hold the MOSFET off while until the program can set the pin to output mode during setup when reset. Pins are by default inputs when the processor is reset. An input with no pull down is floating (indeterminate state) so the MOSFET can turn on until the pin is set to output and (defaults) LOW. The pulldown prevents that.

The pull down resistor should be on the Arduino output side of the gate resistor as mentioned by @jremington.

Understood, thankyou.

I thought you wanted an effect where the LEDs flickered individually, in which case a MAX7219 matrix driver would be very convenient.

Since the processor is doing nothing else, it can implement a form of software PWM to individual LEDs to generate a complex flicker.

Nah, didnt need them to have individual effects, the code above that provides random values to look almost like a flame will.be sufficient enough.

During my components search I came accross some leds which flicker as they are.

Now that I am aware of these would it not make sense to just go with these and a simple circuit, removing the arduino entirely and not overcomplicate things ?

Please let me know the pros and cons .

Thanks , Nayth

When did you last see a candle burning blue? :astonished:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.