nano arduino car

Robotics Projects: Development of the Following a Human Robot Control Using Arduino with Ultrasound Sensors

INTRODUCTION

If you’re into the field of technology or you simply like playing with electricians, you must have heard of the Arduino Nano. The Arduino Nano has become one of the most used microcontroller in the maker community due to its small size and strong strength. In this blog, we will go through why the Arduino Nano is different, we’re discussing the cost, a pin configuration, a rest of its specs.

1. Compact Yet Powerful

The Arduino Nano has a reputation for being small, perfect for projects that need a small footprint. Even as small as it is, it doesn’t skimp on power – delivering the same performance level of the larger Arduino boards like the Uno.

2. Affordable Arduino Cost

Budget is a big deal when you are working on budget DIY projects. The good news is that an Arduino Nano has all the basic features of an Arduino at a fraction of the price. This, combined with the number of products ST offers for that family, makes it the choice of hobbyists and professionals alike, which need reliable microcontrollers without having to bust the bank.

3. Flexible Pin Configuration

The 30 pins of the Arduino Nano pin configuration make it flexible and capable of interfacing to a number of sensors, LEDs, etc. From the Arduino Nano pin diagram, it is very easy to add peripherals, which makes this board good for beginners as well as experts.

4. Wide Range of Applications

The Arduino Nano is capable of being used in anything from robotics to home automation. It also goes with multiple shields plus modules and so you can construct across various projects all the way from happy LED bouncing to IoT mania!

5. Simple Pinout for Beginners

If you’re new to electronics, you will not have any trouble in understanding the Arduino Nano pin configuration. Pinout is simple and logical, which is very easy for beginners to start making fun with various components without being overwhelmed.

Now, being the first MRP writer, I feel like this project is unique.

Making a human following robot is quite a fascinating thing to do using arduino and three ultrasonic sensors. Unlike the standard setup having one ultrasonic sensor, two ir sensors and servo motor in this project, two ultrasonic sensors have been used. This change simplifies the navigation of the robot and also increases the navigational competence of the robot.

Component Requirements

Components you need to build a human following robot are.

  • Board of the Arduino UNO
  • 3 units of ultrasonic sensors
  • L298N motor driver
  • Bot chassis
  • 2 DC motors
  • Wheels
  • A 3.7 V two lithium ion batteries,
  • Battery holder
  • A breadboard
  • Ultrasonic sensors holders
  • Switches and jumper wires

Application of human following robot schematic diagram

Determine the schematic representation that visually communicates the following:

The arduino board is connected to Ultrasonic sensors (left, right and front) to the peripheral pins of the arduino board .

Peripheral pins of the arduino board to the motor driver module.

Sending motors to pins of the motor driver module.

Li-ion batteries as the power source to the motor driver module.

Guidance in sense of connection step by step

Make the following connections:

Users should connect the VCC pins of the ultrasonic sensors with the 5V pin of the Arduino users.

The user should connect each ultrasonic sensors’ GND pins to the Arduino user’s GND pin.

The 2nd, 4th and 6th Digital pin of the Arduino users should be connected to the trigger pins (TRIG).

It has to be connected to third, fifth and seventh digital pin of the Arduino Users.

Next we can do wiring the arduino and motor driver module.

You need to connect:

The Arduino’s digital output pins (8, 9, 10 and 11) to the input pins of motor driver module (IN1, IN2, IN3, IN4)

ENA and ENB toes all have the high state pin passing through a female header.

Power Supply Wiring

You need to connect:

Connecting the power supply’s +12V to the corresponding motor driver module input – +12V input.

Connect one of the negative terminals of the power supply to the GND pin of the motor driver module.

From the motor driver module to the Arduino its GND pin to the GND pin of the motor driver module.

Perspective Summary

In this project, we have presented a project that consists of building an Arduino based human following robot using three ultrasonic sensors. This is a great project, with programming, electronics and mechanics. This has wide application of the Arduino board and low priced parts grants people the ability to make their own human following robots.

This Thesis describes potential applications of human following robots offered as solutions to four of the issues.

Applications for human-following robots are endless:

  • In malls, in hotel to help customers in retail stores
  • Its uses for security and surveillance purposes.
  • Entertainment and in events.
  • For elder care
  • Guided tour
  • Research and development
  • It has education and research purposes.
  • Personal robotics

It is then applied to new applications as the knowledge of robotic grows.


CODE FOR THE PROJECT

#define S1Trig 2

#define S2Trig 4

#define S3Trig 6

#define S1Echo 3

#define S2Echo 5

#define S3Echo 7

// Motor control pins

#define LEFT_MOTOR_PIN1 8

#define LEFT_MOTOR_PIN2 9

#define RIGHT_MOTOR_PIN1 10

#define RIGHT_MOTOR_PIN2 11

// Distance thresholds for obstacle detection

#define MAX_DISTANCE 40

#define MIN_DISTANCE_BACK 5

// Maximum and minimum motor speeds

#define MAX_SPEED 150

#define MIN_SPEED 75

