Ambient Light To Frequency Circuit

Thread Starter

dcbingaman

Joined Jun 30, 2021
943
I was designing the following circuit. (LTSpice attached as well). The idea is to convert ambient light levels to a frequency output that could go to a microcontroller where the higher the frequency the brighter the light. I looked around for chips that could do this but it appears they are not really making them anymore. Looking for someone to shoot holes in this design before I go trying a bread board circuit.

Here I am modeling the photo-transistor with a standard transistor and a current source. I1 and the 2N2222 are just modeling the phototransistor.

Thanks in advance for any input.

1683913877176.png

I would prefer to use a chip, but this is what I am running into (at least on digikey) (note obsolete):

1683914257937.png
 

Attachments

Last edited:

drjohsmith

Joined Dec 13, 2021
785
I was designing the following circuit. (LTSpice attached as well). The idea is to convert ambient light levels to a frequency output that could go to a microcontroller where the higher the frequency the brighter the light. I looked around for chips that could do this but it appears they are not really making them anymore. Looking for someone to shoot holes in this design before I go trying a bread board circuit.

Here I am modeling the photo-transistor with a standard transistor and a current source. I1 and the 2N2222 are just modeling the phototransistor.

Thanks in advance for any input.

View attachment 294066

I would prefer to use a chip, but this is what I am running into (at least on digikey) (note obsolete):

View attachment 294068
wow, your not using a NE555 !!
http://www.learningaboutelectronics...d-oscillator-VCO-circuit-with-a-555-timer.php

One other thought , a voltage to frequency converters
https://www.analog.com/media/en/training-seminars/tutorials/MT-028.pdf
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
943
Hi dc,
Looks an interesting project, may I ask what the application will be.?
E
Sure, to allow adjusting the brightness of an LED display based on ambient light levels. I wanted something more than just a 'dark' and 'not dark' indicator. This will be used for an application that sits on the dash of a car with an LED readout. So the light source is usually the sun in daytime and low at night.
 
Last edited:

ApacheKid

Joined Jan 12, 2015
1,265
An LDR has a pretty linear response, resistance vs intensity, they are "slow" but might be a good choice for a simple circuit that can convey overall light intensity.
 

schmitt trigger

Joined Jul 12, 2010
696
Indeed, the optical product line from TAOS semiconductor was pared down when it was merged with AMS.
Another case of “marriage amongst equals” whereas one company is more equal than the other.
Enough rant. Back to the circuit. I would only ensure that the opamp you select has a fast slew rate and if you are using a supply of 5v or less, to also be rail to rail.
For a similar application I have used the AD8032, which I am almost sure LTSpice has a model for.
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
943

Thread Starter

dcbingaman

Joined Jun 30, 2021
943
Indeed, the optical product line from TAOS semiconductor was pared down when it was merged with AMS.
Another case of “marriage amongst equals” whereas one company is more equal than the other.
Enough rant. Back to the circuit. I would only ensure that the opamp you select has a fast slew rate and if you are using a supply of 5v or less, to also be rail to rail.
For a similar application I have used the AD8032, which I am almost sure LTSpice has a model for.
The part in the schematic is a comparator with push/pull outputs and has rail to rail on the outputs. I do use the AD8032 a lot, it is a nice chip with rail/rail and fast enough for most applications.
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
943
If you're using a controller with at least a 10-bit ADC I would just power (use VDD or a GPIO to make the power on drain switchable.) the photo-transistor in a common collector circuit to an ADC input pin (Vout).
View attachment 294070
https://www.allaboutcircuits.com/technical-articles/introduction-to-phototransistors/
https://www.digikey.com/en/maker/blogs/2022/how-to-use-a-phototransistor-with-an-arduino
That is definitely an easy solution. I do need to get the signal from one board to another along with some high speed digital signals. It was going to be running to the other board via a ribbon cable with every other pin ground for better EMI. I am a little concerned about sending an analog signal to the other board with transients from the digital signals on the same cable but maybe I could send it via an SMA cable might work. Thanks
 

nsaspook

Joined Aug 27, 2009
11,743
That is definitely an easy solution. I do need to get the signal from one board to another along with some high speed digital signals. It was going to be running to the other board via a ribbon cable with every other pin ground for better EMI. I am a little concerned about sending an analog signal to the other board with transients from the digital signals on the same cable but maybe I could send it via an SMA cable might work. Thanks
You normally want it to be a slow responding signal with lots of lag between abrupt level changes, so filtering out high frequency noise shouldn't be a problem in hardware or software.
 
Last edited:

MrChips

Joined Oct 2, 2009
29,197
You don't even need an MCU with on-board ADC.
An LDR and capacitor into a GPIO pin will do it. Measure the charge or discharge time of an RC circuit connected to an I/O pin.
 

Reloadron

Joined Jan 15, 2015
7,217
Sure, to allow adjusting the brightness of an LED display based on ambient light levels. I wanted something more than just a 'dark' and 'not dark' indicator. This will be used for an application that sits on the dash of a car with an LED readout. So the light source is usually the sun in daytime and low at night.
With that in mind and using a uC I would consider sensors like these considering you can buy 4 of them for about $7.00 USD. Using a uC I would just take the Analog Out from sensor and map it to 0 to 255 for a PWM out to drive your LED display brightness (intensity). There are plenty of similar modules off the shelf. Note your analog input levels and just convert the range you have by mapping to a PWM out and use a simple MOSFET to drive your LEDs, depending on your LED current requirements.

I don't see where a V to F is going to get you a change in LED brightness. normally isn't PWM used for this?

Ron
 
Last edited:

Thread Starter

dcbingaman

Joined Jun 30, 2021
943
You don't even need an MCU with on-board ADC.
An LDR and capacitor into a GPIO pin will do it. Measure the charge or discharge time of an RC circuit connected to an I/O pin.
In other words something like this?
1683947151069.png

Sure, as long as the digital input has some amount of well defined hysteresis.
 

Attachments

Thread Starter

dcbingaman

Joined Jun 30, 2021
943
You don't even need an MCU with on-board ADC.
An LDR and capacitor into a GPIO pin will do it. Measure the charge or discharge time of an RC circuit connected to an I/O pin.
That is a great option! Let me look at my parts digital input hysteresis and see.
 

sghioto

Joined Dec 31, 2017
4,914
I can't think of any available MCU devices that don't have ADC. IMHO, converting the analog light output to digital is the way to go using the module posted in #9.
 
Top