Author Topic: Driving LEDs cheaply (school time machine project)  (Read 4507 times)

0 Members and 1 Guest are viewing this topic.

Offline StonentTopic starter

  • Super Contributor
  • ***
  • Posts: 3824
  • Country: us
Driving LEDs cheaply (school time machine project)
« on: June 22, 2014, 02:48:48 am »
This is related to my time machine display project for my wife's school. Which you can read more about here: https://www.eevblog.com/forum/projects/time-machine-display-for-my-wife's-school-ideas-needed/

I'm trying to come up with a cheap way to blink a variety of LEDs as cheaply and with as a few components as possible.
I'll be using some kind of MCU as the brains behind it. These LEDs will most likely be all 5mm in different colors.
Ideally I'd like to be able to do some other things with the MCU while it's blinking these LEDs and I will be driving some 7 segment displays separately unrelated to this part of the circuit.

The total number of LEDs I guess depends on budget and usage of pins. The more I can drive, the better. If using a 2N3904 and 2N3906 on the same pin will let me alternate between two LEDs, I might go that route to double my LEDs.

I would say in order of importance:
1. Cost
2. Low part count
3. Ease of implementation
4. Conservation of MCU pins

I'll be ordering all my parts from Tayda unless I absolutely have to get something they don't have.

These are my TAYDA part contenders:

74HC164 S > P non-latching   - $0.21 each
CD4511BE BCD to 7 Seg      - $0.23 each
M74HC595B1R S > P latching   - $0.25 each
2N3904 NPN          - $0.02 each
2N3906 PNP          - $0.02 each
8550SL PNP 20V 0.7A      - $0.02 each
1/4W Resistor (Most Values)   - $0.01 each
Ceramic Caps         - $0.01 each
Film Caps         - $0.03 each
Electrolytics         - $0.03 to $0.04 each


I'm guessing an update interval of maybe 250ms and the input for these doesn't need to be technically controlled, I mean I could just easily have it spew random garbage off a few MCU pins and have the chips interpret it in some way and change the lights.

I could live without latching unless there was an easy way to allow myself to hold the pin states until changed on the shift register or BCD decoder and we're assuming I already have the LEDs.

