We built a smart car, this car is able to detect and avoid obstacles. Started off by purchasing an old RC Truck off of Ebay. We used the Arduino Uno and Arduino Motor Shield to help convert it into the smart car it is in the picture below.
The Arduino helped us communicate between the car and the Parallax ping sensor. We used the output from the Arduino and routed it through the A3BU so that every time the car runs the LCD on the A3BU says “Vroom Vroom” and if we have enough battery/power the LEDS on the top light up too.
Our car detects objects within a 2 feet range. If an object is detected by the Ping Sensor, it sends a signal to work the motors in reverse (from the Arduino). The Truck then goes in reverse and turns right to avoid the obstacle in its path.
Asked: What is something you would change about your project to make it better?
Answer: We would take the power sources into account a bit more carefully. We started off with just 2 9 V batteries and later on realized that would not be enough with the weight of the car. We had to add a couple of portable/rechargeable batteries to help overcome the weight and get the car moving. It was used to power 2, 6 V motors.
Explain part of the code:
Here is the source code for the Atxmega256A3BU which would change text and flash when an object is detected. This module of code was used to denote the pin that was going to be used as an input(pin 32 in this case), we also used an if loop nested in a while loop to display one of the two messages on the LCD of the A3BU.
This code is used to send a ping to and from the sensor and detect the presence of an object within the vicinity of 2 feet. Its also used to control the motors and the LEDS. This implements the library NewPing which helps control and receive signals from the PING sensor. The Trigger_Pin sends the pulse and the Echo_Pin receives it.
Here is a simple hardware schematic showing the Arduino board in connection with the motor shield and power supply.
Here is the diagram of the whole Arduino motor shield.
And here is the Arduino Uno Rev 3 schematic – the Arduino we used for the communication to the ping sensor.