The Smart Car

117

2

2

About: Geniusly using Technology.

I am in list for the Toys Contest. If you enjoy reading it, please vote for it!
After studying this instructable, you will learn how to design an Arduino-based smart RC car and control it from your smartphone.
Some days back, I found an abandoned beautiful car in the house but its remote was broken and some parts where missing from the car chassis, so I thought that it will be fabulous if I convert the remaining chassis into a smart car.

Step 1: Components

Components:
1x Arduino uno & USB Cable
1x HC06-bluetooth module
2x Motors
1x L298N Motor driver module
1x RGB LED
2x 5mm red LED
2x 5mm white LED
1x Piezo Buzzer
7x Resistors (220 Ohms)
1x 9V battery and holder
2x 3.7V Rechargeable cells
Wheels

Note: some of the above components can be gotten from a nearby retail store e.g the LEDs, Resistors, battery and batteries. Others can be gotten at AliExpress.com (https://aliexpress.com), ebay(ebay.com), Arduino(https://www.arduino.cc) or Amazon(https://www.amazon.com)

Step 2: Tools and Apps

Tools:
3D printer
Multimeter
Solering iron
Screws
Glue

APPS:
Arduino IDE (https://www.arduino.cc/en/Main/Software)
Fritzing (https://fritzing.org)
Bluetooth controller: It can be gotten on Google PlayStore or downloaded from here
https://play.google.com/store/apps/details?id=braulio.calle.bluetoothRCcontroller&hl=en

Step 3: The Mechanical Body Frame

With the remaining car chassis, I need to print out some missing parts with the correct dimension. Using the 3D Printer, I successfully printed it. Then I applied some glue to stick it to the remaining body. I then fixed the wheels.
Although, you can totally print a new and simple chassis (like the one below) if you know how to operate the 3D printer or get one from a retail store so that you will just do the internal wiring. Guess it is easier!

Step 4: The Electrical Circuit Design and Schematic

As seen in the circuit diagram above, the components have been connected to several pins on the arduino board. Please make sure you follow the correct wiring else you might need to edit the code.
The arduino board has a microcontroller acting as a brain, it receives and send signals for proper functioning of the car.
The HC06-bluetooth module enables the App on the smartphone to interact with the system. Therefore, it receives signals sent and transmit it to the microcontroller for actions to be carried out.
The L298N Motor driver is used for controlling the speed and direction of rotation of the motors, it is expected the car moves in all direction at any speed.
For the power sources, I used the 9V battery to power the arduino board and other components except the motors because they consume power, using the same source for them can damage the arduino board. Therfore, I used two 3.7V rechargeable Cells which is okay, the cells can be used again and again. Hint: before connecting the batteries, you can check with multimeter to see if the voltage is the expected one.
The white and red LEDs are for the front and back lights respectively. They are meant for illumination. You can connect the 9V battery directly if you have the cap instead of Vin and GND.
The buzzer is used for horning.
RGB LED is a LED having three colors: RED, Blue and Green. It can form different colors depending on the amount of the composite colors. It gives the car a nice looking

Step 5: Fixing the Components Into the Chassis

The frame is ready, so also the electrical system. Next is fixing the components in the vehicle.
After making all the connections as in the above circuit diagram, my car with the circuit attached was looking like as shown in the figure above.

The RGB LED in the middle makes it look more beautiful and its high speed makes it to compete with the cars available in the market.

The next thing is uploading the code to the Arduino board.

Step 6: Code

The code is written in C/C++ using the Arduino IDE. I have commented on each section of the code for proper understanding of how it works.

For the code segment before the setup() function:
First, I imported the libraries I want to use.
Then I initialized the bluetooth data transfer pins i.e pins 2 and 3.
I defined the pins for the red, white and RGB LEDs, buzzer and motors.
Lastly, I declares 2 variables: spd for the car’s speed, and command for the received data from the smartphone via bluetooth.

In the setup() function:
I set the baud rate for the bluetooth and the Serial.
I configured the LEDs, L298N, horn and RGB pins as output.
Then, I set the enable and RGB LED pins to HIGH.

In the loop() function:
I firstly checked if any command/message has been sent to the bluetooth module from my phone., if there is a message it will read it as store it to the command variable.
Next is to determine the meaning of the message sent using the switch statement. The message/command tells the car to move forward, backward, left, right, forward right, backward right, forward left, backward left or stop, also tells whether or not to on/off the front/back lights or to horn.
Also, the car’s speed and the RGB LED are controlled.

After the loop is another function: the centreLed() function; it controls the RGB LED

Step 7: Controlling the Car

To control the car certain characters are entered and each character received interpretes to distinct functions:
'F' moves the car forward
'B' moves the car backward
'L' moves the car to the left
'R' moves the car to the right
'I' moves the car forward right
'J' moves the car backward right
'G' moves the car forward left
'H' moves the car backward left
'S' stops the car
'W' on the front light
'w' off the front light
'U' on the backlight light
'u' off the backlight light
'V' and 'v' on and off the horn respectively
'X' turns everything off
'q' sets the speed to the maximum

Step 8: Enjoy!

Next is to fix the car up.
Yep! After attaching the top body on it, the car was looking like an original Gallardo.
Enjoy the car, have a nice ride!
You can get the code, schematic and others here.
https://drive.google.com/file/d/1MumKS-GkShU52U3CqdzpLU7a7XKYn_RR/view?usp=sharing

Don't forget to Vote!

Share

    Recommendations

    • Tape Contest

      Tape Contest
    • Arduino Contest 2019

      Arduino Contest 2019
    • Woodworking Contest

      Woodworking Contest

    2 Discussions