|
|
|
|
||||||||||||||||||
|
|
||||||||||||||||||||
|
This is a little more advanced experiment that expands on the fist basic example of using CDS photocells shown HERE to make Micro-Bot turn towards the brightest light source while moving about using infrared sensors for object detection & avoidance. |
||||||||||||||||||||
|
Build each of the circuits shown below
for this experiment. Parts List:
Be sure to place both CDS photocells on the front of Micro-Bot similar to the placement diagram shown below. This will force Micro-Bot to steer towards the brightest spot in the room while moving forward.
Next build the infrared circuits on the front end of Micro-Bot. Place one IR LED on the left, one on the right, and put the infrared detector between the LEDs similar to the placement diagram below.
Once you have all of the above circuits wired-in & checked, program the code below into Micro-Bot. Micro-Bot will wander around avoiding obstacles with the help of the infrared object detection circuits, and increment the CDS_Count variable on each pass. Micro-Bot will use only infrared for navigation until the CDS_Count variable is equal to or greater than the MAX_Count constant. Once the MAX_Count is reached, program execution will jump to the Check_CDS sub-routine & take light measurement readings from left & right side CDS photocells. Micro-Bot will then turn towards the left or right depending on which CDS photocell returned the brightest light reading. Try swapping the 0.01uF with 0.1uF capacitors, and experiment with changing the value of the constant MAX_Count. Try using a flashlight in front of Micro-Bot as he moves around. This project is a lot of fun in a dark room with a flashlight. Increasing the value of MAX_Count will cause Micro-Bot to turn very slowly towards brighter directions. Decreasing it will cause rapid turns & faster reactions to changing light conditions. If you look closely at this code, you'll see we just clipped bits & pieces from previous IR & CDS experiments, and pasted them together to build this routine. Code examples from individual projects can be combined together to create much more sophisticated routines. It doesn't take long to see the real benefits of having the full version PicBasic Pro compiler vs. the demo version. |
||||||||||||||||||||
|
||||||||||||||||||||
|
Copyright © 2007
Reynolds Electronics |
||||||||||||||||||||