Trouble Getting Photoresistor Based Navigation To Work
I am using 2 photoresistors as navigation input for a BOE-BOT in order to have it follow a flashlight. It works great when I precalculate the ambien and direct light values - however,·I want it to detect those values at startup time so that it can run in different light environments. I have a couple of loops that run at startup calculating the ambient light values and then sound a beep for 5 seconds and then rerun the loops expecting the direct light source to now be shining - this is what the tone tells the user to do.
The proble is that in a brighter ambient light environment - the resistance readings are so low that the threshold is way to tight for the BOE-BOT to notice the light. I am using 220 Ohm resistors on the VDD side. Do I need even lower resistance? Or will a higher Ohm resistor give a higher range?
Any help is appreciated. Thanks.
The proble is that in a brighter ambient light environment - the resistance readings are so low that the threshold is way to tight for the BOE-BOT to notice the light. I am using 220 Ohm resistors on the VDD side. Do I need even lower resistance? Or will a higher Ohm resistor give a higher range?
Any help is appreciated. Thanks.
Comments
Post Edited (Andy Lindsay (Parallax)) : 7/16/2005 12:33:20 AM GMT
I don't think changing resistors will help.· Make sure to use the circuit at the beginning of Chapter 6, Activity #4.
If your conditions are consistently too bright, try replacing the 0.01 uF capacitor with a 0.1 uF capacitor.· It'll have 104 printed on it instead of 103.· Be careful though, in darker conditions, you might end up with too large of a measurement, in which case your RCTIME command will store a 0 in the variable.
The program does not write to the EEPROM.· It is certainly possible to do it that way, but the program is more self explanatory like this.
Post Edited (Andy Lindsay (Parallax)) : 7/16/2005 2:42:28 AM GMT
I ran this and it gave the same results as the routine I had written - so I feel good about that. [noparse]:)[/noparse]
I did notice thought that one of my LDRs has way different readings than the other - an order of magnitude in some cases. Is it possible that I just have a bad LDR? Thanks a lot for the code sample.
If the photoresistor still responds to different levels of light, it's probably not broken. The first thing I check if the measurements are off by an order of magnitude is the capacitors. If one capacitor is 10 times the value of the other capacitor, the readings you get will also be off by a factor of 10. Also make sure that the resistors that connect the I/O pins to the parallel RC circuits are both 220 ohm.
There are some instructions in Appendix F for balancing photoresistors that aren't returning the same measurements. I've used it to bring some pretty seriously mismatched photoresistors into balance. Photoresistors are cheap, and the price of thrift is lack of precision. For precision, photodiodes·are way better. There's a great writeup on the virtues of photodiodes in Applied Sensors.
Now, back to the dynamic range problem. Did you try the larger capacitors? They should give you high enough resolution in bright light conditions. You can also modify your circuits so that the BASIC Stamp selects between either the larger or smaller capacitors depending on the lighting conditions. Interested?
·
The trick to using it is to ground either one or the other capacitors.· When you send a LOW signal to P7 and make P5 an input, you are working with a .01 uF capacitor in parallel with the LDR.· If you instead send a low signal to P5 and make P7 an input, the LDR is now in parallel with a 0.1 uF capacitor, and the RC decay measurements will be 10 times as large.· Here is a piece of sample code (untested) that should switch to the larger capacitor if the initial measurement is less than 25.
Post Edited (Andy Lindsay (Parallax)) : 7/16/2005 6:29:27 AM GMT
I don't know of any such book. Here's what I used instead:
- Parallax .pdf downloads (especially Stamps in Class)
- Magazines like Servo, Nuts & Volts and Circuit Cellar
- Interacting with other robotics enthusiasts at robotics club meetings and on these forums