Please help me understand this circuit - Page 1
Forum section: electronics / beginners

author: Moriambar
author_rank: Unknown
timestamp: January 26, 2019, 04:56:07 pm
content: Hi.I was searching for a circuit to be able to slowly turn up an LED (increasing the current) by pressing a pushbutton. I wanted to opt out microcontrollers since it seems kind of overkill for this simple project. Nevertheless I stumbled upon the circuit in black in the picture below. It works perfectly. Then I thought of adding a second LED and added basically the green part. The funny thing is that now only one of the two LEDs work, still displaying the correct behaviour.So I think that I kinda do not understand what's going on, and cannot figure it out. Why is the second led off? Does this hide some deep hole in my knowledge which I'm not aware about?Also as a bonus: when I power the circuit off, a residual voltage/charge stays on the cap and it's enough to make the LED bright for a long time. How can I safely (if possible) discharge the cap when the switch is open?Cheers

author: JackJones
author_rank: Regular Contributor
timestamp: January 26, 2019, 05:02:42 pm
content: Different coloured leds have different forward voltages. Red leds have the lowest, usually about 1.8ish volts, while green and blue are closer to 2.5v. So if you have for example a red led in parallel with a green one, the voltage across both the leds will be the forward voltage of the red led, 1.8v. Too low to turn the green on.If both the leds had the same forward voltage, both of them would light up. If you want both of the different colours to light up, you should use a separate resistor for both of them

author: IanB
author_rank: Super Contributor
timestamp: January 26, 2019, 05:08:47 pm
content: In general you cannot put two LEDs in parallel unless they are completely identical. If there is any imbalance in the properties of the diodes then one diode will take more current than the other and they will not share current equally. You could fix this problem by having two resistors, one per LED.To discharge the capacitor when the switch is open I think you need a second transistor. You could put a PNP transistor across the capacitor to discharge it (with a current limiting resistor). When the switch is pressed you would pull up the PNP base through a base resistor, which would turn the PNP off and let the capacitor charge up. When you release the switch the PNP would turn on through a base pull down resistor and discharge the capacitor.

author: Moriambar
author_rank: Unknown
timestamp: January 26, 2019, 05:25:38 pm
content: Quote from: IanB on January 26, 2019, 05:08:47 pmThanks. So the led being a bit different do not exhibit the same behaviour and current prefers one. Indeed the two-resistor solution works.Regarding the pnp discharging solution: The pull-up has to be stronger than the pull-down, right?Cheers

author: Moriambar
author_rank: Unknown
timestamp: January 26, 2019, 05:28:21 pm
content: Quote from: JackJones on January 26, 2019, 05:02:42 pmThey are both red LEDs. I think they're not from the same batch though or have small differences that make them not light up together.Cheers

author: Richard Crowley
author_rank: Super Contributor
timestamp: January 26, 2019, 05:40:06 pm
content: Identical performance even in two LEDs from the same batch would be rather surprising because of slight differences that are normal in mass production. Ideally, each LED should have a current-limiting resistor with a value selected for the desired behavior. Hard-wiring LEDs in parallel is essentially the "worst-case" for powering multiple LEDs.Do you have enough supply voltage to connect the LEDs in series instead of parallel? That would at least ensure that the same current was going through each LED. That is a very common scheme used for LED replacement gadgets that operate on high voltages (like LED light bulbs that operate on mains voltage, etc.)Changing the current through an LED is not a popular way of controlling light output. Again, because of slight differences between LEDs, it is difficult to get consistent results. That is why PWM is commonly used for controlling LED brightness.

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: January 26, 2019, 05:59:32 pm
content: You can put the LEDs in series... and reduce 720R.

author: Zero999
author_rank: Super Contributor
timestamp: January 26, 2019, 06:08:10 pm
content: Quote from: Moriambar on January 26, 2019, 05:28:21 pmThey might have slightly different wavelengths which will cause them to have different forward voltages. Try powering them up, each with its own series resistor to do a side by side comparison. Are they exactly the same colour and brightness? If not, it's even more likely you have totally different parts. Even if they look the same, there can still be enough difference in the semiconductor junctions to make only one of them light, when connected in parallel.Another issue with that circuit is the sharp turn on of the BJT. Try this which will ramp up more slowly.And please don't post monster image files. Spend the time to do a little image processing to get the size down. I made the attached schematic from your file by converting it to monochrome and scaling it down to a sensible size.

author: IanB
author_rank: Super Contributor
timestamp: January 26, 2019, 06:15:58 pm
content: Quote from: Moriambar on January 26, 2019, 05:25:38 pmYes. The pull down resistor has to be a small enough value to turn the PNP on when the switch is open. The pull up resistor has to be smaller than the pull down resistor so that it pulls the base high and turns the PNP off.

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: January 26, 2019, 06:25:31 pm
content: Quote from: Moriambar on January 26, 2019, 04:56:07 pmReduce C by some orders of magnitude :-)

author: Moriambar
author_rank: Unknown
timestamp: January 26, 2019, 06:34:45 pm
content: Thanks to all.I understand what you say about the LED differences. I will try Zero999's circuit tomorrow and then try to tweak values etc.Sorry for the monster image file.

author: Moriambar
author_rank: Unknown
timestamp: January 26, 2019, 06:37:10 pm
content: Quote from: Richard Crowley on January 26, 2019, 05:40:06 pmPardon my noobeness, but if the slight differences are what prevent us to get consistent results, then how does PWM give consistency?

