Introduction: Arduino Robot With Distance , Direction and Degree of Rotation (East, West, North, South) Controlled by Voice Using Bluetooth Module and Autonomous Robot Movement.

This Instructable explains how to make Arduino Robot which can be moved in required direction ( Forward, Backward , Left , Right, East, West , North , South) required Distance in Centimetres using Voice command. Robot can also be moved autonomously using Voice command.

Input using Voice command:

1st Parameter - #forward or #reverse or #left or #right or #auto or #angle

2nd Parameter - Distance 100 or Angle 300

Eg: - 1) Forward Distance 100 Angle 300 – Rotate the car to 300 degree using GY-271 and move forward

100 Centimetres

2) Forward Angle 300 Distance 100 – Angle and Distance commands can be in any sequence

3) Forward Distance 100 – Move forward 100 Centimetres

4) Forward Angle 300 – Rotate the car to 300 degrees and move in forward direction until next

command

5) auto – Moves the car in Autonomous mode avoiding obstacle

7) angle 300 -- Rotate the car to 300 degrees.

Step 1: Parts List

Below is the list of parts required for making this project, some of them are optional.

You can make your own chassis or can purchase any 3Wheel or 4Wheel robot car chassis from amazon its very cheap.

1. Arduino Uno R3 (Other Arduino boards can also be used)

2. Bluetooth module HC – 02

3. HMC5883L (GY-271)

4. Ultrasonic Sensor HC SR04 with Servo Mounting plates (Optional : Mounting Plates)

5. L298N Motor Driver (L293D Can also be used)

6. Bread Board Power Supply MB-102 (Optional : Voltage Regulator 7805 can also be used )

7. Bread Board

8. 2 Encoder Motor with hall effect sensor (BO motor with Opto Coupler sensor can also be used)

9. 9 V Battery (Qty. 1) (Separate battery for Motor is recommended)

10. 6 X AA battery with Battery Holder ( For Supplying power to Arduino board and Sensors)

11. Jumper Wires

12. Micro Servo Motor

13. 4 Wheel or 3 Wheel Car Chassis with wheels

Step 2: Assemble Robot Chasis and Connect Motors to Arduino Through Motor Drivers

Assemble 3 Wheel drive or 4 Wheel Drive robot chassis and connect Encoder motors to Arduino board through L298N motor drivers.

Encoder Motor: DC Geared Motor featuring an additional magnetic quadrature type rotary encoder. The quadrature encoders provide two pulses which are out of phase, for sensing the direction of the shaft rotation as well as speed and distance travelled.

Encoder provides 540 pulses per rotation of motor shaft which is counted by Arduino counter using interrupt pins of Arduino.

I am using only one output of encoder as I am not interested in knowing the direction of shaft movement for this instructable.

Connections:

Inp 1 L298N Motor Driver -- Arduino Pin 6

Inp 2 L298N Motor Driver -- Arduino Pin 7

Inp 3 L298N Motor Driver -- Arduino Pin 8

Inp 4 L298N Motor Driver -- Arduino Pin 9

M1 L298N Motor Driver -- Encoder Motor Left M1

M2 L298N Motor Driver -- Encoder Motor Left M2

M1 L298N Motor Driver -- Encoder Motor Right M3

M2 L298N Motor Driver -- Encoder Motor Right M4

CHA Encoder Motor Left -- Arduino Pin 2

CHA Encoder Motor Right -- Arduino Pin 3

Arduino UNO Input Voltage -- 5V regulated

Encoder Motor Input Voltage -- 5V regulated

L298N Motor Driver -- 5V to 9V

Step 3: Connet Bluetooth Module to Arduino

Connect Bluetooth Module to Arduino board which will accept

voice inputs from mobile app over Bluetooth. Voice input to Arduino will be in the form of string with multiple words separated by Space.

Code will split the words in the string and assign them to variables.

Link to download to Android App: https://amr-voice.en.aptoide.com/

Eg. Voice Input: Forward Distance 100 angle 50

Arduino Pin 0 -- HC-02 TX

Arduino Pin 1 -- HC-02 RX

HC-02 Input Voltage -- 5V Regulated

Step 4: Connect GY-271 to Arduino

Connect GY-271 to Arduino which be used to get the heading position of the robot and for moving robot in desired degree from (0 to 365 – 0 and 365 degree North, 90 degree as East, 180 degree as South and 270 degree as West)

Connections:

GY-271 SCL -- Arduino Analog Input A5

GY-271 SCA -- Arduino Analog Input A4

Input Voltage to GY-271 -- 3.3 V regulated

Please Note: Use the example code given in library to test the module first.

Step 5: Connect Micro Servo Motor and Ultrasonic Sensor HC SR04 to Arduino

Connect Micro Servo motor and Ultrasonic Sensor HC SR04 to

Arduino. Ultrasonic sensor is used to measure the distance of the objects and Server motor is used to move the ultrasonic sensor left and right when object is close to robot which will help the robot to move in any direction without colliding with objects or walls.

Mount the Ultrasonic sensor on to servo motor using mounting board.

Connections:

Micro Servo Signal Pin -- Arduino Pin 10

HC SR04 Trig Pin -- Arduino Pin 11

HC SR04 Echo Pin -- Arduino Pin 12

Input Voltage to Servo Motor -- 5V Regulated

Input Voltage to HC SR04 -- 5V Regulated

Step 6: Code, Libraries and Link to Download Andorid App

Code has been attached. Link for downloading libraries

1) TimerOne - https://github.com/poipoi/TimerOne-r11

2) QMC5883L - https://github.com/dthain/QMC5883L

3) NewPing - https://github.com/eliteio/Arduino_New_Ping

App link : https://amr-voice.en.aptoide.com/

Code can be further optimized to reduce the number of lines.

Thank you and please msg me incase if anyone has any queries.

Arduino Contest 2019

Participated in the
Arduino Contest 2019