Ldr circuit using 2n2222 and resistors not working

Thread Starter

Earton

Joined Jun 7, 2025
5
Ultimately I am trying to make a solar garden light. I have googled until I am going crazy, any advice would be very much appreciated.
My components are
1. LiitoKala NCR18650B 3.7V 3400mAh Li-ion protected battery
2. CN3791 MPPT Solar Charger (for single-cell Li-ion, with 9V version)
3. 9V 2W Solar Panel
4. 1W 3V High Power White LED (mounted on a star heatsink)
5. LDO6AJSA (30-1500MA Adjustable Constant Current LED Driver DC 3.3V 3.7V 4.2V 5V PWM Control Board Buck Power module EGBO) pwm pin has been connected to vin
6. Photoresistor (LDR) resistance dark 9k ohms resistance light 250 ohms
7. NPN Transistor ( 2N2222. Ebc )
8. Resistors: I have a selection but started with
• 10kΩ (LDR voltage divider)
• 1kΩ (base resistor for transistor) then tried 220 as diagram
I have tried several diagrams found on the internet, using the attached diagram the led (just a 5mm red led for testing) was lit and covering ldr made no difference. I then tried changing the 10k resistor for a 1k resistor. I also asked AI which told me to switch the fixed resistor and ldr ( so v+ ldr fixed resistor to ground. This sort of worked with led going off in very bright light but on in ambient light. Changing resistor values did not help it was still on in ambient light.
As I am sure is clear by now I am a beginner and this was supposed to be a fun project with the kids and is now a life mission
Thanks
 

Attachments

ericgibbs

Joined Jan 29, 2010
21,391
hi Earton,
This is a simulation of your circuit,
It should work reasonably well.

E

Update: post a photo of your circuit build, we can check for accuracy.


EG 1516.png
 
Last edited:

Thread Starter

Earton

Joined Jun 7, 2025
5
I tink I have now put the resistor as per suggestion. Tried red led and the led with driver that I want to use in the end, both stay lit whether ldr is covered or not. I checked voltage at the base of the transistor and with the ldr covered or not voltage was 0.69. My bread board and wires are very old and I am not 100% sure that’s not my problem.
Thanks for looking
 

Attachments

ericgibbs

Joined Jan 29, 2010
21,391
Hi Earton,
With the 220R in the collector, this is what the circuit shows, it should work OK.
ie:
when the LDR is covered, it is a high resistance [ try a piece of black tape] the Red LED should light.
If you shine a light on the LDR it should be a low resistance and the LED should be not lit.

I have added the Vbe voltage plot to the image to show you what voltage you should see on the Base to Emitter.

E

Do you have a Part Number for the LDR ??

Update: confirm that the 10K is an actually a10k resistor, [ post the colour code] also try a 22k resistor

EG 1520.png
 
Last edited:

ElectricSpidey

Joined Dec 2, 2017
3,312
Simple circuits like this can sometimes be difficult to get the components just right, may be best to add a comparator.

Personally, if I were building this, I would use a comparator with hysteresis and a MOSFET.

There will be times during the day where that transistor will have to dissipate some pretty good wattage driving that 1 watt LED. I think you might want something more digital.

And don't neglect a good heatsink for that LED, that "star" is only a spreader.
 

ericgibbs

Joined Jan 29, 2010
21,391
hi Ear,
With a 10K in series with 250R [ LDR illuminated], powered by 3.7V, you will get ~ 90mVolt.

In order to get 0.65V on the base the LDR resistance will be approx 2.5k.

In post #7 plot, the On/Off range is approx 3k.

E
 

ElectricSpidey

Joined Dec 2, 2017
3,312
Keep in mind if you do work out a divider with a high value "upper" resistor for your low power red LED that will never work with a 1-watt LED because it won't provide enough base drive.

So, you will need another stage.
 

crutschow

Joined Mar 14, 2008
38,322
Below is the sim of a circuit using two complementary transistors to drive the high current of the 1W LED, along with giving a sharper transition by adding some positive hysteresis feedback (R5) to avoid staying in the linear region:
R1 is the LDR.

1749432708119.png
 
Last edited:
Top