ACKNOWLEDGEMENT
We would like to express our sincere gratitude to all those who contributed to the successful
completion of this project on “Adaptive Cruise Control” using Arduino Uno.
First and foremost, we want to extend our appreciation to our dedicated Prof. Nikhil Kothari,
whose guidance and expertise were invaluable throughout this project. Your insightful
feedback and steady support were instrumental in shaping this work.
We would also like to extend our appreciation to Prof. Purvang Dalal, the Head of the
Department of Electronics and Communication. His inspiring leadership and encouragement
of research initiatives within the department have played a vital role in shaping the direction
of this project . We would also like to thank our fellow batch-mates who provided valuable
insights and suggestions, making this project a collaborative effort .Their contributions were
truly appreciated.
Thank you all for your support and encouragement, without which this project would not
have been possible.
Bhargav Jariwala(EC048)
Dhruv Gangadwala(EC053)
Table of Contents
Sr No. Title Page No.
1 Introduction 1
2 Objective 1
3 Outcome 1
4 Hardware Requirements 2
5 Software Requirements 8
6 Block Diagram 8
7 Process Description 8
8 Pseudocode 9
9 Circuit Diagram and Connection Table 12
10 Arduino Uno Code 14
11 Working Scenarios 24
12 Problem Faced or anticipated in this project 25
13 Lesson Learned 26
14 Conclusion 26
15 Reference 27
1|Page
1. Introduction
The adaptation of new technology in cars is of critical importance in today’s rapidly evolving
automotive sector. To enhance safety, convenience, and an overall stress-free and safe driving
experience. One notable advancement is made by integrating adaptive cruise control into
modern vehicles.
Adaptive cruise control (ACC), which traces its origins back to the early 1990s, was
pioneered by Japanese car manufacturers and has since witnessed numerous advancements in
its functionality [1]. The primary function of ACC is to automatically maintain a safe distance
from vehicles ahead. Unlike regular cruise control, which requires manual speed adjustments,
ACC utilize sensors to monitor the distance between vehicles. As a result, it may
automatically decelerate or accelerate the automobile to match the speed of the vehicle in
front, ensuring that a safe and consistent distance is maintained, which reduces the driver’s
workload and makes driving safer.
2. Objective
The primary objective of this project is to create a prototype model of an adaptive cruise
control (ACC) system using Arduino Uno and . The model will encompass various functions
such as setting the desired speed, increasing, or decreasing speed, exiting the current mode,
and entering ACC mode through the input button. Ultrasonic sensors will be utilized to detect
the distance and speed of objects in front of the vehicle, enabling the ACC system to adjust
the vehicle's speed and maintain a safe distance from the detected objects.
3. Outcome
Developing Adaptive cruise control system have several outcomes, including:
2|Page
Improved safety: The adaptive cruise control system will enhance safety by
maintaining a safe distance from vehicles ahead and promptly responding to changes
in traffic conditions. This outcome will help reduce the risk of rear-end collisions and
improve overall road safety.
Increased driving comfort: By automatically adjusting the vehicle's speed, the ACC
system will relieve the driver from continuously monitoring and adjusting the throttle
and braking. This outcome will result in a more relaxed and comfortable driving
experience, especially during long highway journeys.
Traffic flow optimization: With a widespread adoption of ACC systems, traffic flow
on highways can be better regulated, as vehicles will maintain a more consistent
speed and following distance. This outcome can lead to improved traffic efficiency,
reduced congestion, and smoother traffic transitions.
Increased Efficiency: Adaptive cruise control can optimize fuel consumption and
traffic flow by maintaining a consistent speed and reducing unnecessary acceleration
and deceleration. A successful project may lead to improved fuel efficiency and
reduced traffic congestion.
4. Hardware Requirements
Arduino Uno: The Arduino UNO is a microcontroller board based on the
ATmega328P.
It offers 14 digital input/output pins (6 of which are PWM outputs), 6 analog inputs, a
16 MHz ceramic resonator, USB connectivity, a power jack, an ICSP header, and a
reset button [2].
3|Page
Figure 1. Arduino Uno
LCD Display: 16x2, 16 pins LCD will be used to display necessary information.
Figure 2. LCD Display
Ultrasonic sensor: sensor based on SONAR Technology will be used to measure
distance between sensor and object.
4|Page
Figure 3. Ultrasonic Sensor
Potentiometer: A potentiometer is an electronic device used as an adjustable
voltage divider via a knob or dial. It will allow us to adjust the brightness of
our LCD.
Figure 4. Potentiometer
Push buttons: Total of 5 push buttons will be utilized for input function.
Figure 5. Push Button
5|Page
Battery & Connector Cable: small 9V DC battery to serve as power source with
connector cable to connect battery with circuit.
Figure 6. Battery & Connector cable
Breadboard & Jumper wire: To connect all the component together.
Figure 7. Breadboard with jumper wire [8].
Resistor: It’s a two terminal electronic component which implement electrical
resistance in circuit. It serves various purposes, such as reducing current flow,
adjusting signal levels, dividing voltages, biasing active elements, and terminating
transmission lines, among other essential applications.
6|Page
Figure 8. Resistor
Motor Driver : The L298N is a dual H-Bridge motor driver which allows speed and
direction control of two DC motors at the same time. The module can drive DC
motors that have voltages between 5 and 35V, with a peak current up to 2A.
Figure 9. Motor Driver L289N
DC Motor : Controlling a DC motor's speed is achieved simply by controlling the
voltage of the supply power (within the safe operating range for the motor) using a
potentiometer. DC motors maintain consistent torque across the entire speed range
without the need for additional components. This makes controlling their speed
considerably easier than AC motors, and they are well suited to applications requiring
precise control at any speed.However, further considerations are depending on the
7|Page
requirements of the speed controller. DC controllers operating on AC power require
conversion of the supply using a rectifier. Unlike AC motors, braking or reversing a DC
motor requires additional components, typically a power resistor for braking and a relay
for switching the polarity of the supply power to reverse the motor. It is also necessary to
ensure that the motor has stopped before reversing the polarity of the supply, which
requires a means of sensing when the motor is at a standstill. This can add up to a
significant additional cost, especially for larger applications.
Impact Sensor: Impact sensors, also known as shock or vibration sensors, are
designed to detect impacts to the vehicle.There are 2 levels of detection (depending on
alarm functions).The first stage just chirps the siren if the sensor detects light impacts
to warn away any other possible attack.Heavier impacts cause the alarm to sound
fully. All models are adjustable for sensitivity.Suitable for any alarm with a negative
trigger
Figure 10. Impact Sensor
8|Page
5. Software Requirements
Arduino Uno: Arduino Uno is a versatile software environment for numerical
computation, data analysis, and visualization. It offers wide range of libraries
including one specifically tailored for Arduino. Which will be used for coding in this
project.
6. Block Diagram
Figure 11. Block Diagram
7. Process Description
The model consists of five press buttons, which are the increase and decrease speed buttons,
the cruise control button, the adaptive cruise control button, and the cancel button. Each one
represents different types of functions.
At start, the display indicates an initial speed of zero.
9|Page
While pressing the increase speed button, the speed will increase with time and
decrease upon releasing the button.
Apparently, activating the decreasing speed button will reduce the speed gradually.
When the cruise control button is pressed, the speed will remain constant at the set
speed until an increased or decreased speed is pressed. The mode can be exited by
pressing the cancel button.
Furthermore, when the system is in adaptive cruise control mode, the speed will
remain unchanged at the set speed until any hurdle comes ahead of the safer range,
which will eventually lower the current speed. However, if an obstacle moves away,
the speed will gradually increase to the set speed, and both the increase and decrease
in speed due to the obstacle are carried out automatically. To exit the mode, simply
press cancel.
8. Pseudocode
Program Start
Initialize parameters (such as ports, pins, speed limits, and distances)
Initialize Arduino board
Configure Pins for buttons
Initialize LCD Display and print welcome message
While true
Check the current mode:
If it is in NORMAL mode:
If the increase speed switch is pressed:
If the current speed is less than the top speed:
Increase the current speed by 1
10 | P a g e
Display current speed and mode
END
Else if the decrease speed switch is pressed:
If the current speed is not zero:
Decrease the current speed by 1
Display current speed and mode
END
Else if the set speed switch is pressed:
Change the current mode to CRUISE mode
Else if the adaptive cruise control switch is pressed:
Change the current mode to ADAPTIVE_CRUISE mode
Fix the set speed to the current speed
Else:
If the current speed is not zero:
Decrease the current speed by 1
END
if it is in CRUISE mode:
If the increase speed switch is pressed:
If the current speed is less than the top speed:
Increase the current speed by 1
Else if the decrease speed switch is pressed:
If the current speed is not zero:
Decrease the current speed by 1 Else if
the cancel switch is pressed:
Change the current mode to NORMAL
11 | P a g e
END
if it is in ADAPTIVE_CRUISE mode:
Read distance from the sensor and store it in distance variable
Calculate the safe speed using mean distance
If the cancel switch is pressed:
Change the current mode to NORMAL mode
Else If the current speed is greater than the safe
speed decrease the current speed to the safe speed
Else if the current speed is less than the set speed:
Increase the current speed by 1
Else go with the set speed
END
END
12 | P a g e
9. Circuit Diagram & Connection Table
Figure 12. Circuit Diagram (Made in Thinkercad)
The connections are made using jumper wires, linking the push buttons, ultrasonic sensor,
Potentiometer and LCD to the Arduino on a breadboard. The specific ports on the Arduino to
which each component is connected are as follows:
Connection Table
Liquid Crystal Display
PIN NUMBER DISPRIPTION FUNCTIONALITY CONNECT TO
1 VSS Power Ground GND
2 VDD Power +5V VCC_5V
13 | P a g e
3 Vo Brightness Control Potentiometer Pin 2
4 RS Register Select Arduino Digital Pin 7
5 RW Register Select GND
6 E Read/Write Arduino Digital Pin 6
7 D0 Enable Not Connected
8 D1 Data Pin Not Connected
9 D2 Data Pin Not Connected
10 D3 Data Pin Not Connected
11 D4 Data Pin Arduino Digital Pin 5
12 D5 Data Pin Arduino Digital Pin 4
13 D6 Data Pin Arduino Digital Pin 3
14 D7 Data Pin Arduino Digital Pin 2
15 A Backlight Anode VCC_5V
16 K Backlight Cathode GND
Table 1. Liquid Crystal Display
Ultrasonic Sensor
PIN NUMBER DISPRIPTION FUNCTIONALITY CONNECT TO
1 VCC Power +5V VCC_5V
2 TRIG Enable Pin Arduino Digital Pin 12
3 ECHO Single Output Pin Arduino Digital Pin 13
4 GND Power GND GND
Table 2. Ultrasonic Sensor
14 | P a g e
Potentiometer
PIN NUMBER DISPRIPTION FUNCTIONALITY CONNECT TO
1 Potentiometer Pin 1 Power +5V VCC_5V
2 Potentiometer Pin 2 Voltage Veriation Pin LCD Pin 3(Vo Pin)
3 Potentiometer Pin 3 Power GND GND
Table 3. Potentiometer
Push Buttons
BUTTON FUNCTIONALITY PIN 1 & PIN 2 PIN 3 & PIN 4
INCREASE Increase the speed GND Arduino Pin A5
DECREASE Decrease the speed GND Arduino Pin A4
SET Set speed GND Arduino Pin A3
ACC Select ACC mode GND Arduino Pin A2
CANCEL Push to normal mode GND Arduino Pin A1
Table 4. Push Button
10. Arduino Uno Code
#include <LiquidCrystal.h>
// Define pin numbers
#define increase_speed_switch A5
#define decrease_speed_switch A4
#define set_speed_switch A3
#define acc_switch A2
#define cancel_switch A1
15 | P a g e
// Define switch states
#define switch_pressed 0
#define switch_open 1
// Define top speed and different operating modes
#define top_speed 200
#define NORMAL 0
#define CRUISE 1
#define ADAPTIVE_CRUISE 2
// Initialize variables
int current_speed = 0;
int set_speed = 0;
int current_mode = NORMAL;
long duration;
int distance;
const int trigPin = 9;
const int echoPin = 10;
int impactPin = 13;
int Enable=6;
int dir1=7;
int dir2=8;
int mSpeed=0;
// Define a structure for switch states
struct Switches {
int increase_speed;
int decrease_speed;
int set_speed;
int cancel;
16 | P a g e
int acc;
};
struct Switches swtch;
// Create an LCD object with pin numbers
LiquidCrystal lcd(12, 11, 2, 3, 4, 5);
void setup() {
Serial.begin(9600);
// Set up pin modes for switches
pinMode(increase_speed_switch, INPUT_PULLUP);
pinMode(decrease_speed_switch, INPUT_PULLUP);
pinMode(set_speed_switch, INPUT_PULLUP);
pinMode(acc_switch, INPUT_PULLUP);
pinMode(cancel_switch, INPUT_PULLUP);
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
pinMode(impactPin, INPUT);
// Initialize LCD with 16 columns and 2 rows
lcd.begin(16, 2);
// Welcome message
lcd.print("Welcome!");
delay(1000);
// Clear LCD and display additional messages
lcd.clear();
lcd.print("Adaptive");
lcd.setCursor(0, 1);
lcd.print("Cruise Control");
17 | P a g e
delay(1500);
// Clear LCD and display initial mode and speed
lcd.clear();
lcd.print("MODE: NORMAL ");
lcd.setCursor(0, 1);
lcd.print("CURRENT SPD:0");
delay(1500);
}
void loop() {
Serial.print("Motor Speed ");
Serial.println(mSpeed);
if (mSpeed>255){
mSpeed=255;
}
if (mSpeed==50 || mSpeed==45){
mSpeed=0;
}
if (mSpeed==0){
analogWrite(Enable,0);
digitalWrite(dir1,LOW);
digitalWrite(dir2,LOW);
}
else if (mSpeed>0){
digitalWrite(dir1,LOW);
digitalWrite(dir2,HIGH);
analogWrite(Enable,mSpeed);
}
int val = digitalRead(impactPin); // read input value
if (val == HIGH) {
18 | P a g e
// state of switches
if (digitalRead(increase_speed_switch) == switch_pressed)
swtch.increase_speed = switch_pressed;
else
swtch.increase_speed = switch_open;
if (digitalRead(decrease_speed_switch) == switch_pressed)
swtch.decrease_speed = switch_pressed;
else
swtch.decrease_speed = switch_open;
if (digitalRead(set_speed_switch) == switch_pressed)
swtch.set_speed = switch_pressed;
else
swtch.set_speed = switch_open;
if (digitalRead(cancel_switch) == switch_pressed)
swtch.cancel = switch_pressed;
else
swtch.cancel = switch_open;
if (digitalRead(acc_switch) == switch_pressed)
swtch.acc = switch_pressed;
else
swtch.acc = switch_open;
// Handle different operating modes
switch (current_mode)
{
case NORMAL:
if (swtch.increase_speed == switch_pressed)
19 | P a g e
{
if(mSpeed == 0)
{
mSpeed = 60;
}
mSpeed++;
current_speed=mSpeed-60;
delay(100);
}
else if (swtch.decrease_speed == switch_pressed)
{
// Decrease speed if the decrease speed switch is pressed
if(mSpeed>0)
{
mSpeed--;
if(current_speed>0)
{
current_speed=mSpeed-60;
delay(100);
}
}
}
else if (swtch.set_speed == switch_pressed) {
current_mode = CRUISE;
}
else if (swtch.acc == switch_pressed) {
current_mode = ADAPTIVE_CRUISE;
set_speed = current_speed;
}
else {
20 | P a g e
// Decrease speed gradually if no switch is pressed
if(mSpeed>0){
mSpeed--;
if(current_speed>0){
current_speed=mSpeed-60;
delay(300);
}
}
}
// Update and display the current mode and speed on the LCD
lcd.clear();
lcd.print("MODE: NORMAL");
lcd.setCursor(0, 1);
lcd.print("CURRENT SPD:" + String(current_speed));
delay(100);
break;
case CRUISE:
// Handle CRUISE mode
if (swtch.increase_speed == switch_pressed) {
if(mSpeed == 0){
mSpeed = 60;
}
mSpeed++;
current_speed=mSpeed-60;
delay(100);
} else if (swtch.decrease_speed == switch_pressed) {
if(mSpeed>0){
21 | P a g e
mSpeed--;
if(current_speed>0){
current_speed=mSpeed-60;
delay(100);
}
}
}
else if (swtch.cancel == switch_pressed) {
// Switch back to NORMAL mode if the cancel switch is pressed
current_mode = NORMAL;
}
else if (swtch.acc == switch_pressed) {
// Switch to ADAPTIVE_CRUISE mode if the acc switch is pressed
current_mode = ADAPTIVE_CRUISE;
set_speed = current_speed;
}
// Update and display the current mode and speed on the LCD
lcd.clear();
lcd.print("MODE: CRUISE");
lcd.setCursor(0, 1);
lcd.print("CURRENT SPD:" + String(current_speed));
delay(100);
break;
case ADAPTIVE_CRUISE:
// Handle ADAPTIVE_CRUISE mode
digitalWrite(trigPin,LOW);
delay(2);
digitalWrite(trigPin,HIGH);
delay(10);
digitalWrite(trigPin,LOW);
22 | P a g e
duration= pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
Serial.print("Distance: ");
Serial.println(distance);
if (swtch.cancel == switch_pressed) {
// Switch back to NORMAL mode if the cancel switch is pressed
current_mode = NORMAL;
}
if (swtch.set_speed == switch_pressed) {
// Switch to CRUISE mode if the set speed switch is pressed
current_mode = CRUISE;
}
if (current_speed > distance)
{
current_speed = round(distance);
mSpeed=current_speed+60;
}
else {
if (current_speed < set_speed)
{
current_speed++;
mSpeed=current_speed+60;
}
}
23 | P a g e
// Update and display the current mode and speed on the LCD
lcd.clear();
lcd.print("MODE: ACC");
lcd.setCursor(0, 1);
lcd.print("CURRENT SPD:" + String(current_speed));
delay(300);
break;
default:
// Set the mode back to NORMAL in case of an unknown state
current_mode = NORMAL;
}
}else {
lcd.clear();
mSpeed=0;
if (mSpeed==0){
analogWrite(Enable,0);
digitalWrite(dir1,LOW);
digitalWrite(dir2,LOW);
}
current_speed=0;
delay(100);
lcd.print("Impact");
lcd.setCursor(0, 1);
lcd.print("CURRENT SPD:" + String(current_speed));
delay(10000);
}
delay(50);
24 | P a g e
}
11. Working Scenarios
Normal Mode:
Figure 11. Working Scenario (Normal Mode)
On startup, the device will be in the normal mode by default. When the Increase speed button
is pressed and held, the speed will gradually increase up to top speed until the button is
released. Similarly, when the Decrease speed button is pressed and held, the speed gradually
decreases until it reaches 0. However, without changing to a different mode, the speed will
gradually decrease if no button is pressed. The Cancel button does not have any functionality
in this mode.
Cruise control/Set speed mode:
25 | P a g e
Figure 12. Working Scenario (Cruise control/Set speed Mode)
In cruise control or set speed mode, the device maintains a constant speed that was set using
the Set speed button. The Increase speed and Decrease speed buttons remain functional,
allowing adjustments to the set speed. Pressing the Cancel button exits the cruise control
mode, and the vehicle gradually slows down to a stop.
Adaptive Cruise Control (ACC) Mode:
Figure 13. Working Scenario (Cruise control/Set speed Mode)
In the adaptive cruise control mode, the device will maintain a constant speed set using the
Adaptive speed button until a vehicle or object is detected in front. The system automatically
reduces the speed in response to the detected obstacle and, once the space becomes clear,
gradually accelerates to reach the set speed again. The display blinks to indicate the adaptive
cruise control mode, and pressing the Cancel button exits the mode.
12. Problem faced or anticipated in this project
Given our limited knowledge of circuit programming, we acknowledge that there may be a
steeper learning curve for us. Nevertheless, we are determined to invest the extra effort
26 | P a g e
required to gain a comprehensive understanding of coding and apply it effectively to our
project.
13. Lesson Learned
The Adaptive Cruise Control project was a valuable learning experience, emphasizing
teamwork, problem-solving, and hardware-software integration. Successful implementation
showcased effective collaboration, iterative development, and thorough testing. The project
sparked interest in embedded systems and left the team equipped with new skills and
knowledge for future endeavors.
14. Conclusion
In conclusion, the project successfully illustrated the integration of Arduino Uno and the
Arduino platform for developing a vehicle speed control system by highlighting the
importance of merging electronics and programming to improve vehicle safety in the
automation field. This smart integration of Arduino and Arduino Uno allowed real-time
analysis of sensor data, enabling the device to automatically adjust vehicles’ speeds to
maintain a safe distance from the preceding car. The benefits of ACC include accident
reduction, improved safety, and many more. However, it is important to acknowledge the
limitations of this device, such as harsh environmental conditions and its reliability, which
create room for further future improvement.
27 | P a g e
Reference
[1] H. A. Research, “What is adaptive cruise control?,” Car and Driver,
https://www.caranddriver.com/research/a32813983/adaptive-cruise-control/ (accessed
Jun. 25, 2023).
[2] “Understanding Arduino Uno Hardware Design - technical articles,” All About
Circuits, https://www.allaboutcircuits.com/technical-articles/understanding-
arduinouno-hardware-design/ (accessed Jun. 25, 2023).
[3] T. A. Team, “Uno R3,” Arduino Documentation,
https://docs.arduino.cc/hardware/uno-rev3 (accessed Jun. 25, 2023).
[4] T. A. Team, “Liquid Crystal Displays (LCD) with Arduino,” Arduino Documentation,
https://docs.arduino.cc/learn/electronics/lcd-displays (accessed Jun. 25, 2023).
[5] Anon et al., “Ultrasonic sensor HC-SR04 and Arduino - Complete Guide,” How To
Mechatronics, https://howtomechatronics.com/tutorials/arduino/ultrasonic-sensor-
hcsr04/ (accessed Jun. 25, 2023).
[6] codebender_cc and Instructables, “How to use potentiometer - arduino tutorial,”
Instructables, https://www.instructables.com/How-to-use-Potentiometer-
ArduinoTutorial/ (accessed Jul. 24, 2023).
[7] "Using Push Button Switch with Arduino UNO," 07 2016. [Online]. Available:
https://electrosome.com/switch-arduino-uno/. (accessed Jun. 25, 2023).
[8] “9V Battery HW high-quality with connector,” Calcutta Electronics,
https://calcuttaelectronics.com/product/9v-battery-hw-high-quality-with-connector/
(accessed Jun. 25, 2023).
[9] “How to use a Breadboard,” Science Buddies,
https://www.sciencebuddies.org/sciencefair-projects/references/how-to-use-
28 | P a g e
abreadboard#:~:text=A%20breadboard%20is%20a%20rectangular,(light%2Demitting
%20diode). (accessed Jul. 24, 2023
[10] “Breadboard Jumper Wire,” Makerfabs,
https://www.makerfabs.com/breadboardjumper-wire-pack-60-pcs.html (accessed Jun.
25, 2023).
[11] Brutha, “Reading resistor values - newbie question!,” Arduino Forum,
https://forum.arduino.cc/t/reading-resistor-values-newbie-question/554607 (accessed
Jul. 24, 2023).
29 | P a g e