I am trying make bunch of LEDs flash on and off. Basically like an Arduino UNO blink where you can make a single LED flash on and off. But I want to be able control 16 sets of LEDs.
An example have 8 LEDs come on then go off. Then the other 8 came on and go off repeating over and over again.
An example 4 LEDs turn on then off another 4 come on then go off another set of 4 then off. Kind of like going around in a circle in sets of 4 LEDs.
An example half of the leds are flashing on and off at random. The other half are going on and off slowly in a quadruple flash.
Other info
Power supply 14.5v automotive
Thinking of putting something in there to help keep it safe from voltage spikes above 15v
I don't know if I should use a voltage regulator, but whatever I use to make the 5volts of power so I don't toast the Arduino there will be another thing to keep it safe. But this time keep if it spikes above 6v? after the 5volt power supply.
Each set of LEDs I have 20x in parallel of 3x in series with 220ohm resistor 1/2w see image below of the PCB I'm using.
Specs of a single LED 3.4v 20mA
Hi, i don't think that will help. Two reasons. Firstly i don't think it can handle the voltages and currents you want. You will need to add 16 transistors. Secondly, if you only want to flash the leds on and off, you don't need it anyway. You can do that with arduino outputs.
The leds should be ok with the voltage, they are organised three in series each with its own series resistor. The leds modules determine the current.
The Arduino cannot deal with either the voltage or the current. It can be powered by up to 12~14V through its barrel jack as long as it does not use too much current. Its outputs are 5V and can only handle around 20~40mA each.
But what i was really referring to in my post before was the PWM/servo chip you linked to. It cannot handle the voltage or current either. plus it does not sound like you need or want the features it provides, do you? Do you want to fade leds or just flash them?
Those FET transistors you used with the 555 chips may not be suitable for Arduino. Presumably you were powering the 555 witb 12V supply? Their outputs were also 12V and able to activate those fets. But the Arduino outputs can only be 5V and may not be able to activate the fets fully, leading to lower led brightness, flickering and the fets overheating. Look for fets with "logic-level gates" instead.
Posting images is a pain on this forum. Do what you are doing now, post, then copy the link address of the image link that appears on your post. Edit your post and paste the link in again using the "insert picture" icon.
Each of your led modules will draw around 400mA (=20 x 20mA). So a basic npn like bc337 should be fine, it has a max current of 800mA. Power dissipation should be around 0.7V x 400mA = 280mW which is much lower than the max 680mW for bc337.
I suggest trying a 510R resistor between Aruino output and the transistor base. This should give around 10mA base current. The current gain of bc337 should be at least 50, so that should ensure it is saturated.
The Uno has 14 digital IO pins, but ideally you want to avoid using pins 0 & 1 because they are used for communications with the PC which is useful for debugging. So really there are 12 digital pins available. However, you also have 6 analog pins which can also act as digital pins. If the only other pin needed is for a pushbutton, you have enough.
You should always use code tags when you post code on this forum. It is the <> icon. Please edit your post above and put them in.
Your code is not quite correct. You cannot put a list of pin numbers into pinMode() or digitalWrite(). You must put a separate digitalWrite() for each pin.
With so many led pins, it may be easier to put the pin numbers into an array like this
const byte ledPin[] = {13, 14, 15...};
You can then set them using a for() loop.
You can also specify the pattern sequences using arrays and binary representation;
const unsigned int sequence[] = {
0b1010101010101010,
0b0101010101010101,
0b1111000011110000,
...};
I think pn2222 will be ok, and the same base resistor should be about right. What you need to do before you solder up a transistor is connect a test circuit on a breadboard. Then you can check that the transistor does not get hot and measure that the voltages and currents are as you expect with a multimeter. The test circuit just needs to be one transistor and base resistor, with connections off to the Arduino digital pin and ground and to one of your led modules (which contain the series resistors) for the common cathode connection and ground.
An alternative to an Uno 3, if you can find one, would be a Nano 3 or a Pro Micro. These might be cheaper and you can design a pcb to solder the Nano/Pro Micro onto along with your transistors etc.