This project uses the TI Launchpad and the custom designed segbot by Professor Dan Block. This project incorporates three main components in order to function. It utilizes the DC motors with rotary encoders, a SG90 servo motor, and an ultrasonic sensor. The ultrasonic sensor is mounted on top of the servo motor. Essentially, the Ultra Sonic Sensor utilizes the WIZNET to read data from the echo on the ultrasonic sensor. This data is converted into centimeters. This distance information then commands the motors to both back up & then rotate opposite directions and once done, continue driving forward.
In order to tell what direction the segbot should turn, I implemented my own algorithm that essentially flags when the ultrasonic sensor comes within 20.0 cm of the ultrasonic sensor, then backs up for 1 second, sends a PWM signal to the servo motor to turn 70 degrees left and right of the segbot and then read the echo distance from the ultrasonic sensor. If the Left Echo reading is greater than the Right Echo reading, the segbot turns right because there is theoretically more room to continue. If the Right Echo reading is greater than the Left Echo reading, the segbot turns left because there is theoretically more room to continue in this direction. In order to turn, the PWM signal is sent to the motors in opposite directions in accordance with the desired direction for turning.
COMMENTS