Photoresistor circuit Oscillation. Help?
Hi folks.
I'm playing around with a light chasing robot and the BS2sx. Its got the same setup the boe bot uses for the most part.
Here is the code im using with the 3 eyes on pins 3, 6, and 8.
HIGH 3
PAUSE 5
RCTIME 3,1,timeright
PAUSE 10
HIGH 6
PAUSE 5
RCTIME 6,1,timecenter
PAUSE 10
HIGH 8
PAUSE 5
RCTIME 8,1,timeleft
PAUSE 10
DEBUG DEC timeleft, "...", DEC timecenter, "...", DEC timeright, CR
Now everything works pretty darn good. However I was goofing off with the StampDAQ software that lets the basic stamp output values to an Excel file. I had put one eye on a servo and was moving it a tick, taking a value, logging it and then repeating, so I could then make a graph of the values.
Thats when I realized that this setup oscillates REALLY bad.
Here is an example of the photo resistor just looking at the same light source for a while.
Thats about 5kohms or so on the photoresistor. If i put an actual 5kohm resistor in its place its gives me the same reading without the oscillation.
Any ideas how I can fix this?
I'm playing around with a light chasing robot and the BS2sx. Its got the same setup the boe bot uses for the most part.
Here is the code im using with the 3 eyes on pins 3, 6, and 8.
HIGH 3
PAUSE 5
RCTIME 3,1,timeright
PAUSE 10
HIGH 6
PAUSE 5
RCTIME 6,1,timecenter
PAUSE 10
HIGH 8
PAUSE 5
RCTIME 8,1,timeleft
PAUSE 10
DEBUG DEC timeleft, "...", DEC timecenter, "...", DEC timeright, CR
Now everything works pretty darn good. However I was goofing off with the StampDAQ software that lets the basic stamp output values to an Excel file. I had put one eye on a servo and was moving it a tick, taking a value, logging it and then repeating, so I could then make a graph of the values.
Thats when I realized that this setup oscillates REALLY bad.
Here is an example of the photo resistor just looking at the same light source for a while.
Thats about 5kohms or so on the photoresistor. If i put an actual 5kohm resistor in its place its gives me the same reading without the oscillation.
Any ideas how I can fix this?
Comments
And could it be that your ambient light is a light-bulb, or even better, a flourescent light?
And could it then be that your PhotoResistor is merely reacting to the oscillation in that light? (that your eyes cannot see, since it oscillates so rapidly.)
Just a thought that may not be a bug, that's a feature...
bugg
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Geordi: "It's like the laws of physics went right out the window!"
Q: "And why shouldn't they, there so inconvinient!"
Geordi LaForge, Chief Engineer, USS Enterprise, NCC 1701-D
Q, Omnipotent Prankster
Those samples are approx 1 second apart. So you are looking at 7 seconds are so between peaks.
After looking at this a little closer I've figured that its really not that big of a deal because it doesnt skew the values too much. However I've noticed some REALLY wacky patterns if I change some of those timing values around.
Either my light sourse or the photoresistor itself is oscillating because I hooked up the photoresistor to my radio shack meter and ran a graph over time of its ohm values.
Its not as pretty but you can tell its jumping all over the place.
*shrug*
bugg
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Geordi: "It's like the laws of physics went right out the window!"
Q: "And why shouldn't they, there so inconvinient!"
Geordi LaForge, Chief Engineer, USS Enterprise, NCC 1701-D
Q, Omnipotent Prankster