Dimming LEDs relative to ambient light circuit help?

Hi all, I'm just getting into lighting circuits which are more involved than led, resistor, battery. I need to build an LED circuit using 9v input, operating 20 LEDs (forward voltage 3.2v, 20mA) at 60% brightness at low light levels, and ramps up to full power at higher light levels (IE sunlight). I was thinking this might be possible with a phototransistor alongside the LED loop but could really use a schematic for what other components are necessary, the order to assemble them, and what I need to be careful of as far as variables in component selection. If you're an expert and can't help with a circuit sketch I'd still love to hear any ideas or tips.

It doesn't seem to be a very standard assembly and piecing together circuits from similar tutorials doesn't seem like its going to get me anywhere fast with my currently limited understanding of the gritty details. I really appreciate any help.

by logan74k
October 21, 2017

I'd use pwm (pulse width modulation) because this runs the leds at constant current and is really linear down to very low pulse widths. You could have two photo sensors, one looking at daylight and one looking at a led, and integrate the difference to control the pulse width.

by mikerogerswsm
October 21, 2017

Thanks. One issue is I need the whole circuit to fit in essentially a 1x1x.25 inch space (except the LEDS of course)

Also, I'd still need somebody with excellent knowledge to show me what that circuit would look like, not to mention the coding it requires.

I'm hoping it can be done low-tech for expediency considering the extra front end work with a controller.

by logan74k
October 22, 2017

I would suggest with this space limitation you need to consider switching between a small number of light levels. If you use a photo-transistor and resistor to sense the ambient light level, and a dual comparator to switch up the led current, then you have three levels of brightness. You need a couple of trimpots to set the switching levels and a couple of fets to drive the heavy currents.

by mikerogerswsm
October 22, 2017

2 Answers

Answer by logan74k

Well, it sounds like a good idea!

+1 vote
by logan74k
October 22, 2017

Answer by mikerogerswsm

Ok,here's a very rough schematic, please note that all parameters are guesswork at this stage, you will need to work them out by calculation or experimentation. https://www.circuitlab.com/editor/#?id=fk2s5mbfwup5 I'd suggest you connect your leds in ten parallel columns of two in series, represented here by a single led. I read you as new to electronics, so you may need some help with practical matters like soldering. Try to contact a local person like a radio ham for advice and help.

+1 vote
by mikerogerswsm
October 23, 2017

Depending which comparators you choose to use, you may need to add a 10k pull-up from each output to supply. Also about 1 Megohm positive feedback from each output to + input.

by mikerogerswsm
October 23, 2017

The positive feedback resistor could go from each FET drain to the - input of the associated comparator. This produces better defined backlash. Still use about 1 Meg.

by mikerogerswsm
October 24, 2017

But I really think pwm is a good way to go. Here's a man explaining how to do it. You need to add a front end (photo device and resistor) and a back end (fet and current limiting resistor) to drive your diodes. https://www.youtube.com/watch?v=YmPziPfaByw and https://www.youtube.com/results?search_query=pwm

by mikerogerswsm
October 25, 2017

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.