NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Sensors, Actuators, and Robotics » Photoresistor reading on LCD
April 19, 2012 by rmore |
Hello Friends! This is more of a 'concept' kind of a question. So as a follow up to the 'Temp_Sensor' experiment that came along with the Nerdkits, I tried to do a similar exercise using a photoresistor to see how variation in intensity of light varied output on the LCD. So I have a circuit connected very similar to that of the Temp_Sensor exercise. Recollecting the Temp_Sensor exercise, what we did in there was convert the voltage output at the ADC pin of the sensor into degrees Fahrenheit using the conversion formula (knowing 1 deg F change caused a change of 10 millivolts). Also, the output at the ADC pin, I believe, is a uint16_t. So its a 16 bit number. In case of photoresistor, I am not using a conversion formula of any kind. (Am I supposed to use one?) I still get some reading on the LCD. Something like 300 to 400. What is this reading? Why dont I see a 16 bit number? Is this number on the LCD the changing resistance of the photoresistor? Also, is it advisable to take a average of 100 values like we did for the temperature readings? Also, I see that the number on LCD changes very rapidly...making it difficult to read. How to resolve this? Somebody please explain this concept to me. Thanks a lot. RMORE. |
---|---|
April 20, 2012 by Ralphxyz |
rmore, do you have a multi meter? If not you should get one if so what are you seeing for readings from the photoresistor? Also connect your reading pin (PC0) directly to ground (- rail), what is your readout on the LCD? Then connect your reading pin directly to VCC (+ rail) what is your readout? Now you know your range what do your readings from the photoresistor mean now? Do you "need" to average them that is up to you, maybe if you averaged by 10,000 they wouldn't change as fast. You can also introduce a loop in your code to sloooooow things down. Again it is all about your specific requirements for a specific situation, generalities where one size fits all usually are not that helpful. So define exactly what you are trying to do or see and then refine your code to illustrate your results. Ralph |
April 25, 2012 by hevans (NerdKits Staff) |
Hi rmore, I think the question you are really asking is "what are you actually measuring with the ADC?". The ADC just measures the voltage at the ADC input pin. The LM34 temp sensor outputs a voltage proportional to the temperature, so we can just stick the output pin on our ADC input pin without any other circuitry. A photoresistor like you mentioned will change its resistance proportional to the amount of light hitting it, so you have to think about a small circuit around your photoresistor that will turn the changing resistance into a changing voltage that you can read. Does that make sense? Humberto |
April 25, 2012 by Ralphxyz |
Here is a nice illustration of the resistance to voltage circuit Humberto is speaking of. Now I, not knowing a whole lot, would have thought that just the voltage drop through the photoresistor would be measurable. While I understand what the voltage divider does, why wouldn't the voltage drop be measurable? mystified as usual when it comes to things like this, Ralph |
April 26, 2012 by hevans (NerdKits Staff) |
Hi Ralph, Measuring the drop across the photoresistor is exactly what you are doing in the circuit you linked to. In order to measure the voltage drop you need to set it up in a circuit where the resistor is drawing current so that you can figure out a voltage drop across it. Connecting it directly to the ADC would not work because current would not be flowing across the photoresistor. Try sketching the circuit you thought would work to "just measure the voltage drop" across the photoresistor, and see if you can come up with a configuration that would work. I think with a little bit of fiddling you will arrive at something almost exactly like the circuit you linked to above. If you have questions, post a picture of the circuit, and I'll be happy to take a look. Humberto |
April 26, 2012 by Ralphxyz |
Duh, a photoresistor by it self does not make up a "circuit". I just got some photoresistors and was going to see what I get from it. Ralph |
April 26, 2012 by mongo |
Just about every light meter I have used, uses a photo voltaic cell and makes the calculation from the voltage generated across that. Rather than a photocell, which is really just a resistor that changes value by how much light hits it, a PV cell actually generates a voltage that is much easier to read. |
April 26, 2012 by Ralphxyz |
Yeah thanks mongo, I could see a photo "voltaic" cell generating a voltage. I was just thinking that if there is a "resistance" than there "should" be a voltage drop and that should be measurable. BUT if the photoresistor by it self (with a power supply of course) does not make a circuit than I understand the need for the voltage divider "circuit". I just got some photoresistors so I can play, ooh ah, I mean experiment with them. I will set up some circuits. Ralph |
April 28, 2012 by mongo |
Yup. Most circuits with photoresistors are either high gain, where just an "on" or "off" is required. Typically on the base of a Darlington pair or even a simple transistor or FET. Add a load resistor and you have a basic voltage divider. A little more practical and it does much the same thing but you have more control over it. Finally, in the circuit of a Wheatstone bridge. The best for linear measurements and the like, but most of the time, you also need an instrumentation amp to do much with the signal. PV cells are the simplest way to do it and fairly linear too. But they are also a bit bigger... |
April 28, 2012 by mongo |
Something that can also be considered is a photodiode. (even a phototransistor) Photodiodes can actually generate a little voltage potential but they tend to be frequency specific. So an IR photodiode will do better with IR light, etc. These are much smaller packages that any of the others and can be built into some tiny circuits. |
Please log in to post a reply.
Did you know that you can use a transistor to interface between different voltage levels of digital logic? Learn more...
|