This instructable is the written version of my "Arduino: How To Build A SMART CAR AND SMART PARKING SYSTEM "

Robotics is a part of today’s communication. In today’s
world robotics is a fast growing and interesting field. It is simplest way for latest technological modification. This project is basic stage of any automatic robot. The obstacle detection scheme would be based on a sonar sensor, one for right and one for left direction, a micro controller would take input from the sensor and then compare the inputs to decide where the robot should turn. It would then give input to the two h-bridges which would in turn direct the motors to control the movement of the robot. Apart from that we will use two 9v batteries to power the micro controller and the motors. We are introducing smarting parking too by sending the number of free parking slots in the parking lot to cloud enabling every user to access on their mobiles .

Step 1: Overview

Our project is basically a smart car having parking capabilities of its own and similarly capability to come out of a parking lot on just a push of a button .The project is included with a smart parking system too which enables users to know the status of parking slots available by synchronizing the data with the cloud server .

Imagine a person comes to a parking lot which has free slots (as it will be updated to parking cloud server accessible on persons mobile) and abandon his car there itself and the car automatically goes into its den searching for free slots nearest to the exit gate .

And again a switch of a button would bring the car back in a ready to go condition!!!


Step 2: Requirements

1. Arduino

2. Motor Shield

3. Ultrasonic Sensor

4. Motors and wheels

5. Chassis

6. Bluetooth module(HC-05)

7. Ethernet Shield

8. Power supply

9. Arduino IDE

10. Bluetooth Terminal

11. Platforms (Azure and Power BI)

Step 3: A Chassis !

the first step and the base of any robot is a chassis.i got mine from amazon, if you prefer, you can also make your own using cardboard and DC/Servo motors. Either way, the chassis has to include a body, two motors and sometimes even a battery holder and a switch.

Step 4: Brain

Now we need something that will orchestrate our motors, a micro-controller.

from the title of this instructable you probably have already understood that we are going to use Arduino.


well, the answer is simple. Arduino (or, specifically, Arduino Uno) is a compact, comfortable and relatively cheap micro-controller. In addition, it is very common and you can get it literally everywhere online.

Step 5: Attaching the Arduino to the Chassis

Now simply use some screws to attach the Arduino to the chassis. If you've made your own chassis/ can't find any screws, you can use a small amount of double-sided tape. If you do choose to use double-sided tape then search for an area under the arduino that doesn't have many pins/solder above it.

Step 6: a Sensor

In Order to make a robot that can maneuver by its own we need some sort of an input, so it can "know" or "judge" what to do. a very comfortable sensor that fits our goal (avoiding obstacles) is the Hc-sr04 ultrasonic sensor.

Scientific Explanation Of the sensor's action: What the sensor does it is calculating the distance from an object by sending bursts of ultrasound towards it and measuring the time it takes to the sound waves to get back (Distance = Velocity * Time). we can use this information in order to determine whether there's a close "obstacle" near the robot and then- avoid it ! So now you know how an ultrasonic sensor work, Scientifically. Now, Let's use it !

Step 7: Attaching the Sensor to the Chassis

all we have to do next is to actually attach the sensor to the body. To make life easier, i recommend sticking a mini bread-board as well for easier wiring, although you don't have to.

Step 8: A Milestone

If it seems like the robot is staring side ways, then you are on the correct way.

Step 9: Connecting the Sensor to the Brain

Now gather some wires, and connect the sensor to the arduino according to this diagram i made.

Pay attention that your ping sensor may have a different pin layout (e.g. 5 pins), but it should have a voltage pin, ground pin, trig pin and an echo pin.

Step 10: Connecting Bluetooth Module

We need something to control our rebot wirelessly so we are gonna need a Bluetooth module .

Since HC-05 is most commenly used so we can right away go for this one . Now all we need to do is make it connected to arduino using circuit diagram or else described below :

1)Connect gnd to gnd of sensor 1

2)Connect vcc to vcc of sensor 1

3)Connects RX of Bluetooth to TX of arduino

4)Connect TX of Bluetooth to RX of arduino

Step 11: Connecting and Controlling the Motors With the Arduino

arduino boards can't control dc motors by their own, because the currents they are generating are too low. Moreover, the currents they are generating cannot be reversed, so you can't change the direction of the motor. To solve that we will use a motor driver, which helps the arduino control dc motors. The most comfortable way of using motor drivers is through shields. Motor shields are very cheap

Step 12: Attaching the Motor Shield to the Ardunio

Take your motor shield and simply plug it into the arduino with the sensor's wires crunching inside.

Step 13: Connecting the Motors to the Shield

Every Motor Shield has (at least) two channels, one for the motors, and one for a power source. Locate the channels and plug your chassis' motors to the motors' channel, and whatever power source you are using ( e.g. AA batteries, Lithium Battery) to the power source's channel.

Step 14: Programming the Robot

