INTRODUCTION
Motivation
The project aims to create an obstacle avoidance robotic vehicle utilizing ultrasonic sensors for navigation, powered by an Arduino Uno This robotic vehicle is designed to autonomously perform tasks by integrating computational intelligence with physical components, such as motors It features built-in intelligence that enables it to navigate around obstacles by detecting them with an ultrasonic sensor, which communicates with the Arduino to execute movement commands.
Robotics is a rapidly evolving and fascinating field, with robots equipped with advanced intelligence capable of navigating extensive areas Autonomous obstacle-avoiding robots can execute tasks in unstructured environments without the need for constant human supervision A key requirement for these robots is effective obstacle detection, which is achieved through sensors mounted on the robot that gather information from the surrounding environment.
Contribution
This article discusses the design of a three-wheeled robot capable of automatically avoiding obstacles in industrial environments This innovative technology has various applications, including tracking, goods delivery, and automatic vacuuming, ultimately providing significant benefits to users.
- Solving problems in delivering goods in industrial area
- Calculate, design and write algorithms for avoiding obstacles
The training program equips students to effectively apply their acquired knowledge to scientific research and real-world systems It enhances their professional skills and expertise, enabling them to proficiently utilize tools, components, and software essential for specialized electrical engineering.
BACKGROUND
DC Motor
A DC motor is a device that transforms electrical energy into mechanical energy, primarily utilizing magnetic fields for operation As the first widely adopted motor type, DC motors were compatible with existing direct-current lighting power systems Their speed and direction can be easily adjusted using electronic devices through pulse width modulation (PWM), which involves controlling the pulse-width of the voltage applied to the motor.
The DC machine is a highly adaptable electromechanical device known for its excellent torque characteristics and broad speed range It operates efficiently across various speeds, utilizing direct current for both its field winding on the stator and the armature winding on the rotor.
DC machines are generally more expensive and require higher maintenance costs compared to similar AC machines, which limits their industrial use Their application is primarily confined to demanding environments like steel and paper mills, as well as for control purposes in various motor applications.
Stator: Electrical or permanent magnets
Rotor: Coils (winding) mounted on the shaft
DC machines have two sets of electrical windings:
Field windings: on the stator
Armature windings: on the rotor.
The axis of the armature mmf is 90 from the axis of the field winding 0
- The stator (field) winding mmf: F s
- The rotor (armature) winding mmf: Fr
2.1.4 Electrical power generated by DC machine
If the losses of the DC machine are neglected, from the energy conservation principle, the electrical power is equal to the mechanical power:
At steady state, the mechanical torque T m is equal to the electromagnetic torque T e.
H-Bridge
An H bridge is an electronic circuit that allows for the application of voltage across a motor in both directions, making it essential for controlling DC motors This functionality is particularly valuable in robotics and various applications, enabling motors to operate forwards or backwards.
An H-bridge is a straightforward circuit composed of four switching elements, which can be relays, BJTs, or MOSFETs It features catch diodes (D1, D2, D3, D4) and is designed with the load positioned at the center, forming an H-like configuration.
Figure 2: A two-pole DC machine
The top-end of the bridge is connected to a power supply (battery for example) and the bottom-end is grounded.
In generally all four switching elements can be turned on and off independently, though there are some obvious restrictions.
H-bridges are commonly used to drive brushed DC motors and bipolar stepper motors, with the latter requiring two H-bridges per motor This article will focus on the application of H-bridges specifically as drivers for brushed DC motors.
When Q1 and Q4 are activated, the motor's left lead connects to the power supply, and the right lead connects to ground This configuration allows current to flow through the motor, energizing it in the forward direction and causing the motor shaft to spin.
If Q2 and Q3 are turned on, the reverse will happen, the motor gets energized in the reverse direction, and the shaft will start spinning backwards.
In a bridge circuit, it is crucial to avoid closing both Q1 and Q2 (or Q3 and Q4) simultaneously, as this creates a short-circuit, resulting in a low-resistance path between power and ground This condition, known as 'shoot-through,' can rapidly damage the bridge or other components in the circuit.
Pulse Width Modulation(PWM)
Pulse Width Modulation (PWM) is a method that enables the generation of analog signals through digital control By creating a square wave that alternates between on and off states, PWM effectively simulates intermediate voltage levels between fully on (5 Volts) and off.
The pulse width, defined as the duration of "on time," can be adjusted to alter the ratio of time a signal is active versus inactive By modulating this pulse width, it is possible to achieve varying analog values.
In the graphic below, the green lines represent a regular time period This duration or period is the inverse of the PWM frequency In other words, with Arduino's PWM
In Figure 6, Q1 and Q2 operate at a frequency of approximately 500Hz, with the green lines indicating a duration of 2 milliseconds each The function analogWrite() utilizes a scale from 0 to 255, where analogWrite(255) corresponds to a 100% duty cycle (constantly on), while analogWrite(127) represents a 50% duty cycle (active half the time).
SYSTEM AND CONTROL DESIGN
Hardware components
The list of Arduino boards includes the following such as:
The Arduino Uno is an open-source microcontroller board featuring the Microchip ATmega328P microcontroller, developed by Arduino.cc It includes a variety of digital and analog input/output (I/O) pins, allowing for easy interfacing with expansion boards (shields) and other circuits.
There are 14 digital I/O pins and 6 analog pins incorporated on the board that make this device unique and stand out from others.
Out of 14 digital I/O, 6 are used for PWM (pulse width modulation).
A crystal oscillator of 16MHz frequency is added on the board.
This board comes with USB cable port that is used to connect and transfer code from computer to the board.
The DC power jack is an essential component for powering the board, but some Arduino versions, such as the Arduino Pro Mini, do not include this feature.
This board features dual voltage regulators of 5V and 3.3V, offering enhanced flexibility in voltage regulation tailored to specific needs, unlike the Arduino Pro Mini, which is equipped with only a single voltage regulator.
There is no much difference between Arduino Uno and Arduino Mega except later comes with more memory space, bigger size and more I/O pins.
Arduino software called Arduino IDE is used to program the board which is a common software used for all boards belonged to Arduino family.
Availability of Atmega16 on the board makes it different than Arduino Pro Mini which uses USB to serial converter to program the board.
There is a reset button and 4 hardware serial port called USART which produces a maximum speed for setting up communication [1]
3.1.1.3 Advantages and Disadvantages of Arduino
Arduino is a comprehensive package that includes essential components such as a 5V regulator, burner, oscillator, micro-controller, serial communication interface, LED, and connection headers Simply connect it to your computer's USB port to begin coding immediately.
- Examples of codes: Another big advantage of Arduino is its library of examples present inside the software of Arduino.
One of the key benefits of Arduino is its effortless automatic unit conversion, allowing you to focus entirely on the core aspects of your projects without the hassle of manual unit conversions during debugging.
- Large community: There are many forums present on the internet in which people are talking about the Arduino Engineers, hobbyists and professionals are making their projects through Arduino
- Structure: During building a project you have to make its size as small as possible.
But with the big structures of Arduino we have to stick with big sized PCB’s.
The cost variation primarily stems from programming factors, with a minimal difference of about $5 for a single package However, this cost will increase significantly when multiple packages are required.
Arduino is an accessible platform for beginners in microcontrollers, but its simplicity may hinder the development of complex intelligent circuits in the future While it provides user-friendly hardware and software, it may not adequately cover essential concepts such as serial communication, ADC, and I2C, which are crucial for advanced learning.
The UNO is the best board to get started with electronics and coding The UNO is the most used and documented board of the whole Arduino family.
Digital I/O Pins 14 (of which 6 provide PWM output)
DC Current per I/O Pin 20 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328P) of which 0.5 KB used by bootloader
* Details of components on the board
Figure 11: Board of an Arduino
Arduino board can be powered by using the USB cable from your computer All you need to do is connect the USB cable to the USB connection (1).
Arduino boards can be powered directly from the AC mains power supply by connecting it to the Barrel Jack (2).
The function of the voltage regulator is to control the voltage given to the Arduino board and stabilize the DC voltages used by the processor and other elements.
The crystal oscillator is essential for Arduino's time management, operating at a frequency of 16 MHz, as indicated by the 16.000H9H marking on the component This frequency enables accurate time calculations within the Arduino system.
To reset your Arduino board and restart your program, you can use one of two methods: press the reset button located on the board or connect an external reset button to the RESET pin.
Most of the components used with Arduino board works fine with 3.3 volt and 5 volt.
GND (8)(Ground) − There are several GND pins on the Arduino, any of which can be used to ground your circuit.
Vin (9) − This pin also can be used to power the Arduino board from an external power source, like AC mains power supply.
The Arduino UNO board features five analog input pins, labeled A0 to A5, which are capable of reading signals from analog sensors such as humidity and temperature sensors These pins convert the analog signals into digital values that can be processed by the microprocessor.
Each Arduino board features a unique microcontroller, which acts as the board's brain The primary integrated circuit (IC) varies between different Arduino models, with most microcontrollers sourced from ATMEL It is essential to identify the specific IC of your board before uploading a new program via the Arduino IDE, as this information is typically printed on the top of the IC For comprehensive details regarding the construction and functions of the IC, consult the data sheet.
Mostly, ICSP (12) is an AVR, a tiny programming header for the Arduino consisting of MOSI, MISO, SCK, RESET, VCC, and GND.
The Serial Peripheral Interface (SPI) is commonly viewed as an extension of output capabilities, where the output device operates as a slave to the master device on the SPI bus.
When you connect your Arduino to a power source, the LED should illuminate, signaling that the board is receiving power properly If the LED fails to light up, it indicates a potential issue with the connection.
The Arduino UNO board features two key labels: TX (transmit) and RX (receive), located at digital pins 0 and 1 for serial communication Additionally, the TX and RX LEDs, found on pin 13, indicate data transmission and reception The TX LED flashes at varying speeds based on the baud rate during data transmission, while the RX LED lights up during the receiving process.
The Arduino UNO board features 14 digital I/O pins, including 6 that support PWM (Pulse Width Modulation) output These versatile pins can be configured as input digital pins to read logic values (0 or 1) or as output pins to control various modules such as LEDs and relays The pins marked with “~” are specifically designed for generating PWM signals.
AREF stands for Analog Reference It is sometimes, used to set an external reference voltage (between 0 and 5 Volts) as the upper limit for the analog input pins.
3.1.2 L298N Dual H-bridge Stepper Motor Driver Module
3.1.2.1 What is a Motor Driver Module?
Circuit Explanation
The HC-SR04 ultrasonic sensor is an effective obstacle detection technique that operates on the echo principle, where sound waves reflect back after hitting a surface With a travel speed of 343 m/s, it allows microcontrollers to measure distances accurately, reflecting waves from surfaces up to 4 meters away in just 15 ns These sensors are safe for humans, primarily used for distance measurement, and can detect barriers in their path They emit high-frequency sound waves that are inaudible to humans, making them suitable for quiet environments Additionally, ultrasonic sensors are energy-efficient, simple in design, and cost-effective.
Initialize Ultrasonic sensor, Servo Motor,
Stop moving If distance = Left distance Turn right
3.2.3 Obstacle-avoiding Robot Schematic Diagram
RESULTS AND APPLICATIONS
Algorithm to the code
1 Initialize Ultrasonic sensor, Servo Motor, Motor Drive
2 The robot is always moving straight.
3 Servo Motor scans the angles from 0 to 180 degrees.
4 The ultrasonic sensor reads the signal continuously.
5 When any angle of the servo where the sensor reads less than 20cm, the controller will process the reading and give the best solution to limit the collision with an obstacle during the movement
6 The robot will move to the right or left direction unless there is any obstacle.
7 Repeat the previous steps to complete the loop
Applications
Obstacle avoiding robots can be used in almost all mobile robot navigation systems.
Development of line detection vehicles using line detection sensors.
A fire truck use a fire detector
They can be used for household work like automatic vacuum.
They can also be used in dangerous environments, where human penetration could be fatal.
This paper introduces a cost-effective obstacle detection and avoidance system for unmanned land movers, utilizing two pairs of heterogeneous sensors to accurately identify obstacles in the robot's path The autonomous system demonstrates a high degree of accuracy and a low probability of failure, successfully avoiding collisions and repositioning itself as needed The design allows for the integration of additional functionalities with minimal human intervention Furthermore, the robot can be remotely controlled via an IR receiver and remote controller, making it a valuable asset in hostile environments, as well as in defense and security applications.
This paper introduces a cost-effective obstacle detection and avoidance system for unmanned land movers, utilizing two pairs of heterogeneous sensors to identify obstacles in the robot's path The system demonstrates a high degree of accuracy and a low probability of failure, proving its capability to avoid collisions and reposition itself autonomously The design allows for the integration of additional functionalities with minimal human intervention Furthermore, the robot can be remotely controlled via an IR receiver and remote controller, making it a valuable asset in hostile environments, as well as in defense and security applications.
This project introduced an affordable obstacle-avoiding robot designed for unmanned land movement It utilized two pairs of heterogeneous sensors to effectively detect obstacles in the robot's path The system achieved a high degree of accuracy with a minimal probability of failure Evaluation results demonstrate the robot's capability to navigate around obstacles, avoid collisions, and adjust its position autonomously.
This design enhances functionality, allowing the robot to perform various tasks with minimal human intervention Equipped with an L298N Drive Module and Ultrasonic Sensor, the robot can be remotely controlled This project is particularly beneficial for applications in hostile environments, as well as in the defense and security sectors.
[1]https://www.theengineeringprojects.com/2018/03/introduction-to- microcontrollers.html
[2] http://engineerexperiences.com/advantages-and-disadvatages.html
[3] https://www.etechnophiles.com/l298n-motor-driver-pin-diagram/
[4] https://components101.com/ultrasonic-sensor-working-pinout-datasheet
[5] https://components101.com/servo-motor-basics-pinout-datasheet
[6] https://askinglot.com/what-is-dc-geared-motor
[7] https://www.irjet.net/archives/V5/i2/IRJET-V5I2457.pdf
#define echo 3 uint8_t speed_robot0; int distance;
{ pinMode(inA1, OUTPUT); pinMode(inA2, OUTPUT); pinMode(inB1, OUTPUT); pinMode(inB2, OUTPUT); pinMode(5,1); pinMode(6,1); pinMode(trig,OUTPUT); pinMode(echo,INPUT);
{ objectAvoider (inA1, inA2, inB1, inB2,30, 1000);
} int objectDistance_cm (byte angle)
{ srf05.write(angle); delay(500); unsigned long duration; digitalWrite(trig,0); delayMicroseconds(2); digitalWrite(trig,1); delayMicroseconds(5); digitalWrite(trig,0); duration = pulseIn(echo,HIGH); distance = int(duration/2/29.412);
} void robotMover (byte inR1, byte inR2, byte inL1, byte inL2, byte action)
{ analogWrite(6,speed_robot); analogWrite(5,100); switch (action)
The motor control system operates based on specific cases to manage movement In case 0, both motors are stationary Case 1 initiates forward movement, while case 2 reverses the direction Case 3 enables a left turn, and case 4 facilitates a right turn For left and right turns while moving, case 5 and case 6 adjust the motors accordingly Cases 7 and 8 allow for backward turns to the left and right, respectively If none of the cases apply, the default action is set to 0.
} void motorControlNoSpeed (byte in1,byte in2, byte direct)
Đoạn mã điều khiển động cơ bao gồm ba trường hợp: Trường hợp 0 dừng động cơ bằng cách thiết lập in1 và in2 ở mức thấp Trường hợp 1 quay theo chiều thứ nhất bằng cách thiết lập in1 ở mức cao và in2 ở mức thấp Trường hợp 2 quay theo chiều thứ hai bằng cách thiết lập in1 ở mức thấp và in2 ở mức cao.
} void objectAvoider (byte inR1, byte inR2, byte inL1, byte inL2, byte allow_distance, int turn_back_time)
{ robotMover(inR1,inR2,inL1,inL2,1);
//delay(10); int front_distance=objectDistance_cm (90); int left_distance; int right_distance; int max_distance; if (front_distance > allow_distance)
{ robotMover(inR1,inR2,inL1,inL2,1);
} if (front_distance