Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: rob100 on May 29, 2013, 02:05 pm

Title: How many LED's can i use on the ATMEG328P-PU
Post by: rob100 on May 29, 2013, 02:05 pm
Hi guys

I am a beginner for using the Arduino uno board and I need some help.  A lot of my work at home are building models for a hobby. I saw the Arduino on the internet and saw that you can program it to make LEDs flash. I just need to know how many LEDs can I run on the chip also can i program the chip and take it out of the Arduino add it to a PCB. I'm building a model and I need to put some flashing lights on it a lot of lights.
Can you guys help thanks.
Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: fungus on May 29, 2013, 02:16 pm

I am a beginner for using the Arduino uno board and I need some help.  A lot of my work at home are building models for a hobby. I saw the Arduino on the internet and saw that you can program it to make LEDs flash.  I just need to know how many LEDs can I run on the chip.


The chip has 18 usable outputs.

In reality you're limited to 200mA total output on all pins so you can only run the LEDs at about 10mA each (you need a resistor for every LED).

It's a much better idea is to add an external controler chip like the TLC5940 if you can:

ttp://playground.arduino.cc/learning/TLC5940


also can i program the chip and take it out of the Arduino add it to a PCB.


Yes, so long as you add a crystal oscillator for the clock.

Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: rob100 on May 29, 2013, 02:28 pm
Hi thanks for that.

As i am a beginner do you have a pic so i can see how it look like adding the TCL5940 and LED and ATMEGA328P-PU ON A BREAD BOARD. Also what is an crstal oscillator? LOL.
Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: CrossRoads on May 29, 2013, 03:06 pm
328 and TLC5940 might look like this on a PCB.  The silver cans in the middle are crystal oscillators.
This one has RS232 buffer for serial interfacing.
(http://www.crossroadsfencing.com/BobuinoRev17/dual_328s.jpg)

A pre-PCB version might look like this. This has a USB/Serial interface module at the lower left.
(http://www.crossroadsfencing.com/BobuinoRev17/piano_card_assy_small.jpg)

Some parts on a solderless breadboard might look like this
Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: fungus on May 29, 2013, 03:47 pm

328 and TLC5940 might look like this on a PCB.  The silver cans in the middle are crystal oscillators.


You need one of those and two of the brown lentil shaped things.

The full process is here: http://arduino.cc/en/Main/Standalone
Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: KirAsh4 on May 29, 2013, 07:03 pm
Another option is to go for a digital LED strip, like this (http://www.adafruit.com/products/306) or this (https://www.sparkfun.com/products/11272).  Then you only need two signal lines from your controller and you can have as many (addressable) LEDs as you want (so long as you can pump the data down fast enough.)  160 to 320 LEDs are easily obtainable.
Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: John_Smith on May 30, 2013, 03:20 am
If you use chips such as the TPIC6B595 you can drive many LEDs heres a project I have just finished with one 328 and 19 TPICs  driving 2668 LEDs    Well actually there is another 328 in the remote control .

(http://i.imgur.com/DHec7OP.jpg)
Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: CrossRoads on May 30, 2013, 03:28 am
That collection of digits looks familiar - we discussed it in the past, yes?
Each segment is 4 strings of 5 LEDs in parallel?
Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: rob100 on May 30, 2013, 03:36 am
Thanks so dose the 328 control the TPIC6B595 chip. So can 1 led flash at 4000 and other at 2000. I need to make a PCB do u have a pic of the two chips. It is for a Star Trek model the lights run a 4000 and the other light run a 2000. I just need about 11 LEDs to work. Do u know how I can make a PCB.

Step by step pls.
Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: CrossRoads on May 30, 2013, 03:50 am
The '328 controls the TPIC6B595, which is a shift register.
11 LEDs, you can control that directly from an Uno with no need for a shift register, just 11 current limit resistors.
Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: John_Smith on May 30, 2013, 04:06 am
"Each segment is 4 strings of 5 LEDs in parallel?"    

You can read that two ways :-)       its 4  ( strings of 5 LEDs )  in parallel,  not  4 ( strings of 5 LEDs in parallel  )  :-)

With red LEDs ( approx 2 Vf )  its handy to have 5 in series so with a 100 ohm resistor it can run off of a psu or a car battery .
With the odd voltage drops across the TPICs and the ribbon cable I use, I have to set the psu to about 13 odd volts to get 20mA through the LEDs, which are rated at 25mA.

Apart from orange LEDs from one particular manufacturer, which were terrible ,  I have only had about 10 LEDs fail in the last 30,000, so I keep to 20mA.

Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: CrossRoads on May 30, 2013, 04:10 am
Guess a picture is still worth that 1000 words 8)
Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: John_Smith on May 30, 2013, 04:25 am
Wait til you see the photo of the robot I am just finishing the remote controller for.

I thought it was the same giant robot that I made ( a CMOS logic ! ) remote for in 2002, but its a new smaller one, with 4 wheels 18.5 meters apart ( 60 feet )
Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: rob100 on May 30, 2013, 04:30 am
Sorry about all this thanks for your help guys.
Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: CrossRoads on May 30, 2013, 04:33 am
That's not a robot, that's a semi truck!
Title: Re: How many LED's can i use on the ATMEG328P-PU
Post by: John_Smith on May 30, 2013, 05:09 am
I have only got pictures of it in the factory, which only show a bit at a time, but they are getting it outdoors this weekend, so I should get a decent pic then.