Notifications
Clear all

Photoresistor Module Readings Plateauing

4 Posts
4 Users
0 Reactions
2,605 Views
(@jordanm23)
Member
Joined: 11 months ago
Posts: 15
Topic starter  

Hi everyone,

I’m working on a simple light-monitoring project using this 4-pin Photoresistor Sensor Module. It’s supposed to plug into any microcontroller via a straightforward analog voltage output. But in my setup, I’m hitting a plateau: regardless of lighting, the analog readings top out around ~600 and never go above that—even in bright sunlight.

Here’s what I’ve set up:

Sensor connected with 5 V, GND, and Vout into an analog input on a Raspberry Pi Pico. Running a simple test loop: analogRead and print values. The values scale up from 0 (dark) to ~600 («light»), but don’t go higher even if I shine a bright flashlight directly on the sensor.

Is this typical behavior, or should the module reach closer to the upper range (~1023/4095 depending on resolution)? Could the pull-down resistor be too large, limiting sensitivity? Any calibration tips—or perhaps wiring a different resistor value might help stretch the range?

Any insight or past experience with this module would be super helpful. Thanks for your time, folks!

Jordan



   
Quote
robotBuilder
(@robotbuilder)
Member
Joined: 7 years ago
Posts: 2539
 

@jordanm23

Haven't used a light dependent resistor for decades. What is your instructional source?

https://docs.sunfounder.com/projects/umsk/en/latest/04_pi_pico/pico_lesson11_photoresistor.html

https://www.electroduino.com/ldr-sensor-module-how-ldr-sensor-works/

 



   
ReplyQuote
THRandell
(@thrandell)
Brain Donor
Joined: 5 years ago
Posts: 312
 

Hi Jordan, @jordanm23

I haven’t used that module but it looks like it’s using a CdS photo resistor which I have played with.

My application was a light seeking robot.  One that would cruise around in the sunlight streaming through a window.  It was a simple circuit and I remember trying a few pull down resistors and monitoring the analog values as I walking through the house.  I also remember pulling down an app on my phone that measured lux, but that was overkill for my application.

So tweaking the pot only gives you 0 to 600 reading?

I’ve played with reading the analog pins on a Pico and I never found an analogRead().  It’s more like:

// Voltage check
// 12-bit conversion, assume max value == ADC_VREF == 3.3 V
// shift the number 1 to the left 12 bits = 4096, conversion_factor=0.00080566
const float conversion_factor = 3.3f / (1 << 12);

***

adc_select_input(2); // Select ADC input 2 (GPIO28)
resultADC2 = adc_read();   // read the voltage divider on ADC2
converted = resultADC2 * conversion_factor * 2.0f;  // the voltage divider gives half the true battery voltage

 

Tom

 


To err is human.
To really foul up, use a computer.


   
ReplyQuote
(@davee)
Member
Joined: 5 years ago
Posts: 2049
 

Hi @jordanm23,

  The link you provided shows a circuit with an LM393, which is a comparator, not an amplifier. Unfortunately, you do not unambiguously say how you have connected it, as you mention Vout, which is not shown on the diagram,  so I can only offer some notes about what might be happening.

 

image

The only possible output voltages from the sensor module connector P1 pin 2 (labelled OUT) will be either around 0.4V or near to Vcc, depending on whether the voltage to pin 2 of U1 is greater than the voltage to pin 3, or vice versa.

Alternately, connector P1 Pin 1 (labelled AC) is shown to be connected to the output of R1/N1, which should show a variation with light level, but connecting this point the Pico means that the LM393 and the potentiometer R4 are effectively out of the circuit, and should have no effect on the signal sent to the Pico. Measuring this voltage (with respect to GND) with a multimeter, whilst varying the light level, will show the range of voltages that may be sent to the PICO. Try this test both with the signal connected to and disconnected from, to see if the PICO is changing the voltage, which it shouldn't.

In addition, note the PICO input range is only 0 to 3.3V ... connecting it to a 5V source may damage it, and is obviously well above the maximum voltage that it can measure. The Pico has 3.3V output, which can safely be used to power the board. However, the LM393 is specified to require 5V for normal operation, so do not expect it to work with only 3.3V. 

As for the value of R1 of 10k, the voltage variation will depend on the exact device fitted, which is an unknown. But as a first guess, I Googled the generic name LDR (Light Dependent Resistor), of which I think it is an example, and the first hit at

https //components101.com/sites/default/files/component_datasheet/ldr 20 datasheet.pdf

had the following table

image

suggesting possible values from 400 Ohms to 1 MegOhm.

At 1MegOhm (complete darkness), the voltage would be almost Vcc, whilst at 400 Ohms (bright light), it would be (approximately) (400/100000) * Vcc = (1/250) * Vcc, which will be close to zero Volts.

Of course, this is implying two different devices will be the same, which is a massive assumption that I can't check, and could prove to be embarassingly inaccurate, but it suggests R1=10k will be fine as a first try.

Sorry, this is a ramble of points to consider. Feel free to report your findings and ask another question if anything is unclear.

Best wishes, Dave  



   
ReplyQuote