Light finding robot dillema
ltmhall
Posts: 102
· Hi I'm designing a robot that will search for light and when it finds it, it'll roam towards it·(similar to the Boe bot robotics example). However,·when the robot doesn’t see the light I want it to rotate 360 degrees and take measurements to find it. But this isn't possible because the microcontroller won't be able to·take measurements because it's rotating the wheels. If I were to use a servo controller to control my motors, would I be able to take measurements with the microcontroller because the servo controller would make the wheels rotate?
Comments
However, if it needs more time, then yes, using the Parallax Servo Controller board would let you off-load the servo refresh duties. However, your robot STILL needs to hold still while making its measurement -- how else is your robot going to have any idea where it was 'pointing' when it made its measurement?
"Hold still" here is a relative term -- it can come to a stop, make a measurement in 100 mSec, then move again.
In the light following example, the capacitors are selected so that the Boe-Bot can "see" under dim or bright lighting conditions.· Under bright lighting conditions, a larger capacitor is needed because the LDR's values are pretty small, so the decay times are also small.· If it is placed in dim lighting conditions, the LDR's value gets larger, which means the decay time takes longer.· The problem is that the decay measurements take long enough to delay the servo control pulses, to the point where the Boe-Bot gets sluggish because the servo signals just aren't updating rapidly enough.· Pulses every 20 ms is optimal; delays greater than about 45 ms really slow the Boe-Bot down.
Here is an example of a circuit you can use to make the Boe-Bot adjust to different lighting conditions.· In bright light, set P4 to input, and set P5 low.· Then, take RCTIME measurements.· In dim light, set P5 to input and P4 low.· The capacitor that gets charged and discharged is 10 times smaller, and so it compensates for the longer decay times that result from larger LDR values.
Depending on the conditions your robot is operating under, you may want to scale down both capacitors by 1/10, or increase the range by adding a third capacitor that's 0.001 uF.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Post Edited (Andy Lindsay (Parallax)) : 3/1/2007 6:38:46 PM GMT
the other circuit. If i'm planning on using this new circuit in a bright light area, I set p4 as an input and p5 low.
What about p6. Are p6 and p4 both inputs ?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Post Edited (Andy Lindsay (Parallax)) : 3/1/2007 6:42:40 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Post Edited (Andy Lindsay (Parallax)) : 3/1/2007 7:08:42 PM GMT
switch one of the capacitors.
I started imagining how to 4write this. I'm still a little confused. If one of the pins becomes low, the other becomes an
input (to switch to one of the capacitors). So would I then want to use the input pin and record its's value and divide( or
multiply it) depending on how I want to adjust the range.
' {$STAMP BS2}
' {$PBASIC 2.5}
timeLeft VAR Word
time_4 VAR Word
time_5 VAR Word
DO
HIGH 6
PAUSE 2
RCTIME 6,1,timeLeft ' Photo resistor takes measurement from pin 6
If timeLeft > 5000 Then ' this being the value from photoresistor in bright light
Low 5 ' Pin 5 low
Gosub Get_4
ElseIf
If timeLeft < 1000 ' this being the value from photoresistor in bright light
Low 4 ' Pin 4 low
PAUSE 20
LOOP
Get_4
HIGH 4 ' pin 4 is being used as an input and takine another photoresistor reading with 0.01 cap
PAUSE 2
RCTIME 4,1,reading_4
' Then multiply or divide value
Return
Get_5
HIGH 5 ' pin 5 is being used as an input and takine another photoresistor reading with 0.1 cap
PAUSE 2
RCTIME 4,1,reading_ 5
' Then multiply or divide value
Return
* I see you beat me to it !
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
"So my P6 would be used for the normal RC measurement and depending on what that value is the program could
switch one of the capacitors."
If you gave "pseudo binary weights" to the capacitor values....
i.e.
.01uF
.022uF
.047uF
.1uF
...you could switch multiple capacitors for even more detailed resolution and/or scaling techniques.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.