MCP3008 LDR etc

Viewed 9 times

I am trying to read values from a photoresistor. I would like to be able to read the ‘level’ of light, not just a binary signal. So I bought an MCP 3008 analog to digital converter, but I am running into problems.

I followed this tutorial to set up the MCP:


I am pretty sure it is set up correctly. I then plugged a photoresistor with the analog out to channel 1, the ground pin to gnd rail, and the power in to a 3.3V source. The exact model of photo resistor I used was this one:


But the results I received were problematic.

When the photoresistor was plugged in as described above with the lights on, the reading on channel 1 was the max (1023). The other channels had a bunch of noise with readings from 0-200.

When I turned off the lights or tried to cover the photoresistor, the values would only only drop to around 500 or 600 (+/- 100). When I unplugged the voltage source from the sensor, the readings plummeted to 1.

Is this normal? Is there a way I can sift through the noise?

Eventually I have to provide accurate measurements of AC current and voltage from a wire in my home (separate project) and want to get the photoresistor working before I attempt to measure current.

Thanks for the help!!!!

Below are photos of my setup and the results. NOTE: In the results photo, I plugged the photoresistor in channel 3, which is why the 3rd column is all 1023, the max value.

Set up (without sensor)

Results when plugged into Channel 3

 New contributor
  • It is difficult to make any sense from a photo of untidy wiring. One thing you should definitely do is connect all unused inputs to ground. – Milliways 4 hours ago
  • @Tuomas Talvitie, Ah, let me see. I would suggest you to first make sure the photo resistor is not noisy: (1) use two resistors, say 10k, in series, connected to Vcc and Ground and use MCP3008 to convert the mid point voltage to see if it is noisy. (1) If you find photo resistor is not noisy, that means MCP3008 is noisy, I can suggest a couple of more solutions. – tlfong01 2 hours ago   
  • Noisy MCP3008 Discussion: raspberrypi.stackexchange.com/questions/96482/…, HX711 is low noise, so are many other modern ADCs, eg ADS1256 (but very expensive!) – tlfong01 1 hour ago    
  • Your AdaFruit ADC tutorial includes ADS1115 beside MCP3008. ADS1115 is also a modern ADC which is not so noisy, in a module with noise filtering caps etc. You might find it getting popular among DIYers: raspberrypi.stackexchange.com/questions/96653/…. – tlfong01 24 mins ago    
  • In my answer referred above, you might find references to MCP3201 and PCF8591 ADC/DAC module. PCF8591 module is dirt cheap and includes 8bit ADC and also DAC assembled in a modules. This integrated approach also reduces noise, because not long wires collecting mains 50Hz noise, and by passing cap also near devices, … – tlfong01 17 mins ago   
  • And there are many ways to reduce noise or unavoidable fluctuations, such as using analog and digital filters. And one simple get around is AVERAGING, eg, use moving average of 5 or more readings. – tlfong01 13 mins ago   
  • What is too good to be true is that those dirt cheap (US$1) ADC/DAC modules has LDR for you to mess around: AliExpress PCF8591 ADC/DAC module with photo resistor (LDR Light Dependent Resistor) on board – US$1 aliexpress.com/i/32891915230.html. – tlfong01 39 secs ago   Edit   

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: