Presented here is the circuit that drives twenty LEDs in a random manner. LED flashers and sequencers are used in decorative lights to give pretty colour combinations by glowing LEDs in random or sequential manner. This flasher has a chip that controls the random flashing rate of the LEDs.
Circuit and working
The circuit diagram of the LED flasher using Arduino is shown in Fig. 1. The circuit is built around Arduino Nano board (Board1), twenty coloured LEDs (LED1 to LED20) and a few other components.
Arduino is programmed in such a way that only one LED glows at a time. A random number is generated by the program that is used to turn on the LED connected to the particular I/O pin of Arduino. On delay time period between any two LEDs or next random LED is controlled using potmeter VR1. Thus, all LEDs flash in a random manner by illuminating one LED at a time. These glow in this pattern continuously until power is switched off or removed.
Arduino Nano
Arduino Nano is a compact and breadboard-friendly board based on ATmega328 microcontroller (MCU). It has similar functionality as Arduino Uno but is available in a different and smaller package.
Dimensions of Arduino Nano are 43mm x 18mm. It has fourteen digitals I/O [of which six are pulse-width modulation (PWM) I/O pins and eight analogue inputs], 16MHz clock speed and 32kB flash memory. It uses a mini USB cable instead of the standard USB one for connecting to the computer. Unlike Arduino Uno, Arduino Nano does not have the DC power jack for external power source.
The software for the flasher is written in Arduino programming language/sketch. Arduino Nano is programmed using Arduino IDE. Select the correct board from Board→Tools menu in Arduino IDE, select COM port and upload the program (Flasher.ino) through the USB port in the computer.
Construction and testing
Connect LEDs (LED1 through LED20) to the port pins of Arduino Nano, as per the circuit diagram. You will need a breadboard, veroboard or designed PCB for connecting the resistors and LEDs to Arduino Nano.
A PCB layout of the circuit is shown in Fig. 2 and its components layout in Fig. 3.
Download PCB and Component Layout PDFs: click here
Download Source Folder
After assembling the circuit on the designed PCB and programming Arduino Nano, connect 9V DC or 9V battery to the circuit. You will notice that all LEDs (LED1 through LED20) start to glow randomly, one-by-one. The LED flashing pattern repeats in this fashion till power supply is switched off.
Many LED strings can be used in place of a single LED using suitable drivers. However, total current of Arduino Nano is limited to 200mA, so it is advisable to use a suitable driver if more than one LED is to be lit at a time. Bi-colour or RGB LEDs can be used instead of single-colour LEDs.
A. Samiuddhin is B.Tech in electrical and electronics engineering. His interests include LED lighting, power electronics, microcontrollers and Arduino programming.
Wow that PCB… Using a multiplex was top hard?
Where can I get this components
You can get components including PCB from our associates M/s Kits’n’Spares. Please visit their website at http://www.kitsnspares.com or email to [email protected]
Did I miss something ? Is there a pointer to the flasher.ino source code someplace ? Without it the PCB is not real useful to me. My Arduino programming is good, but not that good, as this uses circuits in ways I didn’t know you could.
Thanks
Hi Jack, thanks for your message. We have added the Source Folder.
It seems to be only advertising for the kit… >:(
Please also consider that, being turned on only one LED at a time, you could use only ONE resistor from all cathodes together to the ground!
The program is very simple: 20 digitalWrite with 20 delay() or a simpler
for (byte i=0; i0) z=i-1;
else z=19;
digitalWrite(z,0); digitalWrite(i,1);
delay(x);
}
Hi Glanluca, thanks for your message. This project does not promote any advertisement. We have added the Source Folder.
The link to code is missing here
Hi Sunil, thanks for your comments. We have added the Source Folder.
Thanks, got it. Downlloaded.
You are welcome.
Use 2811 LEDs. Why all the fuss?
This is another way of designing flashing LED light using individual LEDs