Autonomous RC Car

 

Component Breakdown

The autonomous robotic car was built using a Tiva C TM4C123GH6PM microcontroller. The car has 7 other components attached to help with the guiding and running of the device. There are 3 DC motors (2 for driving, 1 for fan), 1 ping sensor (HC-SR04), a photocell, LM34 Temperature sensor, a led and an LCD screen. When putting the car together, I created each individual module separately and tested to ensure that they were working properly. Once the modules were ensured to be properly working I proceeded with the integration.

Integration

During integration, I had to make sure that I used the proper libraries and that I paid attention to the pinout. Two of the DC motors were used to control steering and driving individually. I used a DRV8835 motor driver to help power the motors. This allowed me to control the speed and direction of the motors. This was done using pulse width modulation (PWM) and programming the specific values to the desired direction/speed. The last DC motor was used to control the fan. The ping sensor was utilized to measure distance. I had to ensure that since the device was 5V, there was a resistor included between my return pin and MCU because my MCU is a 3.3V device. The LCD is meant to display the temperature readings of the car. The photocell and temperature sensor both take in analog readings to help guide my code and the light is used as an indicator.

The last part of the integration process was combining the code and adjusting it to help control the vehicle. The way I went about this was setting my main variables and then setting an if condition the controlled the checks that helped the vehicle run.

Pseudocode

If the temperature is less than 81 degrees F
If the distance is greater than or equal to 13 inches
Straighten out the wheels.
Check ambient light intensity, if it’s night time turn on headlights.
Drive car forward.
Else if the distance is less than 13 inches
Stop car.
Reverse with wheels turned to the right
Forward with wheels turned left, after 3 seconds the wheels straighten out.
Else If the temperature is greater than 81 degrees F
Turn off car
Turn on the fan

Issues / Improvements

During the process, I did encounter one issue and design flaw. The issue I had was that I did not account for the fan I implemented in the car when deciding on my power source. This paired with my LCD left the LCD dim and the fan not working. I opted to disconnect the fan during the presentation.

A design improvement would be to include more sensors that would help give more flexibility in its movement. Currently, it only senses about 180 degrees in front of it. More sensors would allow us to code values for other movement patterns.