# BeagleBone simple demo with a photoresistor

In trying to put together the simplest possible demo, I plugged a photoresistor directly into ain0 and gnd on P9. The demo works as expected, but I noticed that in bright light (when resistance is minimal) I’m getting a reading of 3 - 5 from /sys/devices/platform/tsc/ain1. I was curious if the BeagleBoard can safely handle passing full current through it’s analog pins?

thanks!

How are you getting a voltage out of a photoresistor without providing an input to it? There is an AVDD on the header. The inputs can handle up to that voltage.

I know that normally you’d use a pull-down, but I was just playing around while trying to make the simplest possible circuit. I get values from 3 (shining a light into the resistor) to 97 (covered) and appropriate changes when altering the amount light. I actually was going to post a video of it as part of a code demonstration, but wanted to make sure no one would screw up their BB if they replicated it. The photoresistor was from a radio shack assorted bag and read around 20K ohms when in ambient light.

You've attached a variable resistor to a device that expects to read an analog voltage. The results will be unpredictable.

You want to present a code demonstration that a newcomer can duplicate with a high chance of success.

The "simplest possible circuit" that is reliable and correct requires the addition of another resistor to create a voltage divider:

Jason and Michael, thanks for your responses. I’ll put the demo together with the correct circuit. Despite getting the desired results, it’s probably bad form to show an incorrect circuit.

I’ve done a bit more research and just wanted to clarify a couple things:

1. The small amount of voltage present on the analog pin (.6V) is being produced by a voltage reference buffer?

2. My observation about current was incorrect, and what I believe Michael is alluding to, is that without a reference voltage, the analog pin will “float high” and give a maximum value reading regardless of the actual input?

Not exactly: Without a reference voltage AND THE OTHER RESISTOR to form a voltage divider, you have an antenna of unknown and changing impedance, picking up whatever chance electromagnetic waves happen to match well, generating an unknown and changing voltage at the input of the ADC.

Sometimes the changing voltage might correspond to the changing light, but if so it would be mostly by chance.

Sorry, I’m having a hard time accepting this explanation. This is definitely not chance. The results were consistent for the few minutes at a time I played with it. Interestingly, the values read from ain1 were opposite that of using a pull-down circuit, which reinforces the idea it is measuring voltage from the pin.