Check my newbie circuit. Lighting leds in sequence with delay

AnalogKid

Joined Aug 1, 2013
11,043
I left all the grounds as seeds for a common ground plane. Is that not a good idea?
That's a great idea, but it is standard practice to show a ground symbol at each point for clarity. What you don't have to do is connect all of the ground points explicitly.

Almost all electronic circuits and integrated circuits function based on the assumption that the AC impedance of the power source is zero ohms. Since all connections (wires, pcb traces, whatever) are inductors that raise the apparent source impedance, it is *strongly* recommended practice to "decouple" the power source with a capacitor to GND as close as physically possible to each device's power pins. This lowers the apparent impedance right near the part. For a large IC like a uP or CPLD with several power and ground pins, place a decoupling cap near each power pin. A typical value for small signal and logic devices is 0.1 uF. For higher current parts like an audio power amplifier chip or a Pentium, a larger value or a group of parts is best, something like a 0.1 uF ceramic and a 10 uF electrolytic in parallel.
 

WBahn

Joined Mar 31, 2012
30,058
4 of each. That video I made was just to test the arduino sketch.
So if your LEDs are in parallel, you need to keep the current below 6 mA, though that is pushing the limits of both the pin and the port. Better to limit yourself to 4 mA.

A quick search on Digikey shows that Kingbright has something that looks like it should work nicely.

RED: https://www.digikey.com/product-detail/en/kingbright/APHHS1005LSECK-J3-PF/754-2123-1-ND/7319051
YELLOW: https://www.digikey.com/product-detail/en/kingbright/APHHS1005LSYCK-J3-PF/754-2125-1-ND/7319053
BLUE: https://www.digikey.com/product-detail/en/kingbright/APHHS1005LQBC-D-V/754-2122-1-ND/7319050

All of these are 2 mA, which should let you avoid needed a heat sink.

The voltages range from 1.8 V to 2.2 V, which should let you run the MCU at a lower voltage saving power and heat.

The cost in onseys is between 50 and 57 cents, with the cost for a hundred being about half that.

I don't know anything about Kingbright, but usually Digikey only stocks decent manufacturers.

You can probably start with 1.5 kΩ current limiting resistors on the LEDs and then tweak them up or down to get the desired intensity matching between them. That is probably something you will have to do by eye given human perception to light intensity of different colors.
 

dendad

Joined Feb 20, 2016
4,476
Using FETs to drive the LEDS will increase your current capability...
LedDrive.jpg

And a resistor pack in place of discrete resistors can save space.
 

Sensacell

Joined Jun 19, 2012
3,447
Using FETs to drive the LEDS will increase your current capability...
View attachment 130847

And a resistor pack in place of discrete resistors can save space.
Yes- but ditch the 1K resistors in series with the GATE lead, these don't do anything beneficial.
The 22K to ground is ok, this keeps the FET OFF before the MCU pins get configured into outputs.
 

dendad

Joined Feb 20, 2016
4,476
Yes- but ditch the 1K resistors in series with the GATE lead, these don't do anything beneficial.
The 22K to ground is ok, this keeps the FET OFF before the MCU pins get configured into outputs
Yes indeed. I forgot to say he could use transistors in place of the FETs if that was easier for him to get, hence the series gate resistors. but FEts would be my preference.
 

AnalogKid

Joined Aug 1, 2013
11,043
Per post #18, here is a single-chip circuit with no programming costs, time, whatever. If the time between turning the part off and on again is short, add a 100K resistor from Vcc to GND to discharge the capacitors more rapidly.

ak
LED-Delay-1-c.gif
 

Attachments

Last edited:

dl324

Joined Mar 30, 2015
16,918
Per post #18, here is a single-chip circuit with no programming costs, time, whatever. If the time between turning the part off and on again is short, add a 100K resistor from Vcc to GND to discharge the capacitors
That's what you proposed on day 1.

I was trying to do it with one cap and was struggling with the last half second delay.

Was the microcontroller recommended by the engineer who was hired?
 

AnalogKid

Joined Aug 1, 2013
11,043
That's what you proposed on day 1. I was trying to do it with one cap
Long ago I did a timing controller for an ambulance company with that type of circuit. One R-C ramp and (in this case) three opamps as comparators with increasing trip points. Five resistors (of four or five different values) and one cap, as opposed to three resistors and three caps, one value each. Pretty much a wash.

ak
 

dl324

Joined Mar 30, 2015
16,918
One R-C ramp and (in this case) three opamps as comparators with increasing trip points. Five resistors (of four or five different values) and one cap, as opposed to three resistors and three caps, one value each. Pretty much a wash.
I was trying to use an RC with three transistors as the OP suggested. I was trying to avoid ICs.
 

AnalogKid

Joined Aug 1, 2013
11,043
With a single timing ramp you need three trip point values somehow. Three transistors with three different zener diodes (or numbers of silicon signal diodes) in series with the bases will work, although that is a rather low impedance approach that will drive up the size of the capacitor. With a 1.5 s total ramp time, the LEDs will turn on slowly enough to notice, but each group should be fully on before the next group starts. Without some form of positive feedback somewhere the LEDs will not snap on crisply.

