Author Topic: Dark Circuit very dim LED on PCB brighter on breadboard  (Read 896 times)

0 Members and 1 Guest are viewing this topic.

Offline fschuetzTopic starter

  • Newbie
  • Posts: 7
  • Country: ch
Dark Circuit very dim LED on PCB brighter on breadboard
« on: November 13, 2023, 10:59:46 pm »
EDIT: Embedded images do not show. I put the schematic and pcb as attachment.

Hi

I created a circuit that should switch a led on if it gets dark. The design is powered by a LiPo battery which is charged by a solar panel. The main circuit is the standard resistive divider with an LDR that drives the base of a NPN transistor to switch the current through the LED - Collector - Emitter path. There are two other parts to the circuit, the solar charging circuit around a CN3791 Standalone Li-ion Battery Charger IC With Photovoltaic Cell MPPT Function and the protection circuit around a FS312F-G Standalone Li-ion Battery Charger IC With Photovoltaic Cell MPPT Function. See schematic below for details:
https://drive.google.com/file/d/12_YMz7QGEUaEKRMuqhE5P9pmQOAl4V40/view?usp=share_link


I built this circuit in the pas without a switch and a little different layout on the pcb. It seemed to work fine. Now with my newest pcb the LED is very dim. As mentioned before the change in the design is that I now use a switch and I also use a green led this time (forward voltage of 2.2V an I_F = 20mA according to datasheet). Before I used a white LED with a forward voltage of 3.2V and I_F=30mA according to datasheet.
To check I built the "dark switch led" part on a breadboard using the same resistor values as on the pcb and the same transistor ([2N222A](https://www.onsemi.com/pdf/datasheet/p2n2222a-d.pdf])) and LDR (GL5528). When powering it on the breadboard, the LED is brighter than on the PCB. I did some measurements and it turns out, that in the pcb variant, the voltage at the base of the transistor is 640mV, while at the base of the transistor on the breadboard the voltage is 680mV. I don't understand where this difference comes from? Also I don't understand why both values are not higher, as the LDR in dark conditions should have > 40MΩ which should result in a 3.59V given a 3.6V battery?
I did further measure the Voltage at the output of the switch (V_s), the voltage between R3 and the led D1 (V_r) and between the led D1 and the transistor Q1 (V_l). The results for the pcb variant were:
V_s = 3.72V (same as on battery +)
V_r = 3.68V
V_l = 1.88V
and for the breadboard variant they were:
V_s = 3.72V
V_r = 3.64V
V_l = 1.6V
as 3.56V (same as measured directly at battery +) on the pcb (and set the input voltage on the breadboard to the same value) and I also measured the Voltage between R3 and the LED as XX on the pcb and YY on the breadboard.

Last but not least, I decided to put the switch to off and inject power on the pcb at the output of the switch from the power supply channel 1 and at the same time supply the same power on channel three to the breadboard to have a direct comparison of the difference in intensity.
https://drive.google.com/file/d/1cHRC__eyKLTeTMRTx2Gdkkvw4yJd-HR7/view?usp=share_link


The psu shows that the pcb circuit only draws XX mA while the breadboard variant draws YY. I also noticed, that when switching the PSU off, the LED on the pcb variant fades and the LED on the breadboard is immediately off.
https://drive.google.com/file/d/1Itv2TXeDHXTARo58N_a3yxGdbgzQAFkH/view?usp=share_link


Do you see where I made a mistake and can you help me understand the problem - or also just give hints how to test further. I would appreciate that a lot.

I attached the PCB layout and datasheets below.

Thank you

https://drive.google.com/file/d/1Itv2TXeDHXTARo58N_a3yxGdbgzQAFkH/view?usp=share_link

« Last Edit: November 13, 2023, 11:08:17 pm by fschuetz »
 

Offline srb1954

  • Super Contributor
  • ***
  • Posts: 1110
  • Country: nz
  • Retired Electronics Design Engineer
Re: Dark Circuit very dim LED on PCB brighter on breadboard
« Reply #1 on: November 14, 2023, 12:33:52 am »
The first thing to look at is the base drive current to transistor Q1. The value of R1 is too high to allow enough base current to fully turn on Q1, especially with a relatively low gain transistor like a PN2222A. Typically you need to ensure that the base current is greater than Ic/20 to ensure that the transistor is fully saturated  with the lowest possible collector-emitter voltage.

You need to work backwards from the desired LED/collector current, divide that collector current by 20 to get the required base current, and decrease R1 sufficiently to obtain the necessary base current with the battery at its lowest level. Using a PN2222A you will likely need to reduce R1 by a factor of about 30 to ensure sufficient base current.

Having a low value of R1 may not work with the chosen CdS cell as it may not have a low enough on resistance to ensure that Q1 is fully switched off under full light conditions. If you can't reduce R1 enough you need to increase the current gain of the transistor substantially by using a compound Darlington pair or Sziklai pair.  Both have extra collector-emitter voltage drop so the LED current limiting resistor may need to be adjusted to compensate.

A better solution might be to substitute a small low-threshold voltage MOSFET for the PN2222A if you need to keep R1 high to work in with your chosen CdS cell. It will be important to check that sufficient gate voltage is supplied to the MOSFET to keep it fully turned on in the dark condition and the gate voltage is clamped sufficiently low to ensure that the MOSFET is fully turned off in the lit condition.
 

Offline fschuetzTopic starter

  • Newbie
  • Posts: 7
  • Country: ch
Re: Dark Circuit very dim LED on PCB brighter on breadboard
« Reply #2 on: November 14, 2023, 06:56:16 am »
Thank you for your quick and thorough reply. I experimented with the resistor value and ran exactly in the problem that it did not switch off anymore. I will consider your suggestions and do some more experimenting. Some follow up questions if you allow, as I would like to better understand what is going on:

1. Why do you think there is this difference at the base voltage between the breadboard setup and the pcb setup, even though the voltage from the power source (on the pcb after the switch) is the same and the voltages at the other measurement points are very similar?
2. Why is it, that the LED on the pcb dims and goes of if I inject power from the psu and switch it off and on the breadboard it directly goes off (my expectation is that the caps of the charging circuit buffer some energy, but as I inject power after the switch and the switch is off, they should not see power?
3. Using a MOSFET would also have the upside, that the current across the high resistor value is still low and therefore discharge when the led is off is minimal (compared to using lower value resistor and LDR on the resistive divider for the base of the transistor), right?
4. I am also a little confused on the base voltage. The divider should result in a higher voltage, however, the measured voltage is much lower. Is  this because the transistor starts to switch on and the voltage drops across the Base - Emitter path on a transistor?

Best,
Florian
« Last Edit: November 14, 2023, 07:05:42 am by fschuetz »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19776
  • Country: gb
  • 0999
Re: Dark Circuit very dim LED on PCB brighter on breadboard
« Reply #3 on: November 14, 2023, 08:45:20 am »
The problem is this circuit depends on the base-emitter voltage and hFE, which vary considerably, from part to part and different temperatures.

It it possible to get better results by adding another transistor, but it's easier to use a comparator such as the LM393 or LM311, with a little hysteresis, so it doesn't oscillate.
 

Offline fschuetzTopic starter

  • Newbie
  • Posts: 7
  • Country: ch
Re: Dark Circuit very dim LED on PCB brighter on breadboard
« Reply #4 on: November 17, 2023, 04:54:38 pm »
Thanks for your reply. I was also thinking tolerances in parts, this is why I soldered other resistors and the transistor. However, I measured again exactly 640mV. Also brightness was comparable to the old parts. So I assume, its a layout thing (coupled with part tolearances)?

The fading of the LED on the PCB if power is injected I would explain as such: I inject power after the switch (which is off). Therefore, the charging circuit and battery protection circuit are not connected. This leaves the caps positive pole floating. However, ground is connected to the PSU ground. This induces a charge in the caps that leads to the glowing. Is that assumption correct? Would that mean that after switching the PSU off, gorund goes into negative voltage (compared to the rest of the circuit) as plus of the caps is not connected and in order for a current to continue flowing, ground must be lower than the point after the switch (which goes to 0V when the PSU is switched off)?

Answering these questions is really more to allow me understand and learn. I understood the suggestions from the answers and will implement them, thank you very much.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19776
  • Country: gb
  • 0999
Re: Dark Circuit very dim LED on PCB brighter on breadboard
« Reply #5 on: November 17, 2023, 10:17:06 pm »
A single transistor is a crappy way to do this. It will work, but is not very reliable.

Here's a comparator circuit, which is much more reliable.

If stand-by power consumption is a problem, then use a low power comparator IC, rather than the LM393 and higher value resistors.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf