Ghosty is an autonomous robot who is adventurous and loves to explore his surroundings. However, unlike a normal ghost, he doesn’t like to scare people. Instead they actually scare him! Its vision line is based on the data of two proximity sensor data reads. The difference between the data of the two proximity sensors determine whether the motors that control the wheels of Ghosty will go forward or backward..
Ghosty was set up according to the below circuit diagram. There were two proximity sensors, both powered by the 5 volt pin on the arduino board. These sent readings to the arduino, which checked the difference between the values and turned the robot left or right if there was a significant difference between them. The difference between the proximity sensors caused a certain combination of high and low values to be sent to the motor pins, controlled through an integrated circuit that was able to operate two motors simultaneously.
I decided the DRV 8833 Motor Controller (source: http://www.pololu.com/file/0J534/drv8833.pdf ) would be best to control the motors for Ghosty. After working with my Professor's advice, I wrote code in the Arduino IDE to control the DRV 8833. The embedded chip has the ability to drive two motors simultaneously, making it a great choice for this project.
The way I programmed it is to recieve two different data readings from the proximity sensors, AIN1 and AIN2 in my code. The speed of the motor was controlled by the DRV 8833, moving at a at a slow decay if it is set to HIGH, and fast decay if it is set to LOW.It would move each wheel forward or backward depending by the difference between the data read by the two proximity sensors. The combination of the motors determines which direction Ghosty will go. The motors themselves were Solarbotics GM9 Gear Motors (http://www.pololu.com/product/188/resources ) requiring around 9V of power each.