ak
 

WBahn

Joined Mar 31, 2012
30,058
That's what you proposed on day 1.

I was trying to do it with one cap and was struggling with the last half second delay.

Was the microcontroller recommended by the engineer who was hired?
I think the guy he hired recommended an aurduino.

I recommended a 6-pin, 30 cent PIC. Compared to the CD40106 solution you trade a 14-pin IC for a 6-pin IC (both of which are nearly identical in cost), you can ditch three timing resistors, three timing capacitors, and three transistors. Should be smaller cost and smaller footprint. Not to mention much more flexible.
 

AnalogKid

Joined Aug 1, 2013
11,043
I recommended a 6-pin, 30 cent PIC. Compared to the CD40106 solution you trade a 14-pin IC for a 6-pin IC (both of which are nearly identical in cost), you can ditch three timing resistors, three timing capacitors, and three transistors. Should be smaller cost and smaller footprint. Not to mention much more flexible.
I completely agree with all of that - except for the other things not mentioned: the time it takes to learn a programming language, the time it takes to learn a compiler, the time it takes to figure out how to configure the 6.023 zillion PIC register settings, and the cost of a programmer.

I love the PIC, but it took less time to assemble this circuit on a solderless proto board that it did to draw the schematic and convert it to postable files. Above 1000 units, the PIC approach probably makes sense. But the TS clearly is a novice; I don't think a C++ compiler is a practical solution for a small quantity design.

ak
 

dl324

Joined Mar 30, 2015
16,918
I think the guy he hired recommended an aurduino.
Hopefully that guy didn't provide him with the schematic that was posted:eek:

Instead of completely abandoning the OP's idea, I worked with what he mentioned. Resistors, capacitors, and transistors. Otherwise, I would have gone with 3 comparators, a cap, three transistors, and a bunch of resistors.

@AnalogKid's solution does have the advantage of lowest transistor count:rolleyes:. If the OP goes that route, he'll probably be back saying he built hundreds of units and the delays aren't consistent between units.
 

WBahn

Joined Mar 31, 2012
30,058
I completely agree with all of that - except for the other things not mentioned: the time it takes to learn a programming language, the time it takes to learn a compiler, the time it takes to figure out how to configure the 6.023 zillion PIC register settings, and the cost of a programmer.

I love the PIC, but it took less time to assemble this circuit on a solderless proto board that it did to draw the schematic and convert it to postable files. Above 1000 units, the PIC approach probably makes sense. But the TS clearly is a novice; I don't think a C++ compiler is a practical solution for a small quantity design.

ak
But keep in mind that this is for a product he is selling. I don't know how many units he's planning to produce -- my gut feel is not very many.

If it's low volume, my recommendation would be to hire it out to someone that could do the design and write the software and layout the PCB in a matter of hours -- a few days max for everything.

He said he makes a number of things that he sells, so investing in this kind of capability for his own purposes is probably not a bad idea -- it greatly broadens the range of things he can reasonably do and speeds the development time enormously.
 

AnalogKid

Joined Aug 1, 2013
11,043
If the OP goes that route, he'll probably be back saying he built hundreds of units and the delays aren't consistent between units.
No spec, no worries.
1% resistors and 5% ceramic or stacked metal foil caps will help. In my experience, the transition levels of CMOS Schmitt devices are surprisingly consistent, much better than the data sheets.

ak
 

dl324

Joined Mar 30, 2015
16,918
If it's low volume, my recommendation would be to hire it out to someone that could do the design and write the software and layout the PCB in a matter of hours -- a few days max for everything.
Just so the OP knows how much that might be. In the US, an experienced contract design engineer would likely charge around $250/hr; 3 days would be $6000.
 

Thread Starter

replicaprops

Joined Jul 1, 2017
28
Just so the OP knows how much that might be. In the US, an experienced contract design engineer would likely charge around $250/hr; 3 days would be $6000.
I hired a engineer in Pakistan. He supplied the schematic. He used Eagle, but I did not know how to use eagle, so I tried to duplicate the schematic in Fritzing. This is the schematic he supplied to me.
keysch.png

Obviously, I made mistake when trying to move the schematic to Fritzing, which is where the problems came up.
He also wrote me an arduino sketch, which I tested out on a breadboard and a single led per zone.
Here is the demo of the arduino sketch he wrote me.
https://www.facebook.com/replicapropscom/videos/1694983457191508/

This is the pcb I designed in Fritzing.
light up key6pin_pcb.png
I have a hotair station as well as all the tools needed to do SMD work.

He supplied 2 versions of the schematic because he was worried that the number of leds I wanted to use would be too much for 3 pins. So I used his 6pin version for the final design.

He delivered in a few days and charged me $50 for everything.
 
Last edited:

AnalogKid

Joined Aug 1, 2013
11,043
The schematic does not show any current limiting resistors for the LEDs, and all LEDs in direct parallel. That will not work. I notice that the pc board layout addresses both issues. Do you have that schematic?

ak
 
Top