Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: garriwilson on February 26, 2014, 08:20:06 PM

Title: $50 Robot photoresistors - bad bright/dark values
Post by: garriwilson on February 26, 2014, 08:20:06 PM
Hey guys,

I measured the resistance of my photoresistors under the couch (~200 kOhms) and under a lamp (~5 kOhms). The problem is, these are orders of magnitude different from what admin got here: (

I understand that I picked two extremes (darkness under couch and right under a lamp), but how can my values be this different? Plus now if I calculate the resistor I need from R = sqrt(R_dark*R_bright) ~ 31.6 kOhms.

My question is should I go with my values, which seem a little outrageous, or stick with an R=1.5 kOhms like admin used in the tutorial?

Title: Re: $50 Robot photoresistors - bad bright/dark values
Post by: knossos on February 27, 2014, 08:27:11 AM
Photoresistors come in a wide variety of resistance values, so I would definitely go with the values you measured.  Dark values can be as high as several megaohms and bright values can be as low as a few hundred ohms.  Using your values (which seem accurate) the closest E6, E12, or E24 series resistor would be 33 kOhms (for 20, 10, and 5% tolerances, respectively).  You could also use a 30 kOhm E24, or if you felt you needed a more accurate resistor, an E48 (2%) series or better would give you a 31.6 kOhm resistor.  You really don't need the tighter tolerances though.  If you don't have a 33 kOhm resistor you could just as easily go with the next higher or lower value resistor at the cost of some decreased sensitivity.
Title: Re: $50 Robot photoresistors - bad bright/dark values
Post by: knossos on February 27, 2014, 10:39:38 AM
I dug out my version of the excel photoresistor calculator worksheet.  It's a modified version of admin's spreadsheet from the tutorial you linked.  I filled in your 5 Volts as the Vin and your values for Max and Min.  It shows that even an 18 kOhm or 56 kOhm resistor would still give you at least 95% of the range a 33 kOhm resistor. 

I attached the spreadsheet if you're interested and a (not so brief) explanation of it below. It was a quick rough up I did for my own use so it's nothing fancy, but gives a little bit more information for resistor selection.

The first three columns show what series the resistor is part of (E6,E12, or E24).  Column D is the choices for resistor values.  Column E is the most important column.  It shows the output voltage range (Vmax-Vmin).  The higher the range, the more sensitive your sensor.  At the top of the column is the maximum range available with the resistors listed.  Looking down the Range column, you will see red, yellow, and green entries.  Green is the IDEAL choice (i.e. max range capable using resistors on the list).  Yellow are GOOD choices (i.e. at least 99% of the max range).  Lastly red are OK choices (i.e. they only give you 95% of the max range).  You can adjust the scales at the top of the page to your needs.  The next two columns are the max and min voltages if you configure the resistor as a pull up (so voltage decreases with light) and the last two columns are the max and min values if you use the resistor as a pull down (voltage increasing with light).
Title: Re: $50 Robot photoresistors - bad bright/dark values
Post by: garriwilson on February 27, 2014, 06:02:00 PM
Thanks for the file, it was pretty useful for understanding and similar to the one admin had on the tutorial. I know you said photoresistor values can vary, but I did buy the exact same ones as in the tutorial, and the values are off by a lot. Admin had something like R_bright = 500 ohms and R_dark = 3300 ohms. My values are in kOhms, so that's a little concerning. I just want to make sure I didn't make some freak mistake before I go wire four 5kOhm resistors together and it ends up being a waste, you know?

Also, how much of a range do I really need? In the tutorial, the max Voltage Range that admin got with his 1.5 kOhm resistor was about 2 Volts. In my case I can get a 2 volt range with a 3.6 kOhm resistor. Are these two cases analogous? I mean, will the sensitivity of the robot to light be the same as in the tutorial, since my voltage dividers will produce the same max voltage range of 2V? Or since I have different values, will I need a wider range?
Title: Re: $50 Robot photoresistors - bad bright/dark values
Post by: knossos on March 17, 2014, 01:41:46 AM
Sorry for the delay in responding, I haven't had a chance to get on in a while.

First of all, I wouldn't be concerned about the readings in the least.  Your values are well within acceptable ranges.  If you had a datasheet that listed drastically different values then I might be concerned, although, as long as the measurements were repeatable, it would still likely be adequate for a simple photovore.  I would take multiple measurements (good practice anyways) to confirm my readings.  I probably would not wire four 5 kOhm resistors in series though.  While it would work just fine, resistors are readily available and inexpensive so I would get one thats closer to the appropriate range.

Which brings me to your second question, how much range do you really need?  LDRs have a non-linear response, so reducing the range means a lot less sensitivity at the extremes.  Now for a simple photovore (or photophobe), that may not be an issue unless you wanted it to clearly and reliably tell the difference between dark and very dark, or bright and very bright.   Your photovore likely does not need this degree of sensitivity. However, you may choose to reuse these sensors for a future project that might require a higher degree of sensitivity.  Maximizing their response now would save effort and money later. 

I would personally choose a resistor that is of lower resistance than the one recommended to maximize range (although not drastically lower). If you need a more accurate sensor you could then add a trimpot to make an adjustable sensor that you could tweak to your desired sensitivity as show in the schematic below.