Why this transistor is not working as a switch?

I am trying to figure out a circuit of a camping lamp. When the lamp is connected to AC 230v it should pass the current to battery and not to the LED array thus charging the battery and as soon as the AC power is disconnected the LED should lit from the battery power. I tried to simulate the circuit with Falstad and everything works fine except when the AC is connected the LED array still lit up. I need help to figure out whether is there any problem with my diagram or is it a quirk of simulator?

Please click here to check the simulation and try switching ON and OFF by pressing the switch on AC power input.

Transistor (KEHE D9 CU) base is connected to LED negative terminal. I think this transistor should act as the switch and do the trick but unfortunately it doesn't work in simulator.

I've attached the actual picture of the PCB to compare with the diagram if you needed.

by Ahsan007
August 17, 2022

I think that you didn't share (public) the circuit that you referred to through the url associated to "click here" in your text.

by vanderghast
August 17, 2022

Thanks @vanderghast, seems tinyurl's aren't allowed.

Please visit https:// tinyurl .com/2qu4eaj7 for the simulation.

NOTE: copy the link and remove the spaces, it's not showing the link if typed fully.

by Ahsan007
August 18, 2022

In the PCB the resistor connected with the indicator LED is burned out that the color code isn't visible, I tried scratching the burnt resistor by the middle and measured the value and it shows around 800k so, 1.6M resistor should be connected but seems if I connect such a big value resistor then the current won't be enough to even light the indicator LED. Now I've replaced it with a 100 Ohm resistor, would it be enough? Coz, when the lamp is connected to the AC indicator LED doesn't light up. When connected to DC power it works. 6V DC input is connected parallel to the 100uF capacitor which I haven't included in the simulator but you can see the lead dots right above the polarized capacitor in the picture where I've marked with symbols.

by Ahsan007
August 18, 2022

No Answers

No answers yet. Contribute your answer below!


Your Answer

You must log in or create an account (free!) to answer a question.

Log in Create an account


Go Ad-Free. Activate your CircuitLab membership. No more ads. Save unlimited circuits. Run unlimited simulations.

Search Questions & Answers


Ask a Question

Anyone can ask a question.

Did you already search (see above) to see if a similar question has already been answered? If you can't find the answer, you may ask a question.


About This Site

CircuitLab's Q&A site is a FREE questions and answers forum for electronics and electrical engineering students, hobbyists, and professionals.

We encourage you to use our built-in schematic & simulation software to add more detail to your questions and answers.

Acceptable Questions:

  • Concept or theory questions
  • Practical engineering questions
  • “Homework” questions
  • Software/hardware intersection
  • Best practices
  • Design choices & component selection
  • Troubleshooting

Unacceptable Questions:

  • Non-English language content
  • Non-question discussion
  • Non-electronics questions
  • Vendor-specific topics
  • Pure software questions
  • CircuitLab software support

Please respect that there are both seasoned experts and total newbies here: please be nice, be constructive, and be specific!

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.