Es.final PDF
Es.final PDF
Es.final PDF
Arduino
Aim:
I. o study the basics of Arduino circuits and bread-boarding
2. Blinking of LEDs
USB-TTL
ATMega328P
Theory:
Arduino is an open-source electronics platform that has gained immense popularity for its ease of use
and versatility. It was created in 2005 by a group of Italian engineers and is now maintained and
developed by the Arduino community.
The heart of the Arduino platform is a microcontroller, which is a small, programmable computer on a
single integrated circuit (IC) chip.
Arduino boards, which house these microcontrollers, provide a user-friendly environment for creating
interactive electronic projects, prototypes, and various applications.
2. Input/output Pins: Arduino boards have a set of digital and analog pins that can be used to read
data (inputs) or send data (outputs). Digital pins work with binary signals (O or I), while analog pins can
read a range of values. The number and types of pins vary among different Arduino board models
3. Power Supply: Arduino boards can be powered via USB, an external power supply, or a battery.
Some boards have built-in voltage regulators, which make them compatible with a range of power
sources.
4. USB Port: Arduino boards often feature a USB port for programming and power supply. This
allows you to connect the board to your computer and upload code.
5. Reset Button: A reset button is provided to restart the Arduino, allowing you to upload new
code or reset the program.
6. LED Indicator: Many Arduino boards include a built-in LED (Light Emitting Diode) on pin 13,
which can be used for testing and basic visual feedback.
Arduino Software:
The Arduino platform comes with its integrated development environment (IDE) The Arduino IDE is
a software tool that allows you to write, compile, and upload code to the Arduino board Key features
of the IDE include:
- Programming Language: Arduino uses a simplified version of the C/C++ programming language.
It provides a set of libraries and functions tailored for easy interaction with the hardware.
- Code Library: Arduino has a vast library of pre-written code and functions that simplify common
tasks, making it accessible to beginners.
- Serial Monitor: The IDE includes a serial monitor that allows you to communicate with the
Arduino board and view debugging information.
- Community Support: The Arduino community is large and active, offering forums, tutorials, and
extensive documentation to help users troubleshoot issues and learn.
Practical 2: Blinking of LEDs
Components Used:
I. Arduino UNO
2. Breadboard
LED
4 Resistor (330 Q)
The Following is the Circuit diagram we need to implement using the TinkerCAD simulation
environment,
Arduino UNO is used to blink the LED continuously, we connect the pin 13 to the anode of the LED
and cathode of the LED is connected to a resistor (330 Q) ro limit the current passing through the LED.
If large current flows through the LED then it may damage the LED (in real world environment).
The other end of the LED is terminated to the ground connection of the Arduino to complete the circuit
Circuit Diagram:
LED Photoresistor
Pin Connections:
Arduino Photoresistor LED
Right pin
GND Left pin through
(Power) a Series
Resistor
Left pin
Pin 9 Anode
GND Cathode
(Digital) through a
Series Resistor
Practical 4: Program using temperature sensors
Aim:
To study the working of Temperature sensors using Arduino
Simulation Environment: TinkerCAD (Free online simulator)
Components: Arduino UNQ Temperature Sensor TMP 36
Theory:
The TMP36 is a low-cost analog temperature sensor that can be easily integrated with
Ardulno boards. It provides an analog voltage output that varies linearly with temperature.
This practical aims to show how to measure and display real-time temperature data using a
TMP36 temperature sensor and an Arduino. The temperature data will be displayed through
suitable method.
The TMP36 temperature sensor is a precision analog sensor. It generates an output voltage
that is linearly proportional to the Celsius temperature. It typically has three pins: VCC,
GND, and OUT. The sensor's output voltage increases by 10 mV per degree Celsius. At 25 0
C, it outputs 750 mV.
The demonstration showcases the practical application of the TMP36 temperature sensor
in conjunction with an Arduino board for real-time temperature monitoring. It highlights
how to interface the sensor, read its analog output, and display the temperature
information.
Circuit Diagram:
TMP36
Pin Connections:
Arduino TMP36Sensor
Left pin
Understanding how to read analog values and convert them into digital format is a
fundamental aspect of working with sensors and input devices.
The demo serves as a practical example of using a potentiometer in an Arduino project and its
potential applications in real-world scenarios.
While the potentiometer isn't a humidity sensor, this demonstration can still be educational
and relevant, regarding interfacing variable sensors with Arduino.
Circuit Diagram:
Potentiometer
Pin Connections:
Arduino Potentiometer
Left pin
GND Right pin
Al Center pin
Practical 6: Programs using
Ultrasonic Sensors
Aim:
To study the working of Ultrasonic sensors using Arduino
Simulation Environment: TinkerCAD (Free online simulator)
Components: Arduino UNO, HC-SR04 sensor
Theory:
The HC-SR04 is an inexpensive and widely used ultrasonic distance sensor module. It is often
employed in various projects and applications, such as robotics, automation, and DIY
electronics. The name "HC-SR04' is derived from the model or product code of this specific
sensor module.
The HC-SR04 sensor utilizes ultrasonic sound waves to determine the distance between the
sensor and an object. Here's how it works:
a. Ultrasonic Emission: The sensor emits a high-frequency sound wave, usually in
the ultrasonic range (around 40 kHz). This sound wave is inaudible to humans.
b. Sound Wave Reflection: The emitted sound wave travels through the air until it
encounters an object. When it hits the object, it bounces back towards the
sensor.
c. Receiving the Echo: The sensor has a built-in receiver to detect the reflected
sound wave, also known as an echo
d. Calculating Distance: By measuring the time it takes for the sound wave to
travel to the object and back (i.e., the time it takes for the echo to return), the
HC-SR04 can calculate the distance to the object using the speed of sound in
the air (approximately 343 meters per second or 1125 feet per second at room
temperature).
e Output' The sensor provides the calculated distance as an output in the form of a
digital pulse or duration in microseconds that can be easily converted to
distance in centimeters or inches.
This distance measuring technique is non-contact, making it suitable for a wide range of
applications, including obstacle avoidance in robots, measuring liquid levels, and more. The
HCSR04 sensor is popular among hobbyists and electronics enthusiasts due to its
affordability,ease of use, and compatibility with microcontrollers like Arduino and Raspberry
Pi.
It typically has four pins: VCC (power supply), GND (ground), Trig (trigger), and Echo (echo
signal output)
Circuit Diagram:
Pin Connections:
HC-SR
Arduino 04
Sensor
Vcc
GND GND
Pin 9 TRIG
Pin 10 ECHO
Practical 7: Programs using
Servo Motors
Aim:
To control the motion of a Servo motor using Arduino
Simulation Environment: TinkerCAD (Free online simulator)
Components: Arduino UNQ Servo motor
Theory:
A micro servo motor is a small-sized servo motor designed for applications where space is
limited. Servo motors, in general are devices that incorporate a feedback mechanism to
control the speed and position of the motor accurately. They are commonly used in robotics,
remotecontrolled vehicles, and various other projects where precise control of movement is
required.
A micro servo motor functions as follows:
Motor: The motor inside the servo is responsible for producing the mechanical motion. It
typically consists of a DC motor.
Gear Train: Servos have a gear train that converts the high-speed, low-torque output of the
motor into low-speed, high-torque motion.
Control Circuitry: The control circuitry is responsible for interpreting the signals received from
an external source ( ike an Arduino) and translating them into precise movements.
Potentiometer (Feedback Device): Most servo motors have a potentiometer (a variable
resistor) connected to the output shaft. This potentiometer provides feedback to the control
circuitry about the current position of the motor.
When we connect a micro servo motor to an Arduino, we typically use a library (such as the
Servo library in Arduino) to control its movements
The working of Servo motor interfaced with Arduino can be understood as follows
The movement of a servo motor attached to an Arduino is controlled by sending a series of
pulses to the servo motor. These pulses are typically generated using a technique called
Pulse Width Modulation (PWM).
a Pulse Width Modulation (PWM): Arduino boards have digital pins that can output
PWM signals. PWM is a technique where the duration of a pulse is varied while the
frequency remains constant. In the case of servo motors, the pulse width is crucial
because it determines the position to which the servo motor should move. b Servo
Library: Arduino provides a Servo library that simplifies the task of controlling servo
motors. This library abstracts the details of generating PWM signals, making it
easier to control the servo.
c. Attach Function: In the Arduino code, you first use the •attach• function to
associate a servo object with a specific pin on the Arduino to which the signal
wire of the servo is connected.
d. Write Function: To move the servo to a specific position, you use the 'write
function. The argument passed to this function is the desired angle. The angle
corresponds to the position to which the servo should move. For example,
myservo.write(90);• would move the servo to the 90-degree position.
e. Pulse Generation: Internally, the Servo library translates the angle specified
in the •write s function into an appropriate pulse width. The library generates
the necessary PVW signal, and the Arduino outputs this signal through the
specified digital pin.
f. Control Loop: The servo motor's control circuitry interprets the PWM signal
and adjusts the position of the motor accordingly. The feedback mechanism
(potentiometer) inside the servo constantly provides information about the
motor's current position to ensure that it reaches and maintains the desired
position
g. Looping or Sequential Control: In a loop or sequence of commands, you can
vary the angles sent to the servo to make it move continuously or in a specific
pattern.
Circuit Diagram:
Pin Connections:
Servo
Arduino
Motor
Power
GND Ground
Pin Al Signal
Practical 8: Programs using digital infrared motion sensors
Aim:
To detect motion of any object using Infrared sensors
Simulation Environment: TinkerCAD (Free online simulator)
Components: Arduino UNQ Passive Infrared (PIR) Sensor, LED and resistor (1 KQ)
Theory:
A Passive Infrared (PIR) sensor is a type of electronic sensor that detects infrared (IR) radiation
emitted by objects in its field of view. PIR sensors are often used to detect motion and are
commonly found in security systems, lighting control, and other applications where the
presence of people or animals needs to be detected.
Here's how a basic PIR sensor works:
1. Detection of Infrared Radiation: PIR sensors are equipped with a special material that
is sensitive to infrared radiation. When an object with a temperature above absolute
zero (273.15 0 C or -459.67 O F) moves in the sensor's field of view, it emits infrared
radiation.
2. Pyroelectric Material: The sensor contains a pyroelectric material, typically a crystal
that generates a voltage when exposed to changes in temperature. The pyroelectric material
is divided into segments, and each segment is connected to a pair of electrodes.
3. Detection of Changes in Infrared Radiation: As an object moves within the sensor's
detection range, the amount of infrared radiation reaching different segments of the
pyroelectric material changes. This results in variations in the voltage generated by the
material
4. Signal Processing: The sensor's electronics process these voltage changes and convert
them into a signal that indicates motion or the presence of a heat source.
5. Output Signal: The sensor typically provides a digital output signal that can be used to
trigger an alarm, turn on lights, or perform other actions based on the detected motion.
One of the key advantages of PIR sensors is their low cost, simplicity, and efficiency in
motion detection applications. However, it's essential to note that PIR sensors can be
sensitive to changes in temperature and may produce false alarms in certain situations, such
as when there are sudden temperature changes in the environment. Advanced PIR sensor
designs and signal processing techniques are employed to minimize false positives and
enhance overall performance
All objects (having temperature higher than absolute zero) emit radiations from the
generated heat. These radiations cannot be detected by a human eye. Hence, electronic
devices such as motion sensors, etc. are used for the detection of these radiations The
advantages of using a PIR sensor are listed below:
a) Inexpensive
b) Adjustable module
c) Efficient
d) Small in size
e) Less power consumption
f) It can detect motion in the dark as well as light.
The PIR sensor has three terminals, which are listed below
a) VCC
b) Digital Output
c) GND (Ground)
We will connect the Vcc terminal of the sensor to the 5V on the Arduino board. The PIR's
sensor output can be connected to any of the digital pins on the Arduino board The
detection range of PIR sensors is from 5m to 12m.
Circuit Diagram:
Pin Connections:
PIR
Arduino LED
Sensor
Power
GND Ground
Pin 2 Signal
B3
AO
Al Anode
Practical 10: Programs making Joystick with Arduino
Aim:
To make a Joystick using Arduino
Theory:
A joystick is an input device commonly used for controlling robots, gaming consoles, and
electronic systems. It provides an intuitive way to interact with systems by translating user
gestures into electrical signals. When combined with Arduino, a joystick can be used to
control servos, motors, or other devices in projects like remote-controlled cars, robotic
arms, or game simulations
Components of a Joystick
Axes.
Most joysticks have two axes: X (horizontal) and Y (vertical).
These axes are controlled by potentiometers that change resistance based on the joystick's
position.
Push Button.
Many joysticks include a push button, triggered by pressing the joystick downward.
This provides an additional digital input for controlling devices.
Potentiometers.
Potentiometers inside the joystick measure the tilt or movement
The output is an analog voltage proportional to the joystick's position.
Working Principle
The joystick has two potentiometers for the X and Y axes.
Moving the joystick changes the resistance of the potentiometers, generating analog voltage
signals.
The Arduino reads these signals via its analog pins and converts them into digital values using
an Analog-to-Digital Converter (ADC)
The values range from O to 1023 (for a 10-bit ADC) and indicate the joystick's position along
each axis.
Circuit Diagram:
The connections are as follows
Arduino LEDI LED2 LED3 LED4 Potentiometerl Potentiometerl
5V Ri htterminal Ri t terminal
Anode
Anode
Anode
Anode
Center terminal
Al Center terminal