Arduino Tutorial Guide
Arduino Tutorial Guide
TUTORIALS
WELCOME TO
MB-102 Breadboard - A board on which you can
build electronic circuits. It’s like a patch panel, with
rows of holes that allow you to connect wires and
Getting-to-know with
the parts of your Kit
USB Cable - This allows you to connect your Ar-
Arduino Uno R3 Board - The microcontroller devel- duino Uno to your personal computer for program-
opment board that will be at the heart of your pro- ming. It also provides power to the Arduino for
jects. It’s a simple computer, but one that has no most of the projects in the kit.
way for you to interact with it yet. You will be
building the circuits and interfaces for interaction,
and telling the microcontroller how to interface
Remote
Servo Motor - - A type of geared motor that can from -55˚ to +150˚C
Resistors
Sound Sensor
RTC Module
RFID Module
RGB Module
1 Channel Relay
Joystick Module IR Receiver Sensor
BOARD.
• Computer
• Arduino Software
The Arduino IDE allows you to write programs and upload them to your Arduino.
Have your Arduino board and USB cable near your computer.
After installing the Arduino IDE, we need to install or copy some library files needed for
this manual.
Open the “Arduino Learning Kit Manual and Library” folder and copy the contents of
“1. Library”
After copying the contents from 1. Library, paste it to your computer’s directory
“Documents/Arduino/libraries”.
• Only plug the Arduino board into the computer (via USB cable) after
assembling the wirings and circuitry, remove it once done. Plug it again
• Try not to hold pins and soldered areas when handling the electronic
devices.
• Always be mindful of the connections; when the actual device and dia-
• 1 x USB cable
• 1 x Button
• 1 x Resistor (220kΩ)
• 1 x Resistor (10kΩ)
• 1 x Breadboard
• 1 x LED
• Jumper Wires
Wiring Diagram
Quick Steps (Estimated time: 5 mins.)
• Mechanical Devices
commercial devices)
LESSON 2
Hardware Required:
• 1 x USB cable
• 1 x Resistor (220Ω)
• 1 x Breadboard
• 1 x LED
• Jumper Wires
Wiring Diagram
What is PWM
PWM stands for Pulse Width Modulation and it is a technique used in controlling
The Arduino IDE has a built in function “analogWrite()” which can be used to gen-
erate a PWM signal. The frequency of this generated signal for most pins will be
about 490Hz and we can give the value from 0-255 using this function.
On Arduino Uno, the PWM pins are 3, 5, 6, 9, 10 and 11. The frequency of PWM
signal on pins 5 and 6 will be about 980Hz and on other pins will be 490Hz. The
Schematic Diagram
Arduino IDE
(Controlling_LED_by_PWM.ino)
board
• Electric stove
• PC power supplies
• Audio amplifiers
loudness
Hardware Required:
• 1 x USB cable
• 8 x Resistor (220Ω)
• 1 x Breadboard
• 1 x Potentiometer
• 8 x LED
• Jumper Wires
Schematic Diagram
Wiring Diagram
4. Here you should see eight LEDs light up one by one in turn. Adjust thepotentiometer,
and you will find the time interval of LED lighting up changes.
Real Life Applications
sign
space by:
LEDs
city initiatives
focal points
Hardware Required:
• 1 x USB cable
Wiring Diagram
Quick Steps (Estimated time: 3 mins.)
The connection between the I2C LCD1602 and the Arduino Uno board:
4. You should now see your I2C LCD1602 display the flowing characters: "hello makerlab
electronics!".
Note: If for some reason your
LCD doesn’t display anything,
you might needto adjust the
brightness of LCD, or you
might need to change the I2C
address on the Arduino code,
from 0x27 to 0x3f.
• The liquid crystal displays (LCDs) are used in aircraft cockpit displays.
• It is used in instruments panel where all the lab instruments uses LCD screens for display.
• The LCDs are commonly used in all the digital wrist watches for displaying time.
• The liquid crystal displays (LCDs) are used in aircraft cockpit displays.
• It is used in instruments panel where all the lab instruments uses LCD screens for display.
• The LCDs are commonly used in all the digital wrist watches for displaying time.
Hardware Required:
• 1 x USB cable
• 1 x Active Buzzer
• 1 x Breadboard
• Jumper Wires
• Alarms
• Automobile Alerts
• Communication Equipment
LESSON 6
TILT SWITCH
Hardware Required:
• 1 x USB cable
• 1 x Tilt Switch
• Jumper Wires
Wiring Diagram
Schematic Diagram
4. Now, tilt the switch, and the LED attached to pin 13 on Arduino Uno board will light up.
Hardware Required:
• 1 x USB cable
• 4 x Button
• 4 x LED
• 4 x Resistor (220Ω)
• 1 x Active Buzzer
• 1 x Breadboard
• Jumper Wires
Wiring Diagram
If not working, check the connection of wirings as well as
the attachment of the buttons, LEDs and the like
Schematic Diagram
4. Now, first press button 4 to start. If you press button 1 first, you will see the correspond-
ing LED light up and the buzzer will beep. Then press button 4 again to reset before you
• Gameshow Buzzers
LESSON 8
SERIAL MONITOR
Hardware Required:
• 1 x USB cable
• 3 x LED
• 3 x Resistor (220Ω)
• 1 x Breadboard
• Jumper Wires
Wiring Diagram
Schematic Diagram
When you open the window, it will display "Please input any color of LED:". You can in-
put a color here. If you enter red, green, or blue, click Send, then the corresponding
LED on the breadboard will light up. However, if you enter any color other than these three,
no LEDs will be on.
For example, if you input red, you will see the red LED light up.
LESSON 9
PHOTORESISTOR
Hardware Required:
• 1 x USB cable
• 8 x LED
• 1 x Resistor (10kΩ)
• 8 x Resistor (220Ω)
• 1 x Photoresistor
• 1 x Breadboard
• Jumper Wires
Wiring Diagram
Schematic Diagram
board
• Photoresistors are used in streetlights to control when the light should turn on an
when the light should turn off. When the surrounding light falls on the photo re-
sistor, it causes the streetlight to turnoff. When there is no light, the photoresistor
causes the street light to turn on. This reduces the wastage of electricity.
• Clock radios
LESSON 10
CONTROLLING BUZZER BY PHOTORESISTOR
Hardware Required:
• 1 x USB cable
• 1 x Buzzer (active)
• 1 x Resistor (10kΩ)
• 1 x Photoresistor
• 1 x Breadboard
• Jumper Wires
Wiring Diagram
Schematic Diagram
(Controlling_Buzzer_by_Photoresistor.ino)
4. Now, if you place the photoresistor in a dark environment, the buzzer will beep sharply;
if you shine a flashlight on the photoresistor, the buzzer beeping will slow down.
Real Life Applications
• Light-alarm devices - We could place this device in a very dark area such as the
drawer of a cabinet. And we regularly keep this drawer closed. Being closed, no light
enters and the circuit is in enclosed in a dark area with no light. Under these conditions,
the alarm does not go off because it is not exposed to light. However, say, if a thief
breaks into the house and opens this drawer either during the day or at a night, shining
a flashlight into the drawer. Now exposed to light, the circuit will trigger and buzz an
alarm. So the housekeeper can know if someone has broken in by hearing this device.
This is one possible application of this circuit we built. With modifications aligned to
your preferences.
LESSON 11
FLAME ALARM
Hardware Required:
• 1 x USB cable
• 1 x Flame Sensor
• 1 x Resistor (10kΩ)
• 1 x Buzzer (passive)
• 1 x Breadboard
• Jumper Wires
Wiring Diagram
Schematic Diagram
Sensor connection
4. Now, ignite a lighter near the flame sensor. The buzzer will produce a sound depending
extinguishment
LESSON 12
MAKING A VOLTMETER
Hardware Required:
• 1 x USB cable
• 1 x Potentionmeter (50kΩ)
• 1 x I2C LCD1602
• 1 x Breadboard
• Jumper Wires
Wiring Diagram
Principle
In this experiment, a potentiometer is used to divide voltage. Since the Arduino Uno
board can only read digital signals, but what the sliding end of the potentiometer out-
puts are analog signals, we need to convert these analogsignals into digital ones with
an Analog-to-Digital Convertor (ADC). Fortunately, the Arduino Uno board itself
comes with a 10-bit ADC which we can use to implement this conversion. Then display
this digital output voltage on the I2C LCD1602.
Uno board
• Voltmeter, Multimeter
LESSON 13
CONTROL LED BY CLAP USING SOUND SENSOR
Hardware Required:
• 1 x USB cable
• 1 x Resistor (1k)
• 1 x LED
• Jumper Wires
Wiring Diagram
Quick Steps (Estimated time: 5 mins.)
DO Pin 2
GND GND
VCC 5V
IDE (Sound_Sensor.ino)
clap.
Real Life Applications
recognition
LESSON 14
LM35 TEMPERATURE SENSOR
Hardware Required:
• 1 x USB cable
• 1 x I2C LCD1602
• Jumper Wires
Wiring Diagram
Principle
4. Now, you can see the current temperature displayed on the I2C LCD1602.
Real Life Applications
• Motors– there are many different aspects of motors and most of these require
temperature measurement to ensure the motor itself does not overheat.
• Surface plates – ring terminal temperature sensors are often used on surface
plates as they can be mounted onto a flat surface and measure temperature effectively.
• Computers– within computers there are temperature sensors to ensure the system
does not overheat
Hardware Required:
• 1 x USB cable
• 1 x Breadboard
• 1 x I2C LCD1602
• Jumper Wires
Wiring Diagram
Quick Steps (Estimated time: 5 mins.)
4. Now, if you immerse the sensor in water, you can see the depth to which the sensor is
• Irrigation
• Flood Monitoring
• Tidal Monitoring
• Wastewater
LESSON 16
7-SEGMENT DISPLAY
Hardware Required:
• 1 x USB cable
• 1 x Breadboard
• 8 x Resistor (220Ω)
• Jumper Wires
Wiring Diagram
Principle
Each one of the seven LEDs in the display is given a positional segment with one
of its connection pins being brought straight out of the rectangular plastic pack-
age. This then allows us to display each of the ten decimal digits 0 through to 9
on the same 7-segment display.
As each LED has two connecting pins, one called the "Anode" and the other
"Cathode", there are therefore two types of LED 7- segment display called: Com-
mon Cathode (CC) and Common Anode (CA).
The wiring between the 7-segment display and the Arduino Uno board
is as shown below:
4. You should now see the 7-segment display from 0 to 9 and then A to F, backand forth.
Schematic Diagram
Real Life Applications
• Digital calculators
• Electronic meters
• Digital clocks
• Odometers
• Clock radios
Hardware Required:
• 1 x USB cable
• 8 x Resistor (220Ω)
• 1 x Breadboard
• Jumper Wires
Wiring Diagram
Schematic Diagram
(stopwatch.ino)
play.
• Stopwatch
• Scoreboards
LESSON 18
DOT-MATRIX DISPLAY
Hardware Required:
Wiring Diagram
Schematic Diagram
Principle
COL 1 2 3 4 5 6 7 8
Pin No. 13 3 4 10 6 11 15 16
ROW 1 2 3 4 5 6 7 8
Pin No. 9 14 8 12 1 7 2 5
The 8x8 dot-matrix is made up of sixty-four LEDs and each LED is placed at the
cross point of a row and a column. When the electrical level of a certain row is
High and the electrical level of a certain column is Low, then the corresponding
LED will light up;
If you want to light the LED on the first dot, you should set ROW 1 to high
level and COL 1 to low level, then the LED on the first dot will light up;
If you want to light the LEDs on the first row, you should set ROW 1 to high
level and COL (1, 2, 3, 4, 5, 6, 7, 8) to low level, then all the LEDs on the first
row will light up;
If you want to light the LEDs onthe first column, you should set COL 1 to
low level and ROW (1, 2, 3, 4, 5, 6,7, 8) to high level, then all the LEDs on
the first column will light up.
(8X8_Dot_Matrix_Display.ino)
Delete the byte character in the current code and paste a new byte charac
ter that can be found in step 5. For further explanation, visit this website :
https://medium.com/arduino-playground/using-a-74hc595-to-control-a-
ledmatrix-84559feee7cd
• Clocks
• Bus routes
• Anything where low cost displays are required with limited resolution
LESSON 19
RAINBOW LED
Hardware Required:
• 1 x USB cable
Wiring Diagram
Quick Steps (Estimated time: 3 mins.)
• Mood lamp
Hardware Required:
• 1 x USB cable
• 8 x Resistor (220Ω)
• 1 x Breadboard
• 1 x 74HC595
• 1 x 7-Segment Display
• Jumper Wires
Principle
Schematic Diagram
Quick Steps
b Q6
c Q5
d Q4
e Q3
f Q2
g Q1
DP Q0
VCC 5V
DS 11
CE GND
ST 12
SH 8
MR 5V
Q7’ N/C
GND GND
“-” GND
Quick Steps (Estimated time: 10 mins.)
Hardware Required:
• 1 x USB cable
• 1 x RTC-DS1302 Module
• Jumper Wires
Wiring Diagram
Schematic Diagram
The wiring between DS1302 and Arduino Uno board is as shown below:
It will first show 0/0/0 0:0:0 in the I2C LCD1602, to set this to the current time and date,
look for the code as shown below, change the format as instructed in the comments, re-
move the “//” then upload. After uploading successfully put back the “//” and upload
again.
4. Now, you can see the current date and time information displayed on the I2C LCD1602.
Real Life Applications
• Robotics
• Gaming
• Servers
• Computer Peripherals
• GPS
• Attendance systems, digital clock and digital cameras. This device is a good option
where time stamp is required.
LESSON 22
HUMITURE DETECTION
Hardware Required:
• 1 x USB cable
• Jumper Wires
Wiring Diagram
Principle
The digital temperature and humidity sensor DHT11 is a composite sensor thatcontains a
calibrated digital signal output of temperature and humidity. The technology of a dedi-
cated digital modules collection and the temperature and humidity sensing technology
are applied to ensure that the product has high reliability and excellent long-term stabil-
ity.
The sensor includes a resistive sense of wet component and an NTC temperature meas-
urement device, and is connected with a high-performance8-bit microcontroller.
(dht_test.ino)
Hardware Required:
• 1 x USB cable
• 1 x Relay Module
• Jumper Wires
Principle
Armature – The movable magnetic strip is known as armature. When current flows
through them, the coil is it energized thus producing a magnetic field which is
used to make or break the normally open (N/O) or normally close (N/C) points.
And the armature can be moved with direct current (DC) as well as alternating
current (AC).
Spring – When no currents flow through the coil on the electromagnet, the spring
pulls the armature away so the circuit cannot be completed.
The working principle of relay is simple. When power is supplied to the relay, current start
flowing through the control coil; as a result, the electromagnet starts energizing. Then the
armature is attracted to the coil, pulling down the moving contact together thus connect-
ing with the normally open contacts. Sothe circuit with the load is energized. Then breaking
the circuit would a similar case, as the moving contact will be pulled up to the normally
closed contacts under the force of the spring. In this way, the switching on and off of the
relay can control the state of a load circuit.
Send a low level to SIG; the PNP transistor is energized and the coil of the relay is
electrified. Thus, the normally open contact of the relay is closed, while the normally
closed contact of the relay will be off the public port.
Send a high level to SIG; the transistor will be de-energized and the relay will restore
to the initial state.
Schematic Diagram
Wiring Diagram
Quick Steps (Estimated time: 3 mins.)
4. Now, you may hear ticktock. That's the normally closed contact opened and the normally
• Smart control of traffic signals (using SPST relay) - Controlling of traffic signals
can be done using data acquired from vibration sensors on crossroads. SPST relays
• Temperature-based control of table fan (using SPDT relay) - shows how to con-
trol the speed of a table fan working on 230V AC supply. Speed of DC motors or
(PWM) signals. For AC equivalents, controlling can be done using power resistors or
• Precision agriculture (using DPST relay) - water a field according to the water
content in the soil. Arduino decides the amount of time and, hence, the amount of
water to be pumped in the field, using a DPST relay. A siren in parallel sounds to
control a simple unmanned ground vehicle (UGV) that moves forwards and back-
ternating the polarities of input voltage. A sensor such as ultrasonic sensor ob-
Hardware Required:
• 1 x USB cable
• 1 x Stepper Motor
Principle
Stepper motors, due to their unique design, can be controlled to a high degree of accuracy
without any feedback mechanisms. The shaft of a stepper, mounted with a series of mag-
nets, is controlled by a series of electromagnetic coils that are charged positively and neg-
atively in a specific sequence, precisely moving it forward or backward in small "steps".
Wiring Diagram
Quick Steps (Estimated time: 5 mins.)
The wiring between Stepper Motor Driver board and Arduino Uno board:
D / IN4 11
C / IN3 10
B / IN2 9
A / IN1 8
GND GND
VCC 5v
4. Now, you should see the rocker arm of the stepper motor spin clockwise and counter-
clockwise alternately.
Real Life Applications
• 3D printing equipment
• Textile machines
• Printing presses
• Gaming machines
• Small robotics
• Welding equipment
LESSON 25
SERVO
Hardware Required:
• 1 x USB cable
• 1 x Servo
• Jumper Wires
Wiring Diagram
Schematic Diagram
4. Now, you can see the servo motor rotate 90 degrees (rotate once every 15 degrees). And
then rotate in the opposite direction.
Real Life Applications
• Cameras, telescopes and antennas - Whether it’s finding a radio signal, capturing
images of a galaxy light-years away or a subject in the studio, servo motors often play
critical roles in focusing the equipment used to accomplish these things. These are
good examples of how servo motors can be useful in both precision, and linear and
rotary applications.
• Elevator technology - Safety is the name of the game when designers plan and
build building transportation systems. Elevators commonly use servo motors to safely
and smoothly move passengers in some of the world’s tallest buildings.
• Robotics - Robots are all the rage, and their practical applications seemingly in-
crease by the day. Nearly all robot designs use servo motors because of their efficient
and variable size, force density and precision. These robot applications can range all
the way from controlling the stopping, starting and speed of bomb detonation or un-
manned firefighting vehicles to the joints of robotic arms.
• Servo motors’ precision and power are key factors in fabrication machines that
bend or cut sheets of metal and milling machines that cut more dense parts of
metals or ones that require extreme power and speed to manipulate.
• Servo motors are also found in the spinning elements of conveyor systems that
are popular in bottling, packaging, textile and printing.
LESSON 26
JOYSTICK
Hardware Required:
• 1 x USB cable
• Jumper Wires
Wiring Diagram
Schematic Diagram
GND GND
VCC 5V
VRx A0
VRy A1
SW 2
4. Now, push the joystick and the coordinates of X and Y axes displayed on Serial Monitor will
change accordingly; press down the joystick, and the coordinate of Z=1 will also be displayed.
Real Life Applications
• Flight control in the cockpit of many aircraft, particularly military fast jets, where
• Also used for controlling machines such as cranes, trucks, underwater unmanned
Hardware Required:
• 1 x USB cable
• 1 x Remote Controller
• 1 x Infrared-receiver Module
• Jumper Wires
Wiring Diagram
Note: Be mindful of the connections,
incorrect connectivity will likely damage the
IR receiver immediately.
If your remote sends different codes than the ones in the table above, just replace the hex code in
each line where it says:
case 0xFFA25D:
Serial.println(“CH-“);
In these lines, when the hex code 0xFFA25D is received, the Arduino prints “CH-“.
• Wireless Keyboard from TV Remote - The basic idea of this project is when you hit a but-
ton on your TV remote. By using a IR receiver and an Arduino we can decode it and the decod-
ed values can be utilized to perform different keyboard operations.
• Automated room lighting system - The aim of this project is to automatically turn on or
off the lights in a room by detecting the human movement. Since the job of the circuit is to
turn on the light when someone enters the room and turn off the light when the last person
leaves the room. So the project must internally count the number of visitors entering and leav-
ing the room. This can be implemented using two IR sensors and a microcontroller.
• Gesture control using IR sensors - We can recognize three kinds of gestures which are
left-right swipe, moving hand forward-backward and waving using two IR sensors. Trigger
mechanism is used for this application.
• Line follower robot - These robots detect a black or dark line on a lighter surface. An
array of IR sensors is used to calculate reactance of surface beneath them. As black absorbs
more light, the black line has lesser reflectance value than lighter surface. This parameter is
used to detect the position of the line by the robot. By estimating whether the line under-
neath them is shifting toward their left or right as they move over them, they give respective
signals to the motors to turn left or right to maintain a steady center with respect to the
line.
• Proximity sensors - The sensing component in this circuit is IR photo-diode. Higher the
amount of InfraRed light falling on the IR photodiode causes more current to flow through
it. So bringing the object nearer to the IR LED Photo-Diode pair increases the amount of IR
rays from IR LED on the IR photodiode. Therefore voltage at the resistor increases.
Hardware Required:
• 1 x USB cable
• 1 x RFID Module
• 1 x Servo Motor
• 1 x I2C LCD1602
• 1 x Breadboard
• Jumper Wires
Wiring Diagram
1. Make the connections as described in the diagrams. The wiring between RFID and
Arduino Uno is as follows:
4. A message will pop in the LCD indicating to tap the card in order for it to be regis-
tered. Only the said registered card will have access and trigger the servo.
Real Life Applications
• Item Level Inventory Tracking - Tracking assets on the item level is beneficial
across a broad cross-section of industries, but the retail sector has one of the highest
ceilings in terms of opportunity from the use of RFID. As mentioned above, tracking
items through the supply chain is wonderful, but now think about tracking items
through the supply chain all the way to the point of sale. With a well designed inven-
tory system sharing data across all business units, you’ll have a treasure trove of ac-
tionable data. One last added benefit — store employees can count inventory in a
matter of minutes with a handheld RFID reader.
• Attendee Tracking - With an RFID attendee solution, eliminate the need for registra-
tion lines at entrances.
• Access Control - Certain areas require an expected level of security and access. From
doors to parking lots, RFID access control tags restrict access to only those pre-
approved.
• Kiosks - Many kiosks use RFID to either manage resources or interact with users.
RFID kiosks include interactive media displays where an embedded RFID reader inter-
rogates badges or cards.
• Library Systems - An RFID library solution improves the efficiency of circulation op-
erations. While barcodes require line of sight, RFID tags can be read from multiple
angles which means the checkout and check-in process is significantly faster.
Hardware Required:
• 1 x USB cable
• 1 x Keypad
• 1 x I2C LCD1602
• 1 x Breadboard
• Jumper Wires
Wiring Diagram
1 2 3 A
4 5 6 B
7 8 9 C
* 0 # D
1. Make the connections as described in the diagrams. The wiring between I2C LCD1602
and Arduino Uno is as follows:
The wiring between the relay module and the Arduino board:
4. Now, the I2C LCD1602 will display "Hello there! Press * to start!" after power on.
At this point, the indicator LED on the relay keeps off.
If you input an incorrect If you try to input an incorrect password, it will prompt you to
press * to input again the correct password.
• Password-based Systems