Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help with 40 unique LED timing circuits

Status
Not open for further replies.

Jetranger

New Member
Hello and thank you in advance.
I'm in the brainstorming stage of designing a circuit that will control up to 40 individual LED's. Each LED will have a unique cycle time which includes the duration it's "on" and duration it's "off". (So I guess that means the duty cycle needs to be programmable for each) The 40 circuits are individually timed and not timed with each other so there is no synchronization that needs to happen between all the circuits.

I will be using standard (probably 3mm) LED's on each output... But I would like those leds to appear almost like incandescent lights when they turn on and off. So instead of switching them fully "on" or fully "off", I would like to make the change happen over a few milliseconds so it looks like a real old fashioned light bulb being switched on or off.

I would like this circuit to use relatively low power (hopefully) so I can run this from battery power. It needs to have an on/off switch (or maybe a touch plate? to toggle it) I would also like the option of including a photocell pick up ambient light and automatically adjust the brightness of all the LED's so they are not too bright at night.

For those of you who are familiar with nautical charts for mariners, these charts show markers used for navigation around costal shorelines and harbors. What I’m doing in this project is taking one of these charts and populating all the lighted markers with the appropriate color LED (red/green/clear) and creating the proper lighting cycle for that unique buoy. Since some of these charts may have 40 uniquely timed marker lights, I need to have a way to light each individual LED for the proper duration and cycle. Most of these lighting cycles are 1-10 seconds for a complete cycle and the lighted portion of that cycle is typically 2-5 seconds. This is the need to control the duty cycle of the output. I will be hanging this framed chart on the wall at a boat house for boaters to see and get a feel for the area. Since the sun may shine into that room, I would like to have a photocell adjust the brightness for day and night use. There should be plenty of room to hide the circuit behind the chart in the frame since I’m making the frame 3” deep. The charts are about 3ft square so they are good size.

I’m thinking this could be done with a PIC of some sort with many output pins. I would like to keep it simple and cost is really not critical since I will only be making 3-5 of these over the next few years. It would be nice to have a programmable solution since each chart has vastly different marker times on them. It would be slick to write the PIC program once and modify it for each individual chart as need.

Any ideas on what PIC to use would be appreciated. Also, if someone has an interest in designing the hardware or software, I would entertain that offer. Thank you! Dan
 
First of all congratulations on a well specified project!
A big improvement on the usual "I want to flash some LEDs, how do I do it?"

A PIC would be OK for this, I dont know if there are any PICs with 40 I/O pins, but you could just use two PICs.

As a first guess at how to do this, I would have a fragment of code for each output pin.
Duplicate the code fragment for each output pin to be driven (20 LEDs, 20 output pins, 20 fragments of code).
The LED flash data would be stored in the PIC in the form of a table. A separate line of data for each LED.

So for each map, the PIC code would be identical except for the data table containing the LED flash pattern data.

I am not an expert programmer, others here may have better ideas.

JimB
 
The on/off part is absolutely trivial to do with a PIC, virtually any micro controller will function just fine, for I/O pins you would use a series of latching shift registers, you just feed in the bit stream and toggle the update line and all LED's are updated at the same time, you can (depending on timing requirements) run an unlimited number of i/o lines from even the smallest of PIC's, there are many people that have created far larger LED matrix's using this method.

The dimming effect is actually the problem. It wouldn't perfectly replicate the natural brightening/dimming of a lightbulb but you could use a large value electrolytic cap paralleled with each LED to slow the on/off time, doing this in PWM (digitally) on a PIC directly would be a nightmare, I'd just use the cap method and be done with it.

I'll assume the forward current is 20ma the forward voltage is 3.5 (Typical for a bright white LED) volts and that it's driven from a 5 volt supply. If you use a 70ohm resistor for current limiting and used a capacitor of 1000u it would go from dim to bright in about 60ms, the offtime would be a bit faster as the cap could discharge into the latch as well, 1000u is pretty large but not excessively so for 5 volt caps. All values are approximate and would have to be re-figured for your exact setup, but would be extremely simple to physically construct, parts cost and programming would be minimal.


Capacitors charge and discharge exponentially though human perception of brightness is also logarithmic though so it will be a little different than a classic lightbulb on and off, but should still remain visually appealing.
 