author: Richard Crowley
author_rank: Super Contributor
timestamp: January 26, 2019, 07:17:00 pm
content: Quote from: Moriambar on January 26, 2019, 06:37:10 pmThe LEDs are driven to a consistent point in their operating range, and then "chopped" in time which is very consistent and repeatable.If you had a reliable way of measuring brightness, you could experiment by drawing voltage/current vs. brightness curves for various LED examples.

author: MarkF
author_rank: Super Contributor
timestamp: January 27, 2019, 07:32:08 am
content: If you use a SPDT switch, you can control both the turn on time (via R1) and the turn off time (via R2).Maybe start with R1=10K, R2=1K and C1=100nF.ORJust add a resistor in parallel with the capacitor in your original circuit.You would need to keep in mind the series current when the switch is on if you do this.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: January 27, 2019, 08:13:52 am
content: I've added an PNP transistor and a resistor to drain the 1mF capacitor when the switch opens.I've also attached the project in KiCad format.So instead of everybody re-drawing the whole thing you can take this project, modify it a bit and post a screenshotKiCad is fully Free and Open Source Software. No hidden agenda's, no misty stealing of your intellectual property, no artificial limits on for example board size or number of pins. No limited time edition.And it is being improved significantly every year. Do not believe a 2 year old review

author: Zero999
author_rank: Super Contributor
timestamp: January 27, 2019, 10:10:08 am
content: Quote from: Doctorandus_P on January 27, 2019, 08:13:52 amI haven't used KiCAD for a couple of years. The last time was a total fail. I tried to open a project posted by someone else here and it mangled it badly because the libraries on my install were different to theirs.Originalhttps://www.eevblog.com/forum/beginners/best-way-to-amplify-a-sine-wave-without-distorsion/msg1125940/#msg1125940What it looked like when I opened it.https://www.eevblog.com/forum/beginners/best-way-to-amplify-a-sine-wave-without-distorsion/msg1126604/#msg1126604I don't have KiCAD installed on this machine and will try opening your attachments later.

author: Moriambar
author_rank: Unknown
timestamp: January 27, 2019, 11:47:18 am
content: Quote from: MarkF on January 27, 2019, 07:32:08 amthanks, the spdt switch was actually one of the original ideas, but I was trying to build it without it, something more "automatic" in order to have a temporary pushbutton instead of a proper switch.Nice idea though

author: Moriambar
author_rank: Unknown
timestamp: January 27, 2019, 11:49:56 am
content: Quote from: Doctorandus_P on January 27, 2019, 08:13:52 amthanks, I'll try this as soon as I can

author: Doctorandus_P
author_rank: Super Contributor
timestamp: January 27, 2019, 12:45:27 pm
content: Quote from: Zero999 on January 27, 2019, 10:10:08 amKiCad has had it's share of bumps but inconsistencies are getting less.KiCad has now reached V5 late last year which was a very big improvement, but as a consequence incompatibilities with some hardware have turned up, wich is why it's been bumped to V5.0.2 pretty fast after V5.0.The little project above is made with only standard symbols from the library (which has expanded enourmously in the last few years, Even DigiKey is making libraries for KiCad).https://www.digikey.com/en/resources/design-tools/kicadIn the zipped file there is a -cache.lib in which the symbols which are used in the schematic are cached. So as long as you distribute this file with your project, the mess you showed should not happen anymore.

author: MarkF
author_rank: Super Contributor
timestamp: January 27, 2019, 03:45:59 pm
content: Just a note to forgo any confusion.I use:mF == milliF == 10-3uF == microF == 10-6nF == nanoF == 10-9pF == picoF == 10-12

author: MarkF
author_rank: Super Contributor
timestamp: January 27, 2019, 03:54:36 pm
content: Quote from: Moriambar on January 27, 2019, 11:47:18 amYou do know they makemomentarySPDT switches?Example:https://www.mouser.com/ProductDetail/E-Switch/FS5700SPMT2B2M1QEH?qs=sGAEpiMZZMvxtGF7dlGNpp%252bW2sLS6zO28qxKefzNuxg%3d

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: January 27, 2019, 08:10:52 pm
content: Quote from: MarkF on January 27, 2019, 03:45:59 pmµF == microF == 10-6

author: MarkF
author_rank: Super Contributor
timestamp: January 27, 2019, 08:27:01 pm
content: Quote from: GeorgeOfTheJungle on January 27, 2019, 08:10:52 pmYes. But, trying not to use special characters.

author: Audioguru
author_rank: Super Contributor
timestamp: January 27, 2019, 08:39:28 pm
content: All the cheap Chinese LED flashlights that use 24 white LEDs have all the LEDs in parallel and they all look to be at the same brightness. Do they hire somebody to test them all and sort them into matched piles?

author: Richard Crowley
author_rank: Super Contributor
timestamp: January 27, 2019, 08:47:12 pm
content: Quote from: Audioguru on January 27, 2019, 08:39:28 pm1) Machines on the assembly line sort the dice into brightness "bins". All semiconductors go through extensive testing on the line. LEDs are no exception.2) Those dice only appear to be"matched" at the beginning of their brief life-span. Watch a few videos from BigClive to see how well they fare over the longer term.