Obstacle 21 30
Obstacle 21 30
3.1 Materials
The following components were used for the hardware implementation of the project:
3.2 Analysis
Figure 3.1 Diagram showing the basic operation of the HC-SR04 Ultrasonic Sensor. (Adapted from
Electroschematics, 2015)
9
3.2.1.1 HC-SR04 Ultrasonic Sensor Overview
The word ‘ultra’ means ‘beyond’ and sonic means ‘sound’. Combining the two of them together
ultrasonic is a sound which is above the human hearing range (20 KHz).
An Ultrasonic sensor is a sensor that can detect ultrasound waves by converting the waves into electric
signals or vice versa [20], [21], [22].
An ultrasonic sensor is capable of measuring the total distance between itself and an object by sending
out a wave at a certain frequency and listening for that wave to bounce back to it. During this, it
records the tame taken between when the wave was generated and when it bounced back in order to
calculate the distance between it and an object [23].
10
3.2.1.3 HC-SR04 Ultrasonic Sensor Pin Configuration
11
3.2.1.4 Working of HC-SR04 Ultrasonic Sensor
Sonar is used by the ultrasonic sensor to obtain the distance between itself and an object. Here’s how
it works:
For example, if the distance between the object and the sensor is 10cm, and the speed of sound is
340m/s, the sound wave will need to travel about 294μs. The value gotten at the echo pin will be twice
that number because the wave travels to and fro. To get the distance in cm, the time gotten at the echo
pin is multiplied by 0.034 and divided by 2 [24], [25].
12
3.2.2 SG-90 Servo Motor
A servo motor consists of a motor that uses servo mechanism. The two types of servo motors are the
DC servo motors (DC powered) and the AC servo motor (AC powered) where the difference between
them is the input power. A very high torque can be obtained from a small and lightweight servo motor
which allows these servo motors to be used in applications like robots, toy cars, etc. The main reason
why a servo motor is used is because of its high angle precision, i.e. after rotating, it will stop and wait
for the next instruction to happen unlike a normal electric motor which rotates as long as it is being
supplied power and stops rotating when power supply is turned off [28][29].
Firstly, gear assembly is used to reduce the Revolutions per Minute (RPM) and to increase the torque
of the motor. At the initial position of the servo motor shaft, the potentiometer knob is in such a way
that no electrical signal is generated at the potentiometer output. An electrical signal is passed to
13
another input terminal of the error detector amplifier and the difference between these two signals is
that one is coming from the potentiometer and the other is coming from another source. The both
signals will be processed in a feedback mechanism and the output will be provided in terms of an error
signal. This error is used as the motor input to cause it to start rotating. The motor shaft is connected
to the potentiometer which causes the potentiometer to generate a signal as the motor rotates. As the
angular position of the potentiometer changes, its feedback output also changes and after a while the
potentiometer reaches a position that the potentiometer output and the external signal are the same.
Once the outputs are the same, the amplifier will not output anything into the motor since there is no
difference between the generated potentiometer signal and the external applied signal which in turn
causes the motor to stop rotating.
Servo motors are controlled by Pulse width Modulation (PWM) which is provided by the control
wires. There is a minimum pulse, a maximum pulse and a repetition rate. A servo motor can turn 90
degrees to either direction from its neutral position. The servo motor expects a pulse every 20ms which
determines how far the motor will turn. In the figure 4-11 below, a 1.5ms pulse will make the motor
turn 90 degrees. If the pulse is shorter than 1.5ms, the shaft moves to 0 degrees and if it is longer than
1.5ms, the shaft will turn to 180 degrees. Pulse with modulation simply means that the angle of
rotation is dependent on the duration of pulse applied to the control PIN.
Basically, servo motors are made up of a DC motor controlled by a potentiometer (Variable resistor)
and some gears which convert the high-speed force into torque [30].
14
3.2.3 Arduino UNO R3
Pin Function
Vin Voltage from External power jack
5V 5V output from on-board Voltage regulator chip
3.3V 3.3V output from on-board Voltage regulator chip
Gnd 3 pins for ground
IOREF Tied to 5V, tells Arduino shields voltage level from which Arduino board operates
Reset From RESET pin on MCU, tied to VCC through 10K resistor, pull to GND to reset
15
3.2.3.2 Arduino UNO Digital Input/ Output Overview
It has 14 Digital Inputs and Outputs
It has a logic level of 5V
Its Sink/Source is 20mA per pin
It utilizes Universal Asynchronous Serial Receiver/Transmitter (UART) for which pin 0 is for
receiving and pin 1 is for transmitting
It has 8-bit PWM
It has a Serial Peripheral Interface [19].
16
External programmer can be used to upload sketches via the In-circuit serial programmer pins
(ICSP)
It has 32KB of Flash memory where the sketches are stored
It has 2KB of SRAM where the variables are stored until power cycled
It has 1KB of EEPROM which stores long term information.
3.2.4 DC Motor
17
Coreless & Coreless Brushless Motors
Gear heads Motors
DC Gear Motors are the most common kind of motors which convert electrical to mechanical energy.
A gear motor consists of a gearbox and a motor. The addition of a gear head to a motor reduced the
speed while increasing the torque output. Important parameters in gear motors include:
Speed (rpm)
Efficiency (%)
Torque (lb.-in)
The factors to consider before selecting a gear motor for any application include:
Speed
Load
Torque requirements
18