I have 2 pins on the MCU which will be constantly flipping from + to - and back (to drive the analog clock to spin quickly backwards) and I can invert and hold their state as quickly as every 18ms (that's the fastest I can go and have the clock respond) in case I might be able to steal that signal for a clock on the shift register if we go that route.

We'll assume a max budget for this part of the circuit using the parts above of $1.50.

Conservation of MCU pins would be nice, so stacked shift registers might be a good idea, but can the BCD to 7 seg handle LED current directly without a transistor?

What do you think? I'll probably be ordering the parts tomorrow evening since I have a discount code that expires then.
« Last Edit: June 22, 2014, 03:07:26 am by Stonent »
The larger the government, the smaller the citizen.
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4319
  • Country: us
  • KJ7YLK
Re: Driving LEDs cheaply
« Reply #1 on: June 22, 2014, 03:07:27 am »
I think that those RGB LEDs with built-in shift-register drivers are ABSOLUTELY BRILLIANT for projects as you are describing.  They are remarkably inexpensive (<<$1 each) and they require no more than power and ground, and a single serial port from your controller.  I can't imagine how it could be any simpler than that!

They are available in very flat packages (5mm square), in "conventional" 5mm and 8mm round "bulb shape", and already built into all manner of "ribbon", linear, circle, and matrix arrays ready to use.  Anything else is just horribly fiddly and clunky by comparison.

         

         

https://www.adafruit.com/category/168

I have several of these on order for some of my own projects.
 

Offline StonentTopic starter

  • Super Contributor
  • ***
  • Posts: 3824
  • Country: us
Re: Driving LEDs cheaply (school time machine project)
« Reply #2 on: June 22, 2014, 03:25:31 am »
Yeah those would be nice, but they are a budget killer. I'm trying to keep the whole thing under $20 and we've already spent about half that. 

It looks like the majority of this half of the budget will be eaten up by switches unfortunately.
The larger the government, the smaller the citizen.
 

Online mariush

  • Super Contributor
  • ***
  • Posts: 5137
  • Country: ro
  • .
Re: Driving LEDs cheaply (school time machine project)
« Reply #3 on: June 22, 2014, 11:01:50 am »
A 1-2$ PIC with lots of outputs (let's say a 40DIP with 28 output pins) or a basic 0.4$ 8pin PIC and a few shift registers (basically unlimited leds driven from the mcu).
ULN2803A - seven transistors into a single package with a resistor on each base (because a mcu can do up to 20-30mA but only 100-200mA through all pins which may not be enough to power 20 leds, same for shift registers)
some resistors to limit current going to each led, or resistor networks like this one which are a bit more expensive than 8 separate resistors but take less space (and let's be honest, they'll make the pcb looks sexier).

 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1433
Re: Driving LEDs cheaply (school time machine project)
« Reply #4 on: June 22, 2014, 11:53:17 am »
No Transistors, No driver IC's. You can drive a x-Y row-column matrix of LED's simply using 74HC164 or 74HCT164's with only one resistor per output pin (100-ohm). With just two 74HC164's you can drive approx 64-LED's without a problem. With 4 units 74HC164 you can cascade them and drive up to approx. 65535 LED's using 16 resistors total. The digital data can light up any number of rows or columns at once, with somewhat varying degrees of brightness, but this just serves to increase the entertainment of the display.

Total cost for 64-LEDS, incl. all LED drivers and their resistors < $1 plus the cost of the 64-LEDs.  A  cheap .1uf capacitor is required at the VDD-VSS pins if the 7-Seg display is not so close to the power supply and MCU feeding it data.

I have used this technique extensively with many projects driving 7-Seg displays (incl. the d.point.) and I know it is reliable and requires only four wires to drive a remote display: clock, data, (+5 to 6.5V) and a common ground.

I have used a single 7-Seg display as an alphanumeric "ticker tape" display and this requires only 1 74HC164 a7-Seg display and one 220-ohm resistor. One can read the message easily after they "get" the idea that there is a message being displayed serially. This method can fascinate and intrigue any observer with a little patience by arousing their curiosity about the "cloaked" content of a long serial message. If I use two to 6 displays serially connected then the ticker-tape display is more easily readable, but I can update them in much less than 1-mSec (even though there is no storage in a 74HC164 during update) and so no flicker is visible, even while multiplexing each display serially with software.

The fact is that a 7-Seg display can spell out almost any message to an interested observer. and even if a 7-Seg has real trouble displaying certain letters, this  only adds to the entertainment, forcing the reader to guess.
 
« Last Edit: June 22, 2014, 03:35:58 pm by Paul Price »
 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1433
Re: Driving LEDs cheaply (school time machine project)
« Reply #5 on: June 22, 2014, 01:38:06 pm »
You can also use the row-column technique I described with LED's in inverse parallel (with paired LEDs of different colors), so you can drive up to approx. 128 LED's with two 74HC164's.
 

Offline StonentTopic starter

  • Super Contributor
  • ***
  • Posts: 3824
  • Country: us
Re: Driving LEDs cheaply (school time machine project)
« Reply #6 on: June 22, 2014, 03:20:14 pm »
A 1-2$ PIC with lots of outputs (let's say a 40DIP with 28 output pins) or a basic 0.4$ 8pin PIC and a few shift registers (basically unlimited leds driven from the mcu).
ULN2803A - seven transistors into a single package with a resistor on each base (because a mcu can do up to 20-30mA but only 100-200mA through all pins which may not be enough to power 20 leds, same for shift registers)
some resistors to limit current going to each led, or resistor networks like this one which are a bit more expensive than 8 separate resistors but take less space (and let's be honest, they'll make the pcb looks sexier).

I had thought about transistor packages but still couldn't beat the cost of a 3904 or 3906.

I have several MCUs available, mostly Atmel. A tiny45 and tiny85, a few mega328p chips, a mega32, a mega128, a few Tiny2313s, a few MSP430s, and some TI Launchpad boards.
The larger the government, the smaller the citizen.
 

Offline qno

  • Frequent Contributor
  • **
  • Posts: 422
  • Country: nl
Re: Driving LEDs cheaply (school time machine project)
« Reply #7 on: June 23, 2014, 05:37:49 pm »
Search on google for "Charlyplexing"
Why spend money I don't have on things I don't need to impress people I don't like?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf