Finishing up the car collision project, we will be testing it on a remote control car. Throughout the history of the project, it has taken many turns for the better as we personally find out that many options that we wished we could use were not viable options. One of these is using stereo vision to understand distance to objects in front of the vehicle. We quickly found out this wasn’t a viable option it was very resource intensive to run on the designated device which meant that the rate at which we get updated data is too slow for our application. Our device is going to ideally sit inside of our car shell (if it fits) and going to be able to simple to operate and display some form of a its status using LED indicators.
The algorithm we use for our project requires the integration of the distance to an object to find the speed at which we are approaching it. With a real vehicle, depending on that speed, the system would have to intervene at some point which would be considered the last point the system can intervene to prevent the crash. Of course with a real vehicle, the relationship to stop the car from different speeds is not linear. In other words, it wouldn’t necessarily take a car twice the amount of time to stop at 50 mph compared to 25 mph. Our model however is much more simple as we are currently testing our device on a remote control car which has a constant speed and minimum time to break in order to avoid a collision.
Using LEDs to signify the proximity to an object in front of the car
To show the level of proximity to the closest object in font of the car, we are using three LEDs. The LEDs will light up in succession as the remote control car gets closer to an object in front of it. The triggering logic for the last LED should also trigger the brakes on the car to prevent the collision. Furthermore, to properly light the LEDs, we must set the pins we use to output pins otherwise the LEDs will light up much dimmer.
Currently, I have the distances set up at 50cm, 40cm and 30cm. The car should attempt to stop at 30cm.
The remote control car has the ability to go forwards and backwards. This is controlled by simply reversing the voltage across the motor, which will either drive the car in reverse or forwards. We always want the driver to be able to reverse out of a situation where they are confronted with an obstacle in front of the car, but the ability to drive forward would depend on if there is an object in front of them. In order to control this, we placed two diodes in parallel with opposite polarities from the motor to the original board. This allows us to divide the logic controlling the forward and reverse functionality of the driver. For the diode allowing current to reverse the car, we simply connected it directly without any further logic, since we want to give the driver the ability to reverse in all conditions. In other words, we don’t want to control the driver’s ability to reverse. Stopping the reverse ability would come in handy if we had another crash prevention system for objects in the rear of the car. As for the diode that passes current when the motor is being driven forward, we also use a transistor to switch that ability on or off depending if there is an object in front of the vehicle which is determined by the Arduino and the thresholds we used to distant objects.
Creating the hardware
Creating shields to interact with the micro controller as shown above on a single side of PCB board was difficult. So I decided to make two shields to interact with the micro controller. One of them will interact with the car and motor while the other contains the input pins for the ultrasonic sensor and LED distance indicators for the user. I used a tool called Fritzing to create the Gerber PCB files, which will allow me to use a mill to create a custom circuit board. I found that using a through-hole board was difficult and unprofessional. The schematics of the two shields I came up with, which pretty much split the circuitry of the main schematic in two parts, look like the following:
Motor Control Shield Schematic
One tip is to make sure the holes in your PCB layout are all wide apart.
Milling the PCB
Soldering components in the boards
Soldering the components on the boards wasn’t that easy. It turns out the PCB layout was engraved to be on the bottom of a board. Therefore, we had to place all the components on the opposite side. Another thing we learned was keeping the soldering iron too long on the components could damage them, especially the LEDs.
Integrating our circuit with the RC car
We integrated our custom circuit with the RC car by attaching it to the forward and reverse terminals on the motor. Our circuit is virtually in the middle of the remote receiver board and the motor and allows current to flow through the motor forward only if there is no object within a certain distance in front of it. Otherwise the motor can always go forward and in reverse. In addition, we used a glue gun to attach our circuit and the ultrasonic ranger on the car’s chassis.
With our final product, we have a fully functional prototype that can disable the cars motor if an object is detected with a certain distance. When this is activated, the user can still reverse the car to get out of the obstacle’s way. The prototype is all packaged in one item and has three big red LED indicators that tell the user how far the car is from an object in front of it. One LED will light up if an object is within 125 feet, two will light up if an object is within 80 feet and all three LEDs will light up if an object is within 50 feet. In addition to the mentioned features, the whole project can be turned on from a single switch, including the custom circuit boards.