Voice Controlled Car Powered by Arduino

 


 

Introduction:

The automotive industry has come a long way since the invention of the automobile. From steam-powered vehicles to electric cars, we've witnessed an astonishing evolution. But the future of transportation is even more exciting as cutting-edge technologies continue to merge with everyday vehicles. In this blog post, we'll explore the fascinating world of Voice Controlled Cars and how you can create your own using Arduino.

The Power of Voice Technology:

Voice-controlled devices have become an integral part of our lives, revolutionizing how we interact with technology. With the advent of smart speakers and virtual assistants, voice commands have grown in popularity due to their ease of use and seamless integration. Now, imagine applying the same voice control to your car, making your driving experience not only safer but also more convenient.

Introducing Arduino:

Arduino is an open-source electronics platform that has empowered countless enthusiasts and engineers to bring their innovative ideas to life. It's an incredibly versatile platform, perfect for designing projects like the Voice Controlled Car. Arduino boards are equipped with various input/output pins, allowing you to connect sensors, actuators, and communication modules effortlessly.

Components Required:

  1. Arduino Board ( Arduino Uno )
  2. Motor Driver ( L298N )
  3. Bluetooth Module (HC-05)
  4. Motor and Chassis
  5. Power Supply 
  6. Smartphone (with a voice assistant app
  7.  
  8.  L298N Motor Driver Module:
  9. L298N module is a high voltage, high current dual full-bridge motor driver module for controlling DC motor and stepper motor. It can control both the speed and rotation direction of two DC motors. This module consists of an L298 dual-channel H-Bridge motor driver IC. This module uses two techniques for the control speed and rotation direction of the DC motors. These are PWM – For controlling the speed and H-Bridge – For controlling rotation direction. These modules can control two DC motor or one stepper motor at the same time.   
  10. L298N Motor Driver Pinout:

    The L298N motor driver module has a specific pinout that corresponds to its various functionalities. Here is the pinout description of the L298N motor driver module.

    VCC This pin is used to connect an external power source (up to 12V) to power the motors.

    GND This pin is the ground connection for the module and should be connected to the ground of the power source and the control signal source (Arduino).

    5V This pin provides a regulated 5V output that can be used to power external components or provide logic voltage to the control signal source.

    ENA & ENB This pin is used to enable or disable the motor connected to Channel A and Channel B. It is responsible for controlling the speed of the motor through PWM (Pulse Width Modulation) signals.

    IN1, IN2, IN3, IN4 This input pin is used to control the direction of rotation for the motor connected to Channel A, similarly IN3 & IN4 for Channel B. By providing appropriate logic levels (HIGH or LOW), you can set the desired direction. This pins are connected to Arduino digital pins for receiving (HIGH or LOW) signal.

    OUT-1 & OUT-2 The pin mentioned is intended for connecting the motors. Specifically, one motor should be connected to OUT-1 & OUT-2 while the other motor should be connected to OUT-3 & OUT-4 . It is important to note that the motors can be connected within a voltage range of 5V to 35V. However, it's worth considering that there will be an approximate 2-volt reduction in the output voltage compared to the voltage applied to the Vcc pin. 

     
  11. HC-05 Bluetooth Module:
  12. The HC-05 is a widely used Bluetooth module that provides a convenient and reliable way to add wireless communication capabilities to electronic devices. It supports serial communication via UART (Universal Asynchronous Receiver-Transmitter) protocol.

    The HC-05 module supports the Bluetooth version 2.0 specification and can be configured as a Master or Slave device through AT commands, depending on the desired application. In the Master mode, it can initiate connections with other Bluetooth devices, while in the Slave mode, it can accept incoming connections.
  13.  
  14. HC-05 Pinout

  15.  
  16.   The HC-05 Bluetooth module has a specific pinout that corresponds to its various functionalities. Here is the pinout description of the HC-05 Bluetooth module.

    VCC This pin is used to provide power to the module. It typically operates at a voltage range of 3.3V to 6V.

    GND This pin is the ground connection for the module and should be connected to the ground of the power source and the control signal source.

    TXD This pin is the transmit data pin and is used to send data from the module to another device. It should be connected to the receive pin (RX) of the receiving device.

    RXD This pin is the receive data pin and is used to receive data from another device. It should be connected to the transmit pin (TX) of the transmitting device.

    STATE This pin is an optional pin that can be used to check the state of the module. It can be configured to provide information about the module's connection status or other relevant information.

    EN This pin is used to enable or disable the module (Command & Data mode). When this pin is pulled HIGH (3.3V or 5V), the module is enabled (command mode), and when it is pulled LOW (0V or GND), the module is disabled (data mode).

Building the Voice Controlled Car:

Step 1: Assembling the Hardware Start by assembling the motor and chassis to create the physical base of the car. Connect the motors to the motor driver (L298N) and secure it to the chassis. The motor driver will allow you to control the direction and speed of the motors. Next, connect the motor driver (L298N) module to the Arduino board.


Step 2: Setting up the Bluetooth Module Attach the Bluetooth module (HC-05) to the Arduino board. This module will enable communication between your smartphone and the Voice Controlled Car. Make sure to follow the circuit diagram or instructions for the Bluetooth module to establish a stable connection.

Step 3: Writing the Code Now comes the programming part. Utilize the Arduino IDE to write the code that will interpret the voice commands and control the car's movements accordingly. You may need to use libraries for the Bluetooth module and other components you're using.

Step 5: Implementing Voice Commands Define a set of voice commands that the car will recognize. For example, "forward," "backward," "left," and "right" are essential instructions to control the car's movement.

Step 6: Connecting to a Voice Assistant To make the Voice Controlled Car even smarter, integrate your smartphone's voice assistant app (which you downloaded). Pair your smartphone with the Bluetooth module on the car. This way, the phone will act as the voice input source, and the Arduino code will process the voice commands received via Bluetooth.

Voice Controlled Car Powered by Arduino Circuit Diagram


 

Connections:
Arduino and HC-05 Bluetooth Module:

  • Connect the TX pin of the Bluetooth module to the 10 pin of the Arduino.
  • Connect the RX pin of the Bluetooth module to the 11 pin of the Arduino.
  • Connect the VCC and GND pins of the Bluetooth module to the appropriate power (+5V)        and ground pins on the Arduino.

Arduino and Motor Driver Module:

  • Connect the digital output pins of the Arduino (digital pins 3, 4, 5, and 6) to the appropriate input pins (IN1, IN2, IN3, and IN4) on the motor driver module.
  • Connect the OUT1, OUT2, OUT3, and OUT4 pins of the motor driver module to the appropriate terminals of the motors.
  • Connect the VCC (+5V) and GND pins of the motor driver module to the appropriate power (Vin) and ground (GND) connections on the Arduino.
Power Supply:
  • Connect the positive terminal of the power supply to the Vin Pin of the Arduino.
  • Connect the negative terminal of the power supply to the GND pin of the Arduino.
  •  Connect the 5V pin of the Arduino to the 5V pin of the motor driver module.
  • Connect the GND pin of the Arduino to the GND pin of the motor driver module.

 Setup the Android App for controlling

 To connect the Bluetooth-controlled car with your phone, follow these steps:

  • Open the "Arduino Bluetooth Voice Controll" app on your Android device.
  • Turn on the Bluetooth on your phone by going to your phone's settings.
  • Connect your phone to the HC-05 Bluetooth module by clicking bluetooth icon of the app. If you have a new HC-05 module, there is an additional step before connecting.
  • Go to the Bluetooth settings on your phone.
  • Search for Bluetooth devices.
  • You will find a Bluetooth device named HC-05.
  • Pair the Bluetooth device with your phone by selecting it.
  • During the pairing process, you will be prompted to enter a password.
  • The default password for HC-05 is usually either 1234 or 0000.
  • Enter the password and proceed with the pairing process.
  • Once the pairing is successful, your Voice Controlled Car is now connected to your Android device.

 


 

Conclusion:

Building a Voice Controlled Car using Arduino is an exciting project that combines modern technology with traditional automotive engineering. Through the seamless integration of voice commands, you can now navigate your car with ease, keeping both hands on the steering wheel and your attention on the road. This project not only showcases the power of Arduino but also demonstrates the incredible potential that lies in combining emerging technologies to create innovative and efficient solutions for our everyday lives.

Remember, as with any DIY project, safety is paramount. Always test your Voice Controlled Car in controlled environments and adhere to local laws and regulations when operating it in public spaces. Happy tinkering!

Code
//The Code Is Written By SovanHax
//YouTube Channel Link:- https://www.youtube.com/SovanHax
 #include <SoftwareSerial.h>
SoftwareSerial BT(10, 11); //TX, RX 
String readvoice;
int RMF = 3; // IN1
int RMB = 4; //  IN2
int LMF = 5; // IN3
int LMB = 6; // IN4
void setup() {
 BT.begin(9600);
 Serial.begin(9600);
   	pinMode (RMF, OUTPUT); 
  	pinMode (RMB, OUTPUT);
  	pinMode (LMF, OUTPUT);
  	pinMode (LMB, OUTPUT);
	}
void loop() {
  	while (BT.available()){ 
  	delay(10); 
  	char c = BT.read(); 
  	readvoice += c; 
  	} 

if (readvoice.length() > 0) {
    
    Serial.println(readvoice);

if(readvoice == "forward")
  	{
    digitalWrite(RMF, HIGH);
    digitalWrite (LMF, HIGH);
    digitalWrite(RMB,LOW);
    digitalWrite(LMB,LOW);
    delay(100); 
    }
else if(readvoice == "back")
  	{ 
  	digitalWrite(RMF, LOW);
    digitalWrite(LMF, LOW);
    digitalWrite(RMB, HIGH);
    digitalWrite(LMB,HIGH);
    delay(100); 
    }
 else if (readvoice == "left")
  	{ 
  	digitalWrite (RMF,HIGH);
    digitalWrite (LMF,LOW);
    digitalWrite (RMB,LOW);
    digitalWrite (LMB,LOW);
   	delay (100);
    }
 else if ( readvoice == "right")
 	{
    digitalWrite (RMF, LOW);
   	digitalWrite (LMF, HIGH);
   	digitalWrite (RMB, LOW);
   	digitalWrite (LMB, LOW);
   	delay (100);
    }
 else if (readvoice == "stop")
 	{
    digitalWrite (RMF, LOW);
   	digitalWrite (LMF, LOW);
  	digitalWrite (RMB, LOW);
   	digitalWrite (LMB, LOW);
  	delay (100);}
else if (readvoice == "off")
	{ 
    digitalWrite (RMF, LOW);
  	digitalWrite (LMF, LOW);
   	digitalWrite (RMB, LOW);
   	digitalWrite (LMB, LOW);
   	delay (100);
    }
else if (readvoice == "garba dance"){
	digitalWrite (RMF, LOW);
 	digitalWrite (RMB, HIGH);
 	digitalWrite (LMF, LOW);
 	digitalWrite (LMB, LOW);
 	delay (400);
    digitalWrite(RMF, HIGH);
    digitalWrite (RMB, LOW);
    digitalWrite(LMF,HIGH);
    digitalWrite(LMB,LOW);
    delay(600);
    digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, HIGH);
   	digitalWrite (LMB, LOW);
   	delay (500);
   	digitalWrite (RMF, HIGH);
   	digitalWrite (RMB, LOW);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, HIGH);
   	delay (500);
	digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, LOW);
   	delay (400);
    digitalWrite(RMF, HIGH);
    digitalWrite (RMB, LOW);
    digitalWrite(LMF,HIGH);
    digitalWrite(LMB,LOW);
    delay(600);
    digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, HIGH);
   	digitalWrite (LMB, LOW);
   	delay (500);
   	digitalWrite (RMF, HIGH);
   	digitalWrite (RMB, LOW);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, HIGH);
   	delay (500);
   	digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, LOW);
   	delay (400);
    digitalWrite(RMF, HIGH);
    digitalWrite (RMB, LOW);
    digitalWrite(LMF,HIGH);
    digitalWrite(LMB,LOW);
    delay(600);
    digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, HIGH);
   	digitalWrite (LMB, LOW);
   	delay (500);
   	digitalWrite (RMF, HIGH);
   	digitalWrite (RMB, LOW);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, HIGH);
   	delay (500);
   	digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, LOW);
   	delay (400);
    digitalWrite(RMF, HIGH);
    digitalWrite (RMB, LOW);
    digitalWrite(LMF,HIGH);
    digitalWrite(LMB,LOW);
    delay(600);
    digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, HIGH);
   	digitalWrite (LMB, LOW);
   	delay (500);
   	digitalWrite (RMF, HIGH);
   	digitalWrite (RMB, LOW);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, HIGH);
   	delay (500);
   	digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, LOW);
   	delay (400);
    digitalWrite(RMF, HIGH);
    digitalWrite (RMB, LOW);
    digitalWrite(LMF,HIGH);
    digitalWrite(LMB,LOW);
    delay(600);
    digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, HIGH);
   	digitalWrite (LMB, LOW);
   	delay (500);
   	digitalWrite (RMF, HIGH);
   	digitalWrite (RMB, LOW);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, HIGH);
   	delay (500);
   	digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, LOW);
   	delay (400);
    digitalWrite(RMF, HIGH);
    digitalWrite (RMB, LOW);
    digitalWrite(LMF,HIGH);
    digitalWrite(LMB,LOW);
    delay(600);
    digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, HIGH);
   	digitalWrite (LMB, LOW);
   	delay (500);
   	digitalWrite (RMF, HIGH);
   	digitalWrite (RMB, LOW);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, HIGH);
   	delay (500);
   	digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, LOW);
   	delay (400);
    digitalWrite(RMF, HIGH);
    digitalWrite (RMB, LOW);
    digitalWrite(LMF,HIGH);
    digitalWrite(LMB,LOW);
    delay(600);
    digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, HIGH);
   	digitalWrite (LMB, LOW);
   	delay (500);
   	digitalWrite (RMF, HIGH);
   	digitalWrite (RMB, LOW);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, HIGH);
   	delay (500);
   	digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, LOW);
   	delay (400);
    digitalWrite(RMF, HIGH);
    digitalWrite (RMB, LOW);
    digitalWrite(LMF,HIGH);
    digitalWrite(LMB,LOW);
    delay(600);
    digitalWrite (RMF, LOW);
   	digitalWrite (RMB, HIGH);
   	digitalWrite (LMF, HIGH);
   	digitalWrite (LMB, LOW);
   	delay (500);
   	digitalWrite (RMF, HIGH);
   	digitalWrite (RMB, LOW);
   	digitalWrite (LMF, LOW);
   	digitalWrite (LMB, HIGH);
   	delay (500);
 	}
readvoice="";
	}}

Post a Comment