UCL - Embedded - Warningsystem - RC Car

In this project I made a simple warningsystem for logistic robots. It's basically a RC car with a ultra sonic sensor in front and a obstacle avoidance senor in the back. The car is controlled via bluetooth on an app.

Step 1: Video an Pictures

Step 2: Components

This is a list of components that I have used:

1 x arduino mega 2560
1 x L298N Dual H-Bridge Motor Driver
1 x Ultrasonic sensor
1 x Obstacle avoidance sensor
1 x HC-05 bluetooth module
3 x leds, green, yellow and red
2 x DC motors
1 x Speaker
1 x transistor
4 x 220 ohm resistors
1 x 1k resistor
1 x 2k resistor

wires
breadboard
3d printet holder for the ultrasonic sensor
1 x 9v battery
6 x AA batteries

Step 3: Wirering Diagram

Step 4: Code

The idea of the program is to give warnings and stop the rc car if it is to close too an object. When something is under 30 cm away a red led starts to flash, the speaker makes a sound and the car stops. When the car is stopped it isn't possible to make the car move forward.

If something is between 31 and 70 cm away a yellow led is flashing.
When nothing is wrong a green led is on.

If something is about 20 cm from the back of the car the car stops. When the car is stopped it isn't possible to make the car move backwards.

I tried to write the code in different classes to make the main as clean as possible. But I had a lot of trouble with the flow in the code that controls the RC. So in the end I wrote the control code in the main program. This is a thing that I would like to change.

Step 5: The App

I have made an app to control the car. The app is made in MIT app inventor. The only problem with MIT app inventor is that they don't support multitouch.

The app sends data via bluetooth. The bluetooth module uses the rx1 and tx1 on the arduino mega. By doing that I could program the arduino via USB and use the app to control the car at the same time.

Step 6: 3D Print

I have made a bracket for the ultrasonic sensor. The drawing itself I have made in fusion 360.

The bracket is design for my RC car.

Step 7: Final Thought

I have learned a lot doing this project. The biggest challenge in this project was to get the bluetooth communication to work. I learn how to use millis and micros instead of delay, because the delay function stops the entire program. I learned how to make my own 3d drawing and how to print it.

One thing that I would like to do is to give the car an automatic function, so it can drive by itself.

Overall, I had a lot of fun doing this, and I know that there is a lot on the car that could be improved.

Share

    Recommendations

    • Big and Small Contest

      Big and Small Contest
    • First Time Author

      First Time Author
    • Toys Contest

      Toys Contest

    2 Discussions

    0
    None
    Gaarsvig

    25 days ago on Step 3

    The GND from l298n is actually also grounded to the arduino. And the pin from the obstacle avoidance senor is an input and not an output.