School of Engineering and Natural Sciences: Introduction To EE/COE
School of Engineering and Natural Sciences: Introduction To EE/COE
SCIENCES
Introduction to EE\COE
Engineering
Post-Lab Report
Date: 05.12.2023
Introduction:
The objective of this lab is to show how an Arduino board can read external data that is accessible from sensors
or other circuit components and how its digital outputs may be used to operate a motor. In this instance, we will
observe that interpreting the data from an ultrasonic sensor, utilizing digital output to regulate the motor, and
creating a basic algorithm to manage the motor based on sensor values.
Theoretical Background:
1)Arduino board: Easy-to-use hardware and software form the foundation of the open-source electronics
platform Arduino. With its extensive function library, Arduino makes it simple to create several tiny systems
quickly. Additionally, our mBot libraries are better suited for our board because they are used with nCore, a
customized Arduino Uno version.
2)Software: The Arduino IDE must also be adjusted for the mCore.It goes by the moniker mBlock. Two
interfaces are available for mBlock; the first is appropriate for those lacking sufficient programming
knowledge, while the second is the traditional Arduino IDE.
3)PWM: A method for obtaining analog results using digital methods is called pulse width modulation, or
PWM. A square wave is a signal that can be turned on and off using digital control. With this on-o pattern, you
may mimic voltages between full on (5 V) and o (0 V) by varying the percentage of the signals on time
compared to its off duration. The term "pulse width" refers to the length of "on time". You modify that pulse
width in order to obtain different analog values. With an LED, for instance, if you repeat this on-o sequence
quickly enough, the outcome seems to be a constant voltage between 0 and 5V regulating the LED's brightness.
4)Ultrasonic sensors: Ultrasonic sensors operate on a similar principle to radar or sonar, which assess a
target's attributes by interpreting the echoes from radio or sound waves, respectively. They are also referred to
as transceivers when they can both send and receive, but they are more commonly called transducers. In order
to calculate the distance to an object, active ultrasonic sensors produce high frequency sound waves, measure
the echo that is returned to them, and record the amount of time that elapses between transmitting and receiving
the signal. In essence, passive ultrasonic sensors are microphones that can identify ultrasonic noise when it's
present in specific situations.
4.1) Principles of work: It releases a 40 000 Hz ultrasonic that travels through the atmosphere and returns to
the module when it encounters an item or obstruction. You may compute the distance by taking the sound's
speed and travel time into account. Ground, VCC, Trig, and Echo are the four pins of an ultrasonic module. It
is necessary to connect the module's Ground and VCC pins to the Arduino Board's Ground and 5-volt pins,
respectively, and its trig and echo pins to any DigitalI/O pin on the Arduino Board.
• Ultrasonic sensors
• DC Motor
• Jumper cables
• LED
Experimental Procedure:
Reading data from an Ultrasonic Sensor with Arduino (Closeness Blinker)
Our goal is to estimate the distance between an object and the ultrasonic sensor by connecting it to the Arduino
board in this stage. in order for it to serve as a point of reference for an LED light to blink. The LED blinks
more quickly the closer it gets to the item; once it falls below a threshold of less than 10 cm, the LED remains
on. This helps prevent hitting the robot by acting as an alert when it gets near an item.In the first circuit we
have an ultrasonic sensor and LED, which are connected to the Arduino board via the USB to the laptop. The
sensor reacts differently to the position of an object near or far from it.
Controlling DC Motor with Arduino
In this stage our goal is to use the L298N Motor Driver to control the direction and speed of a hobby
gearmotor. The motor in this code moves for three seconds in each direction before progressively slowing
down in the final second of a loop.So, we should connect the Motor driver and Gear Motor to the Arduino
board to the laptop.
Controlling DC Motor speed using Ultrasonic Sensor and Arduino
The purpose of this part is to use PWM to regulate the speed of a hobby gearmotor by utilizing an ultrasonic
sensor and the L298N motor driver. Depending on how near the item is to the sensor, this code modifies the
motor's speed. The motor driver, ultrasonic sensor, gear motor, power supply, and USB connection to your
laptop should be connected to the Arduino board.
3
2)In the second case we have
time.
4
3)In the third case we have the
the sensor.
5
Questions:
behavior or a breach. To
reflectivity.
beneath it.
References:
1-Lab Manual 4