Ultrasonic automatic braking RC car project

Ultrasonic braking is a method of collision avoidance system that can automatically brake a vehicle before an impact with the object. So whenever any obstruction came in front of the vehicle the system simultaneously disengages the power transmission to the wheels and activates the braking.automatic braking system using arduino

The system works based on the ultrasonic ranging technique which is a non-contact ultrasonic distance measuring method. An ultrasonic braking system consists of an ultrasonic transducer or sensor unit, control unit, and braking mechanism.

The sensor unit consists of a pair of ultrasonic transducers, a transmitter, and a receiver.

The ultrasonic transmitter which is placed in the front of a vehicle will continuously transmit the ultrasonic waves in a predetermined range. The transmission transducer is driven by a square wave output generated by the Arduino. The output signals are amplified and fed to the transducer. The transducer generates ultrasonic waves from a 40khz electrical signal.

ultrasonic braking system

The ultrasonic receiver which is placed parallel to the transmitter receives the ultrasonic signals that are reflected from the obstacle. Then these reflected waves or signals are analyzed by the Arduino. Then it checks whether the distance to the object is safe to move forward or the vehicle requires braking. If the distance is less than the safe range then the system will activate the braking.

Refer: » Servo motor interfacing with Arduino

» Arduino Relay module interface

In the here system the arduino turns the servo motor from an angle of 45 degrees to 0 degrees. And simultaneously it energizes the relay to disconnect the motor supply. The servo arm is mechanically arranged to brake the shaft of the RC car. It is similar to a disc brake arrangement that uses calipers to squeeze the pad against the disc which is attached to the axle. When the obstruction in front of the sensor unit is removed the system returns to the normal state. Then the servo returns back to 45 degrees and the relay to NC (normally closed) position. In the normal state, the vehicle can drive forward without any system interruption.

Without any mechanical arrangements, the braking can be done by electrically also by shorting the motor terminals to brake mode.  For advanced project applications,  a pneumatic braking mechanism also is used.

Ultrasonic braking using HC-SR04 module

The above ultrasonic braking system is used with a pair of transducer modules with amplifier circuits. The system can be built with an HC-Sr04 ultrasonic module which is more feasible and provides better accuracy.

Refer to the above link of the non-contact distance measuring for ultrasonic module interface with arduino.

ultrasonic car servo braking


#include <Servo.h>

Servo servo;

const int  trig = 2, echo = 3 , relay  = 7;
int distance = 20, normalpos = 40 , brakepos = 0;
// Minimum distance for braking 20 centimeters.
void setup()
  pinMode(trig, OUTPUT);
  pinMode(echo, INPUT);
  pinMode(relay, OUTPUT);

void loop()
  if (radar() < distance) {
    // servo shaft angle for apply brake.
    digitalWrite(relay, HIGH);
    // To disconnect motor supply
  else {
    // servo shaft angle for release brake.
    digitalWrite(relay, LOW);
    // To reconnect motor supply
long radar(void)
  digitalWrite(trig, HIGH);
  digitalWrite(trig, LOW);
  long  dur = pulseIn(echo, HIGH);
  dur = dur / 58;
  return dur;
1 Star2 Stars3 Stars4 Stars5 Stars Rate Us!

You may also like...

21 Responses

  1. Dom says:

    Hello, does this need any relay? I’m doing a project exactly looks the same as yours but mine is just to make the car (simple toy car) stop if there is an obstacle ahead. Does yours would act the same as mine?

    • admin says:

      yes, this project is similar and works same as yours. Here the relay is to disconnect the motor supply while applying the brake. The relay charges only if the obstruction is removed.

  2. Abdullah says:

    Do we need to use any motor driver module?

  3. Yaswanth says:

    Can i get the video to make it

  4. yaswanth says:

    can i use motor shield instead of relay module

  5. Yaswanth says:

    What is the code for L293D

  6. yaswanth says:

    i want circuit diagram with L293D

  7. Harshita Singhal says:

    Hii.. I am doing a similar type of model which stops when it senses an obstacle using ultrasonic sensor. I am using L298N motor driver module. Can you please help with the necessary arduino code and circuit diagram ?.

  8. Dhanu says:

    Can I get the video?

  9. Aadhar says:

    What relay did you use

  10. Aaron says:

    can i get the servo.h code

  11. Vigneshwar says:

    can i get the actual video to make it?

  12. Tripura Pasnur says:

    Hello..my project looks same as yours we are using ultrasonic sensor for measuring distance & whenever the distance is less than a particular distance it should give a warning through a buzzer and if the distance goes beyond that particular distance braking should take place..can u tell us how to apply brakes?

    • admin says:

      First of all, open the supply to the motors using a switching device.
      Then steps to stop the movement of RC car and bring to rest,
      1. Small Disc brakes for RC cars are available, you can install that if possible.
      2. You have to build a brake mechanism, what I built was a mechanism using a servo motor to squeeze a disc connected to the shaft with two plates separated with spring.
      3. Make a switching arrangement to short motor terminals which makes the motor in brake mode.

Leave a Reply

Your email address will not be published. Required fields are marked *