Shop OBEX P1 Docs P2 Docs Learn Events
Photoresistor circuit Oscillation. Help? — Parallax Forums

Photoresistor circuit Oscillation. Help?

BushmanBushman Posts: 4
edited 2005-02-26 17:17 in Robotics
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.

cir.gif

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.

pic1.gif

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

  • allanlane5allanlane5 Posts: 3,815
    edited 2005-02-25 16:51
    Could it be that the oscillation you are seeing is at 60 hertz?

    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...
  • MacGeek117MacGeek117 Posts: 747
    edited 2005-02-25 16:55
    What is the light source? That might help. I've had the same thing happen with a flourescent light.
    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
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-02-26 07:17
    if it is caused by ac powered light, you can implement a moving average to smooth out the signal. Properly spaced, a three sample window should suffice.
  • BushmanBushman Posts: 4
    edited 2005-02-26 14:10
    Hey guys, thanks for the reply.

    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.

    pic3.gif

    Its not as pretty but you can tell its jumping all over the place.


    *shrug*
  • MacGeek117MacGeek117 Posts: 747
    edited 2005-02-26 16:00
    Try different capacitor values.
    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
  • Robert SchwartzRobert Schwartz Posts: 141
    edited 2005-02-26 17:17
    Try testing it outside with real sunlight, and see if still oscillates.
Sign In or Register to comment.