Last edited:
Make a matrix. LEDs matrix beautifully. For the low-side driver, use a TPIC6B595 serial shift-register driver, it can handle 200 ma per channel, and only needs 3 I/O lines - data, data clock, and row latch. For the 6 high-side drivers, just connect six PNP transistors to port pins. Total I/O required for matrix: 9 pins. Total LEDs driven: 48. The PIC chip can easily do the ramp-up and ramp down using a software PWM approach, and brighten or dim the panel as well.

I would suggest an PIC18F series, but even a crummy little 14-pin PIC16F1503 like the one I'm using in the led matrix controller I built this week (no, seriously) could handle it, the switch input, and even have an A/D channel left over to read the photocell. It runs at 16 mhz off the internal oscillator, fast enough to load the shift reg and do PWM dimming without flicker. The development system costs a modest $44 from Digikey (I'm using the Pickit 3).

A 3" deep chart sounds more than generous for spacing. Biggest thing in there will probably be the batteries (though you might to consider the virtues of an inexpensive wall-mount 5V 1A usb switching regulator).

Love the sound of this project. Please tell me you are going to make the LEDs look like little buoys.
 
Why has the devil slain his grandmother?

Everybody is thinking about a problem that won't arise at all.

(if it's intendended to light up the lights in a logical way.)

Filament type lamps have a glow thread made of wolfram.

As everybody knows wolfram has a positive temperature coefficient, meaning when the lamp is turned on it's resistance is very low, resulting in a flash like lamp start returning to nominal within a split of a second. (The human eye is much too slow to see the difference.)

The moral: The devil asked his grandmother why the lamp won't "ramp up" at start and she didn't have a flimsy explanation for that. ;)

Cheers

Boncuk
 
I've measured it, it's over 100 ms for a large bulb, plenty of time to notice the ramp-up and cool off.
 
I've measured it, it's over 100 ms for a large bulb, plenty of time to notice the ramp-up and cool off.

I talked about switching it on. It will start at high current due to the cold resistance of the wire and then return to normal. Starting at high current returning to "normal" is not what I'd call "ramp-up" - possibly "ramp-down". Ramping down occurs when the light bulb is turned off, meaning it will extinguish (relatively) slowly.

There is no other way! A filament type lamp always starts up at a higher brightness than at normal (stabilized) operation.

Boncuk
 
I know all about cold filaments and inrush surge current. It takes time for the metal filament to heat up, and I've measured it, and it's a good hundred milliseconds or more.

Here, want to SEE the ramp-up? Watch this video -

 
Last edited by a moderator:
Thank you all for the great feedback. It seems like using a PIC is probably the best way to go. I would like to ask a question about using the shift register method to “create” output pins for driving each LED. I think this method makes sense but it’s over my head. I have some understanding of using shift registers to create outputs via a serial control stream but I’ve never done it myself other than in College in 1984.. ( I think the only real project I built using shift registers was a radar gun jammer that was popular in the late 1980’s… anyone remember that? It actually worked when you got close enough to the gun!! ) I looked at the Digikey site at some of the PIC developer tools like the Pickit 3 and I think I could pick one of these up and get my self educated on how they work, how to set up the physical hardware connections and how to code it to produce the light sequences I need. Could someone recommend what PIC development tool I should buy and what matching hardware board I could purchase from microchip at the same time that would be the most beneficial for the project I’m working on? Are there any online courses or tutorials that could get me started? Thank you for all the help, it’s been great! Dan
 
The PIC chip can easily do the ramp-up and ramp down using a software PWM approach, and brighten or dim the panel as well.
On 40 independent channels that aren't synchronized? In theory perhaps, only if no two channels were ever dimming at the same time the code to PWM dim multiple elements (possible in different directions at the same time) would be more than a little difficult, especially for someone that's never tried it.

Duffy's suggestion of a PICKIT3 is good way to get started, there are AVR kits out there as well such as the Arduino that will suit you needs if you want to use AVR micro controllers instead, both chip lines are very well community supported though generally more users here are familiar with PIC than AVR.

The shift register Duffy posted is a good one, actually pretty overkill for a single bright white LED but still plenty good. There's a serial in line, when you strobe the clock line it feeds the state of the serial in line to the first bit of the storage register and moves the next bit down, the serial out line is the output from the last storage register bit which allows you to feed that into another shift register for virtually unlimited array lengths. When you strobe the update line it moves the contents of the input register to the output register and updates the outputs, so you feed it all the data it needs then hit the update strobe and all I/O lines update instantly.
 
Status
Not open for further replies.

Latest threads

Back
Top