void setup() {

  // Set motor control pins as outputs

  pinMode(LEFT_MOTOR_PIN1, OUTPUT);

  pinMode(LEFT_MOTOR_PIN2, OUTPUT);

  pinMode(RIGHT_MOTOR_PIN1, OUTPUT);

  pinMode(RIGHT_MOTOR_PIN2, OUTPUT);

  //Set the Trig pins as output pins

  pinMode(S1Trig, OUTPUT);

  pinMode(S2Trig, OUTPUT);

  pinMode(S3Trig, OUTPUT);

  //Set the Echo pins as input pins

  pinMode(S1Echo, INPUT);

  pinMode(S2Echo, INPUT);

  pinMode(S3Echo, INPUT);

  // Initialize the serial communication for debugging

  Serial.begin(9600);

}

void loop() {

  int frontDistance = sensorOne();

  int leftDistance = sensorTwo();

  int rightDistance = sensorThree();

  Serial.print(“Front: “);

  Serial.print(frontDistance);

  Serial.print(” cm, Left: “);

  Serial.print(leftDistance);

  Serial.print(” cm, Right: “);

  Serial.print(rightDistance);

  Serial.println(” cm”);

  // Find the sensor with the smallest distance

  if (frontDistance < MIN_DISTANCE_BACK) {     moveBackward();     Serial.println("backward");   } else if (frontDistance < leftDistance && frontDistance < rightDistance && frontDistance < MAX_DISTANCE) {     moveForward();     Serial.println("forward");   }else if (leftDistance < rightDistance && leftDistance < MAX_DISTANCE) {     turnLeft();     Serial.println("left");   } else if (rightDistance < MAX_DISTANCE) {     turnRight();     Serial.println("right");       } else {     stop();     Serial.println("stop");   }   delay(100); // Delay for stability and to avoid excessive readings } // Function to measure the distance using an ultrasonic sensor int sensorOne() {   //pulse output   digitalWrite(S1Trig, LOW);   delayMicroseconds(2);   digitalWrite(S1Trig, HIGH);   delayMicroseconds(10);   digitalWrite(S1Trig, LOW);   long t = pulseIn(S1Echo, HIGH);//Get the pulse   int cm = t / 29 / 2; //Convert time to the distance   return cm; // Return the values from the sensor } //Get the sensor values int sensorTwo() {   //pulse output   digitalWrite(S2Trig, LOW);   delayMicroseconds(2);   digitalWrite(S2Trig, HIGH);   delayMicroseconds(10);   digitalWrite(S2Trig, LOW);   long t = pulseIn(S2Echo, HIGH);//Get the pulse   int cm = t / 29 / 2; //Convert time to the distance   return cm; // Return the values from the sensor } //Get the sensor values int sensorThree() {   //pulse output   digitalWrite(S3Trig, LOW);   delayMicroseconds(2);   digitalWrite(S3Trig, HIGH);   delayMicroseconds(10);   digitalWrite(S3Trig, LOW);   long t = pulseIn(S3Echo, HIGH);//Get the pulse   int cm = t / 29 / 2; //Convert time to the distance   return cm; // Return the values from the sensor } // Motor control functions void moveForward() {   analogWrite(LEFT_MOTOR_PIN1, MAX_SPEED);   analogWrite(LEFT_MOTOR_PIN2, LOW);   analogWrite(RIGHT_MOTOR_PIN1, MAX_SPEED);   analogWrite(RIGHT_MOTOR_PIN2, LOW); } void moveBackward() {   analogWrite(LEFT_MOTOR_PIN1, LOW);   analogWrite(LEFT_MOTOR_PIN2, MAX_SPEED);   analogWrite(RIGHT_MOTOR_PIN1, LOW);   analogWrite(RIGHT_MOTOR_PIN2, MAX_SPEED); } void turnRight() {   analogWrite(LEFT_MOTOR_PIN1, LOW);   analogWrite(LEFT_MOTOR_PIN2, MAX_SPEED);   analogWrite(RIGHT_MOTOR_PIN1, MAX_SPEED);   analogWrite(RIGHT_MOTOR_PIN2, LOW); } void turnLeft() {   analogWrite(LEFT_MOTOR_PIN1, MAX_SPEED);   analogWrite(LEFT_MOTOR_PIN2, LOW);   analogWrite(RIGHT_MOTOR_PIN1, LOW);   analogWrite(RIGHT_MOTOR_PIN2, MAX_SPEED); } void stop() {   analogWrite(LEFT_MOTOR_PIN1, LOW);   analogWrite(LEFT_MOTOR_PIN2, LOW);   analogWrite(RIGHT_MOTOR_PIN1, LOW);   analogWrite(RIGHT_MOTOR_PIN2, LOW); }

Voice Connection based Security system with ESP8266 and Arduino for IoT in Home Automation
Arduino Ide | Building a Wireless Bluetooth Controlled Robot Car with Arduino ide : A Complete Instruction

Leave a Reply

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

WhatsApp
My Cart
Wishlist
Recently Viewed
Categories
Wait! before you leave…
Get 10% additional off on your next order
ELECTRO10
Use the code above to enjoy 10% additional off on your next order at checkout