After You've made your motor shield connections, From a hardware side, believe it or not, Your robot is Done. All you have to do next is to plug your arduino to your computer and open arduino IDE . And copy paste my code from step 17(smart car code) .

Choose whatever board you're using and the com port of your arduino (my happens to be three). Finally, upload the sketch, and after a few seconds you should see a message stating that the upload is complete. Note: If the code doesn't work, you may need to download the motor shield library from: you might need to download other libraries, depends on what motor shield you are using.

Step 15: Downloading Bluetooth Terminal

Roll over to play store and download Bluetooth terminal on your android device (this doesn't works on ios) and connect to HC-05-27 and use 1 and 2 as command !

Step 16: Enabling Cloud Computing

We are now gonna link our parking system to AZURE cloud which is an $100 software .

Connect a third ultrasonic sensor to a different arduino and place an ethernet shield(or use wifi module) on the arduino with wires crunched inside and just upload the code in step 18 to arduino using above steps and you will be able to see number of parking lots available in a parking area via MICROSOFT AZURE cloud services .

U just gotta have an account on AZURE and just have bit knowladge of cloud computing !

Better go for some articles on AZURE cloud computing !!


Step 17: Smart Car Code


#define trigPin 12

#define echoPin 13

#define trigPin1 8

#define echoPin1 7

int flag=0,flag1=0, count=0;

char val;

AF_DCMotor motor2(2, MOTOR12_64KHZ);

AF_DCMotor motor4(4, MOTOR12_64KHZ);

void setup() {


pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

pinMode(trigPin1, OUTPUT);

pinMode(echoPin1, INPUT);




void loop(){

if (count==0){

Serial.println("Please Press 1 to enable autoparking");



if( Serial.available() ) // if data is available to read


val =; // read it and store it in 'val'


if( val == '1' ) // if 'H' was received




if (flag==0 && flag1==1){

Serial.println("Auto car parking enabled !!Your car will be parked soon ");;;



long duration, distance,distance1,duration1;

digitalWrite(trigPin, LOW);


digitalWrite(trigPin, HIGH);


digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration / 2) / 29.1;


digitalWrite(trigPin1, LOW);


digitalWrite(trigPin1, HIGH);


digitalWrite(trigPin1, LOW);

duration1 = pulseIn(echoPin1, HIGH);

distance1 = (duration1 / 2) / 29.1;


if (distance>40){;;




Serial.println("Your car is parked");



else if (distance1>40){;;




Serial.println("Your car is parked safely ! Thank you ");





Step 18: Smart Parking Code





int we = 67;

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

const char *server = "";

const char *table_name = "test_table";

const char *ams_key = "aDFcKPwvWLJnoXzYkJiupceKzDIsFG91";

EthernetClient client;

char buffer[64];

void send_request(int qw)



if (client.connect(server, 80)) {

Serial.print("sending: ");



sprintf(buffer, "POST /tables/%s HTTP/1.1", table_name);


sprintf(buffer, "Host: %s", server);


sprintf(buffer, "X-ZUMO-APPLICATION: %s", ams_key);


client.println("Content-Type: application/json");

sprintf(buffer, "{\"value\": %d}", qw);

client.print("Content-Length: ");




} else {

Serial.println("connection failed");



void wait_response()


while (!client.available()) {

if (!client.connected()) {





void read_response()


bool print = true;

while (client.available()) {

char c =;

if (c == '\n')

print = false;

if (print)




void end_request()




void setup()



while (!Serial) {

; // wait for serial port to connect.



Serial.println("DS1621 Azure Demo");

if (Ethernet.begin(mac) == 0) {

Serial.println("ethernet failed");

for (;;) ;


// give the Ethernet shield a second to initialize:



void loop()


int tC, tFrac;

float val;

tFrac = tC % 100;

tC = tC /100;







Step 19: Playing With the Robot and Code

After you've uploaded the code, unplug the arduino, connect your batteries and watch as the robot goes and park itself on click of 1 and comes back to you on press of 2 without any worry about any obstacles . then, go over the code, examine it, play with it, improve it and modify it to fit your needs !

Check for counter on POWER BI

Step 20: About Me + What's Next ?

First of all, I would like to thank you for reading this guide ! I hope it helped you build your own robot and improved your knowledge about robotics and arduino.

I think now it's a good time to introduce myself. My name is Rishabh and I'm a 18 years old teenager who likes Math, Science, Computers, Robotics and programming. {Actually in case of Math, I don't really like It, ;)} . make sure you are a subscriber so you won't miss me, and I will see you next time.

bye !!



    • Trash to Treasure

      Trash to Treasure
    • Arduino Contest 2019

      Arduino Contest 2019
    • Tape Contest

      Tape Contest

    4 Discussions

    RishabhS46INHAOS YAKE

    Reply 3 years ago

    Thanks bud !
    I ill be doing some more works in course of time ...


    3 years ago

    This is very cool! I would love to see a video of it parking!

    1 reply