0% found this document useful (0 votes)
19 views

Arduino Tutorial Guide

This document is a comprehensive guide to Arduino tutorials, detailing the components of an Arduino kit, installation of the Arduino IDE, and step-by-step lessons for various projects. It covers hardware requirements, wiring diagrams, and real-life applications for each project, including controlling LEDs, using buzzers, and building interactive systems. The guide is designed for beginners to learn and experiment with Arduino programming and electronics.

Uploaded by

Alexander Laggui
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Arduino Tutorial Guide

This document is a comprehensive guide to Arduino tutorials, detailing the components of an Arduino kit, installation of the Arduino IDE, and step-by-step lessons for various projects. It covers hardware requirements, wiring diagrams, and real-life applications for each project, including controlling LEDs, using buzzers, and building interactive systems. The guide is designed for beginners to learn and experiment with Arduino programming and electronics.

Uploaded by

Alexander Laggui
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 104

ARDUINO

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

ARDUINO! components together. Versions that require solder-


ing are available, as well as the solder-less type
u s e d here.

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

with other components.

9V Battery Clip with DC Jack - Used to connect a


9V battery to power leads that can be easily
plugged into a breadboard or your Arduino. Re-
member to check the required voltage levels of
your components used in your project.
16x2 LCD with I2C Adapter - A type of alphanu- Jumper Wire - Use these to connect components
meric or graphic display based on liquid crystals. to each other on the breadboard, and to the Ar-
LCDs are available in a many sizes, shapes, and duino.
styles. Yours has 2 rows with 16 characters each.

Female-Male Jumper Cable

28BYJ-48 Stepper Motor - The 28BYJ-48 stepper


motor is a commonly used stepper motor, which
converts electrical pulses into discrete mechanical
rotation.

Remote

Keyboard - The keyboard functions enable 32u4 or


SAMD micro based boards to send keystrokes to an
attached computer through their micro’s native USB
port.
LED - a light-emitting diode (a semiconductor di- Dot matrix LED display - contains the group of
ode which glows when a voltage is applied). LEDs as a two dimensional array. Arrangement of
LEDs in the matrix pattern is made in either of the
two ways: Row anode-column cathode or Row
cathode-column anode. By using this dot matrix
display we can reduce the number of pins required
for controlling all the LEDs.

Photoresistor - (also called a photocell, or light


dependent resistor). A variable resistor that changes
its resistance based on the amount of light that falls
on its face.

LM35 is used to measure precise centigrade tem-


perature. The output of this sensor changes de-
scribes the linearity. The output voltages of this
sensor are linearly comparative to the Celsius tem-
perature. The output voltage range of this sensor is

Servo Motor - - A type of geared motor that can from -55˚ to +150˚C

only rotate 180 degrees. It is controlled by sending


electrical pulses from your Arduino. These pulses
tell the motor what position it should move to.
Potentiometer - A variable resistor with three pins.
74HC595 is a shift register which works on Serial IN
Two of the pins are connected to the ends of a
Parallel OUT protocol. It receives data serially from
fixed resistor. The middle pin, or wiper, moves
the microcontroller and then sends out this data
across the resistor, dividing it into two halves. When
through parallel pins. We can increase our output
the external sides of the potentiometer are con-
pins by 8 using the single chip.
nected to voltage and ground, the middle leg will
give the difference in voltage as you turn the knob.

5V Active Buzzer - has a built-in oscillating source


5V Passive Buzzer - is the slightly shorter one, with
- generates the sound itself. You basically just turn
the electronics exposed on the bottom. A passive
it on or off. It is the slightly taller one, with a solid,
buzzer needs a signal source that provides the
plastic coat on the bottom and a label that says to
sound signal.
remove it after washing.

Resistors

- Resist the flow of electrical energy in a circuit, changing the volt-


age and current as a result. Resistor values are measured in ohms
(represented by the Greek omega character: Ω). The colored stripes
on the sides of resistors indicate their value (see resistor color code
table).
1 digit 7 segment display
Sensor & Modules

Sound Sensor

4 digit 7 segment display

RTC Module

Button - Momentary switches that close a circuit


when pressed. They snap into breadboards easily.
These are good for detecting on/ off signals.

Water Level Detection Sensor Module


Flame Sensor Tilt Ball Switch

RFID Module

RGB Module

1 Channel Relay
Joystick Module IR Receiver Sensor

DHT11 Temperature and Humidity Module

HC-SR04 Ultrasonic Sensor


Installation Guide for Arduino

WELCOME TO ARDUINO! BEFORE YOU START CONTROLLING THE WORLD

AROUND YOU, YOU’LL NEED TO DOWNLOAD THE IDE TO PROGRAM YOUR

BOARD.

Things you will need:

• Computer

• Arduino Uno Board

• Arduino Software

The Arduino IDE allows you to write programs and upload them to your Arduino.

Download the latest version of the IDE from: arduino.cc/download

Have your Arduino board and USB cable near your computer.

Don’t plug them in just yet.

Follow the appropriate procedures for Windows, Mac OS X or Linux.


Installation Guide for Arduino

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”.

Few reminders when handling Arduino kit and projects!

• Only plug the Arduino board into the computer (via USB cable) after

assembling the wirings and circuitry, remove it once done. Plug it again

when starting a new one.

• 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-

grams do not match, refer to the given tables.

Now, you are done and ready to proceed to lesson 1!


LESSON 1
CONTROLLING LED BY BUTTON

Hardware Required: Schematic Diagram

• 1 x Arduino Uno board

• 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.)

1. Connect Arduino to PC via USB cable

2. Open Arduino IDE, select the right board and port.

3. Open the respective code given in the Arduino IDE (Controlling_LED_by_Button.ino)


4. Click Upload button on Arduino IDE to upload.

5. Press and keep pressing the button several seconds

6. See the change of LED’s state

Real Life Application:

• Learning the principle of switches

• Mechanical Devices

• Electrical Devices (Appliances, home and

commercial devices)
LESSON 2

CONTROLLING LED BY PWM

Hardware Required:

• 1 x Arduino Uno board

• 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 brightness of LED, speed control of DC motor, controlling a servo motor or

where you have to get analog output with digital means.

Arduino and PWM

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.

analogWrite(0) means a signal of 0% duty cycle.

analogWrite(127) means a signal of 50% duty cycle.

analogWrite(255) means a signal of 100% duty cycle.

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

PWM pins are labeled with ~ sign.


Quick Steps (Estimated time: 5 mins.)

Schematic Diagram

1. Make the connections as described in


the diagrams.

2. Open the respective code given in the

Arduino IDE

(Controlling_LED_by_PWM.ino)

3. Upload the sketch to the Arduino Uno

board

4. Here you should see the LED gets bright-

er and brighter, and then slowly dimmer,

just like breathing.

Other Applications of PWM:

• Electric stove

• PC power supplies

• Audio amplifiers

• Drive buzzer with different

loudness

• Control speed of motor

• Control the direction of servo


LESSON 3
INTERACTIVE LED FLOWING LIGHTS

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 8 x Resistor (220Ω)

• 1 x Breadboard

• 1 x Potentiometer

• 8 x LED

• Jumper Wires

Schematic Diagram
Wiring Diagram

Quick Steps (Estimated time: 30 mins.)

1. Make the connections as described above.

2. Open the respective code given in the Arduino IDE (led.ino)

3. Upload the sketch to the Arduino Uno board

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

• Holiday, architectural, and other lighting

companies that already employ LED technol-

ogies, can use the system to employ a more

interactive, human-centric approach to de-

sign

• Cities can incorporate the system in their ef-

forts to revitalize public

space by:

° Investing in interactive, public art using

LEDs

° Visualizing data gathered through smart

city initiatives

° Attracting foot traffic to business areas

° Improving public safety

° Place making and creating community

focal points

• Clubs, venues, and AV teams can quickly and

effectively create improved visual effects for

live performances and DJs

• Non-technical users are able to access so-

phisticated interactive technology without

custom programming or design knowledge


LESSON 4
16X2 LCD WITH I2C MODULE

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x I2C LCD1602 module

• Jumper Wires (Female-to-Male)

Wiring Diagram
Quick Steps (Estimated time: 3 mins.)

1. Make the connections as described above.

The connection between the I2C LCD1602 and the Arduino Uno board:

I2C LCD1602 Arduino Uno


GND GND
VCC 5V
SDA A4
SCL A5

2. Open the respective code given in the Arduino IDE (I2C_LCD1602.ino)

3. Upload the sketch to 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.

Please take note of the ad-


dress as you will need to
modify this in other lessons.

Real Life Applications

• The liquid crystal displays (LCDs) are used in aircraft cockpit displays.

• It is used as a display screen in calculators.

• For displaying images used in digital cameras.

• The television is main applications of LCD.

• Mostly the computer monitor is made up of LCDs.

• 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 LCDs are used in mobile screens.

• It is also used in video players.


Real Life Applications

• The liquid crystal displays (LCDs) are used in aircraft cockpit displays.

• It is used as a display screen in calculators.

• For displaying images used in digital cameras.

• The television is main applications of LCD.

• Mostly the computer monitor is made up of LCDs.

• 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 LCDs are used in mobile screens.

• It is also used in video players.


LESSON 5
BUZZER

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x Active Buzzer

• 1 x Breadboard

• Jumper Wires

Note: Shorter leg is negative


Wiring Diagram
(connected to ground)
Schematic Diagram

Quick Steps (Estimated time: 3 mins.)

1. Make the connections as described in the diagrams.

2. Open the respective code given in the Arduino IDE (active.ino)

3. Upload the sketch to the Arduino Uno board

4. Here you should hear the Arduino make sounds.

Real Life Applications

• Alarms

• Automobile Alerts

• Communication Equipment
LESSON 6
TILT SWITCH

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x Tilt Switch

• Jumper Wires

Wiring Diagram
Schematic Diagram

Quick Steps (Estimated time: 3 mins.)

1. Make the connections as described in the diagrams.

2. Open the respective code given in the Arduino IDE (Tilt_Switch.ino)

3. Upload the sketch to the Arduino Uno board

4. Now, tilt the switch, and the LED attached to pin 13 on Arduino Uno board will light up.

Real Life Applications

• Cameras • Automobile Air Bags

• Aircraft Flight Controls • Videos Game Controllers

• Construction Equipment • Studying Human Movement

• Robotic Technology • Automobile Security Systems


LESSON 7
BUILDING A QUIZ BUZZER SYSTEM

Hardware Required:

• 1 x Arduino Uno board

• 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

Quick Steps (Estimated time: 25 mins.)

1. Make the connections as described in the diagrams.

2. Open the respective code given in the Arduino IDE (Building_a_Quiz_Buzzer_System.ino)

3. Upload the sketch to the Arduino Uno board

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

press other buttons.

Real Life Applications

• Gameshow Buzzers
LESSON 8
SERIAL MONITOR

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 3 x LED

• 3 x Resistor (220Ω)

• 1 x Breadboard

• Jumper Wires

Wiring Diagram
Schematic Diagram

Quick Steps (Estimated time: 5 mins.)

1. Make the connections as described in the


diagrams.

2. Open the respective code given in the Ar-

duino IDE (Serial_Monitor.ino)

3. Upload the sketch to the Arduino Uno board

4. Now, click the Serial Monitor button at the

upper right corner in the IDE. Then the Serial

Monitor window will pop up as shown.


With this window, you can send not only data from your computer to the Arduino Uno
board, but also receive data from the board and display it on the screen.

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 Arduino Uno board

• 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

Quick Steps (Estimated time: 20 mins.)

1. Make the connections as described in the


diagrams.

2. Open the respective code given in the Ar-

duino IDE (photoresistor.ino)

3. Upload the sketch to the Arduino Uno

board

4. Now, if you shine the photoresistor with a

certain light intensity, you will see several

LEDs light up. If you increase the light inten-

sity, you will see more LEDs light up. When

you place it in dark environment, all the

LEDs will go out.


Real Life Applications

• 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.

• Solar street lamps, night-night-lights

• Clock radios
LESSON 10
CONTROLLING BUZZER BY PHOTORESISTOR

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x Buzzer (active)

• 1 x Resistor (10kΩ)

• 1 x Photoresistor

• 1 x Breadboard

• Jumper Wires

Wiring Diagram
Schematic Diagram

Quick Steps (Estimated time: 5 mins.)

1. Make the connections as described in the diagrams.

2. Open the respective code given in the Arduino IDE

(Controlling_Buzzer_by_Photoresistor.ino)

3. Upload the sketch to the Arduino Uno board

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 Arduino Uno board

• 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

The shorter lead of the flame sensor is for


negative, the other one for positive. Connect
negative to 5V pin, positive to resistor; con-
nect the other end of the resistor to GND,
connect one end of a jumper wire to a clip
which is electrically connected to sensor
positive, the other end to analog pin. As
shown below:

Quick Steps (Estimated time: 5 mins.)

1. Make the connections as described in the diagrams.

2. Open the respective code given in the Arduino IDE (Flame_Alarm.ino)

3. Upload the sketch to the Arduino Uno board

4. Now, ignite a lighter near the flame sensor. The buzzer will produce a sound depending

on the flame intensity.

Real Life Applications

• Fire alarms for earliest possible

extinguishment
LESSON 12
MAKING A VOLTMETER

Hardware Required:

• 1 x Arduino Uno board

• 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.

Quick Steps (Estimated time: 5 mins.)

1. Make the connections as described


in the diagrams.

2. Open the respective code given in

the Arduino IDE (Voltmeter.ino)

3. Upload the sketch to the Arduino

Uno board

4. Now, adjust the potentiometer and

you will see the voltage displayed on

the I2C LCD1602 varies accordingly

Real Life Applications

• Voltmeter, Multimeter
LESSON 13
CONTROL LED BY CLAP USING SOUND SENSOR

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x Sound Sensor Module

• 1 x Resistor (1k)

• 1 x LED

• Jumper Wires

Wiring Diagram
Quick Steps (Estimated time: 5 mins.)

1. Make the connections as described in the diagrams.

Sound Sensor Arduino Uno

DO Pin 2

GND GND

VCC 5V

2. Open the respective code given in the Arduino

IDE (Sound_Sensor.ino)

3. Upload the sketch to the Arduino Uno board

4. Make sure to readjust or recalibrate the potenti-

ometer of the sensor. Start clapping and you will

see that the LED will respond to the sound of the

clap.
Real Life Applications

• Consumer electronics such as phones, com-

puters, music systems

• Security and Monitoring systems such as

burglar alarms, door alarm, etc.

• Home automation such as lighting your

house by detecting whistle/clap instead of

physically turning the light switch

• Ambient sound recognition and sound level

recognition
LESSON 14
LM35 TEMPERATURE SENSOR

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x LM35 Temperature Sensor

• 1 x I2C LCD1602

• Jumper Wires

Wiring Diagram
Principle

The output voltage of the LM35 is propor-


tional to Celsius temperature. When placed
in 0℃ ambient temperature, it will output
0V. The output voltage will increase 10mV
each time the temperature increases by
1℃. The calculation formula is as follows:

Quick Steps (Estimated time: 5 mins.)

1. Make the connections as described in the diagrams.

2. Open the respective code given in the Arduino IDE (LM35.ino)

3. Upload the sketch to the Arduino Uno board

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.

• Home appliances – kettles, toasters, washing machines, dishwashers and coffee


machines will all contain temperature sensors.

• Computers– within computers there are temperature sensors to ensure the system
does not overheat

• Industrial equipment – temperature sensors used within these applications will


need to be robust as the environment can be very demanding.

• Exhaust Gas Monitoring on Motorsport Vehicles – Motorsport temperature sen-


sors need to be highly reliable and durable to ensure performance is not compromised
in this harsh environment.

• Food Production; 3D printed chocolates – temperature sensors are used to moni-


tor the temperature of the melted chocolate for 3D printing.

• Alcohol breathalyzer – thermistors are used within alcohol breathalyzers to meas-


ure the temperature of the subject's breath.
LESSON 15
WATER LEVEL DETECTION

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x Breadboard

• 1 x Water Level Sensor

• 1 x I2C LCD1602

• Jumper Wires

Wiring Diagram
Quick Steps (Estimated time: 5 mins.)

1. Make the connections as described in the diagrams.

2. Open the respective code given in the Arduino IDE (waterTest.ino)

3. Upload the sketch to the Arduino Uno board

4. Now, if you immerse the sensor in water, you can see the depth to which the sensor is

soaked displayed on the I2C LCD1602 .


Real Life Applications

• Irrigation

• Flood Monitoring

• Open Channel Flow

• Sea Level Monitoring

• Streams, Rivers, Ponds

• Water Tank Level

• Tidal Monitoring

• Wastewater
LESSON 16
7-SEGMENT DISPLAY

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x Breadboard

• 8 x Resistor (220Ω)

• 7-segment display (Common Cathode)

• Jumper Wires

Wiring Diagram
Principle

The 7-segment display consists of seven LEDs arranged


in a rectangular fashion. Each of the seven LEDs is called
a segment because when illuminatedthe segment forms
part of a numerical digit (both Decimal and Hex) to be
displayed.

An additional 8th LED is sometimes used within the


same packagethus allowing the indication of a decimal
point (DP) when two or more 7- segment displays are
connected together to display numbers greater than ten.

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 Common Cathode (CC) – In the com-

mon cathode display, all the cathode con-

nections of the LED segments are joined

together to logic "0" or ground. The individ-

ual segments are illuminated by application

of a "HIGH", or logic "1" signal via a current

limiting resistor to forward bias the individu-

al Anode terminals (a-g).


Principle

The Common Anode (CA) – In the common


anode display, all the anode connections of
the LED segments are joined together to
logic "1". The individual segments are illu-
minated by applying a ground, logic "0" or
"LOW"signal via a suitable current limiting
resistor to the Cathode of the particular
segment (a-g).

Quick Steps (Estimated time: 15 mins.)

1. Make the connections as described in the diagrams.

The wiring between the 7-segment display and the Arduino Uno board
is as shown below:

7-Segment Display Arduino Uno


Board
a 7
b 6
c 5
d 11
e 10
f 8
g 9
dp 4
"-" GND

2. Open the respective code given in the Arduino IDE (_7_Segment_Display.ino)

3. Upload the sketch to the Arduino Uno board.

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

• Elevator floor indicator


LESSON 17
STOPWATCH 4-DIGIT 7-SEGMENT DISPLAY

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x 4-Digit 7-Segment Display

• 8 x Resistor (220Ω)

• 1 x Breadboard

• Jumper Wires

Wiring Diagram
Schematic Diagram

Quick Steps (Estimated time: 25 mins.)

1. Make the connections as de-


scribed in the diagrams.

2. Open the respective code giv-

en in the Arduino IDE

(stopwatch.ino)

3. Upload the sketch to the Ar-

duino Uno board

4. Now, you can see the number

increases by one per second

on the 4-digit 7- segment dis-

play.

Real Life Applications

• Stopwatch

• Scoreboards
LESSON 18
DOT-MATRIX DISPLAY

Hardware Required:

• 1 x Arduino Uno board


• 1 x Breadboard
• 1 x USB cable
• 1 x 74HC595
• 1 x 8x8 Dot-Matrix
• Jumper Wires
• 8 x Resistor (220Ω)

Wiring Diagram
Schematic Diagram

Principle

The external view of a dot-matrix is shown as follow:


For pin definition:
Define row and column numbering at first (only for a dot-matrix whose model
number ends with BS)

Pin numbering corresponding to the above rows and columns:

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 display principle of the 8x8 dot-matrix:

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.

The principle of 74HC595 has been previously illustrated. One chip is


used tocontrol the rows of the dot-matrix while the other is to control
the columns.

Quick Steps (Estimated time: 30 mins.)

1. Make the connections as de-


scribed in the diagrams.

2. Connect 74HC595 (u2), Dot-


Matrix and Arduino Uno board.
Connect the other 74HC595
(u3), Dot-Matrix and Arduino
Uno board.

3. Open the respective code given

in the Arduino IDE

(8X8_Dot_Matrix_Display.ino)

4. Upload the sketch to the Ar-

duino Uno board

5. Here you should see the dot-

matrix display 0 to F circularly.


6. Changing the display and build a new one using character builder in this
website: https://rodrigosc.github.io/ArduinoLedMatrix/char_builder/
builder.html

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

Real Life Applications

• Advertisement information in shops

• Clocks

• Railway departure indicators

• Bus routes

• Anything where low cost displays are required with limited resolution
LESSON 19
RAINBOW LED

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x RGB LED Module


Wiring Procedures
• Jumper Wires

Arduino pin 11 --> Pin R module

Arduino pin 10 --> Pin G module

Arduino pin 9 --> Pin B module

Arduino pin GND --> Pin - module

You don't need any resistors, these


are already included on the module.

Wiring Diagram
Quick Steps (Estimated time: 3 mins.)

1. Make the connections as described in the diagrams.

2. Open the respective code given in the Arduino IDE (RGB.ino)

3. Upload the sketch to the Arduino Uno board

Real Life Applications

• Mood lamp

• Other DIY Projects


LESSON 20
DRIVING 7-SEGMENT DISPLAY BY 74HC595

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 8 x Resistor (220Ω)

• 1 x Breadboard

• 1 x 74HC595

• 1 x 7-Segment Display

• Jumper Wires

Principle

The 74HC595 consists of an 8−bit shift register


and a storage register with three−state parallel
outputs. It converts serial input into parallel output
so that you can save IO ports of an MCU. The
74HC595 is widely used to indicatemultipath LEDs
and drive multi-bit segment displays. "Three-state"
refers to the fact that you can set the output pins
as either high, low or "high impedance." With data
latching, the instant output will not be affected
duringthe shifting; with data output, you can cas-
cade 74HC595s more easily.
Wiring Diagram

Schematic Diagram
Quick Steps

1. Make the connections as described in the diagrams.

7-Segment Display 74HC59 Arduino Uno R3


5
a Q7

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.)

2. Make the connections as described in the diagrams.

3. Open the respective code given in the Arduino IDE (_74HC595.ino)

4. Upload the sketch to the Arduino Uno board.

5. You should now see the 7-segment display cycle from 0 to F.


LESSON 21
REAL-TIME CLOCK MODULE

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x RTC-DS1302 Module

• 1 x I2C LCD1602 Module

• Jumper Wires

Wiring Diagram
Schematic Diagram

Quick Steps (Estimated time: 10 mins.)

1. Make the connections as described in the diagrams.

The wiring between DS1302 and Arduino Uno board is as shown below:

DS1302 Arduino Uno


SCL / CLK 6
SDA / DAT 7
RST 8
VCC 5V
GND GND
2. Open the respective code given in the Arduino IDE (clock.ino).

3. Upload the sketch to the Arduino Uno board.

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

• Utility power meters

• 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 Arduino Uno board

• 1 x USB cable

• 1 x DHT11 Humidity and Temperature Sensor Module

• 1 x I2C LCD1602 Module

• 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.

Only three pins are available for use: VCC, GND,


and DATA. The communication process begins with
the DATA line sending start signals to DHT11, and
DHT11 receives the signals and returns an answer
signal. Then the host receives the answer signal and
begins to receive 40-bit humiture data(8-bit humidi-
ty integer + 8-bit humidity decimal + 8-bit tem-
perature integer + 8-bit temperature decimal + 8-
bit checksum).

Real Life Applications

• Smart home devices use humiture sensor to adjust indoor environment


Schematic Diagram

Quick Steps (Estimated time: 5 mins.)

1. Make the connections as


described in the diagrams.

2. Open the respective code

given in the Arduino IDE

(dht_test.ino)

3. Upload the sketch to the Ar-

duino Uno board.

4. Now, you can see the value of

current humidity and temper-

ature displayed on the LCD.


LESSON 23
RELAY

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x Relay Module

• Jumper Wires

Principle

There are 5 parts in every relay:

Electromagnet – It consists of an iron core wounded by coil of wires. When electrici-


ty is passed through, it becomes magnetic. Therefore, it is called electromagnet.

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.

Set of electrical contacts – There are two contact points:


Normally open - connected when the relay is activated, and discon-
nected when it is inactive.
Normally close – not connected when the relay is activated, and connected
when it is inactive.

Molded frame – Relays are covered with plastic for protection.


Working of Relay

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.

So in this experiment, hook the SIG to the Arduino Uno board.

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.)

1. Make the connections as described in the diagrams.

2. Open the respective code given in the Arduino IDE (relay.ino)

3. Upload the sketch to the Arduino Uno board.

4. Now, you may hear ticktock. That's the normally closed contact opened and the normally

open contact closed.


Real Life Applications

• 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

act as simple switches for controlling red-yellow-green signals, which work on

higher power supply.

• 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

fans can be controlled by using simple potentiometer or pulse-width modulated

(PWM) signals. For AC equivalents, controlling can be done using power resistors or

power semiconductor devices. Depending on temperature, an SPDT relay can be

switched on to provide resistance of 120 ohms or 60 ohms in the circuit, leading to

different fan speeds.

• 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

indicate pump in on condition. This application is helpful in saving water.

• Unmanned ground vehicle for inhumane environments (using DPDT relay)-

control a simple unmanned ground vehicle (UGV) that moves forwards and back-

wards depending on input. A DC motor’s direction of rotation is controlled by al-

ternating the polarities of input voltage. A sensor such as ultrasonic sensor ob-

serves the obstacles and decides whether to move forwards or backwards.


LESSON 24
STEPPER MOTOR

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x Stepper Motor

• 1 x Stepper Motor Driver

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".

There are two types of steppers,


unipolars and bipolars, and it is
very important to know which type
you are working with. In this exper-
iment, we will use a unipolar step-
per.

Arduino board or other MCUs can-


not directly drive stepper motors. A
driver circuit is necessary, so we use
a stepper motor driver board (as
shown in the following picture) to
drive the stepper motor.
Schematic Diagram

Wiring Diagram
Quick Steps (Estimated time: 5 mins.)

1. Make the connections as described in the diagrams.

The wiring between Stepper Motor Driver board and Arduino Uno board:

Stepper Motor Driver Arduino Uno

D / IN4 11
C / IN3 10
B / IN2 9
A / IN1 8
GND GND
VCC 5v

2. Open the respective code given in the Arduino IDE (StepMotor.ino)

3. Upload the sketch to the Arduino Uno board.

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

• Medical imaging machinery

• Small robotics

• CNC milling machines

• Welding equipment
LESSON 25
SERVO

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x Servo

• Jumper Wires

Wiring Diagram
Schematic Diagram

Quick Steps (Estimated time: 3 mins.)

1. Make the connections as described in the diagrams.

2. Open the respective code given in the Arduino IDE (servo.ino)

3. Upload the sketch to the Arduino Uno board.

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.

• Industrial production - Manufacturers are aggressively developing robotic solu-


tions to reduce the chances for human error and speed up processes. These include
arms that require precise movement and angular positioning to weld and/or move ma-
terials short distances all the way to pick-and-place robots that may carry cargo from
one side of a plant to the other. All of them commonly use servo motors to control
movement or rotation in environments that can often be extreme or dangerous.

• 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 Arduino Uno board

• 1 x USB cable

• 1 x Joystick PS2 Module

• Jumper Wires

Wiring Diagram
Schematic Diagram

Quick Steps (Estimated time: 5 mins.)

1. Make the connections as described in the diagrams.

Joystick PS2 Arduino Uno

GND GND
VCC 5V
VRx A0
VRy A1
SW 2

2. Open the respective code given in the Arduino IDE (Joystick_PS2.ino)

3. Upload the sketch to the Arduino Uno board.

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

• Computer games and assistive technology

• Controlling unmanned vehicle

• Flight control in the cockpit of many aircraft, particularly military fast jets, where

center stick or side-stick location may be employed.

• Also used for controlling machines such as cranes, trucks, underwater unmanned

vehicles and zero turning radius lawn mowers.


LESSON 27
INFRARED RECEIVER

Hardware Required:

• 1 x Arduino Uno board

• 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.

IR Receiver Arduino Uno


SIG (Blue) 8
GND (Blk) GND
VCC (Red) 5V
Principle

IR or infrared communication is one of the most common methods of wireless


communication due to being easy to use and having an affordable price. Infrared
light, with a wavelength longer than visible light, is not within the range of human
vision. That’s why it’s a good option for wireless communications. When you press
a button on your TV control, an LED on your control turns on and off continuously
and causes a modulated infrared signal to send from the control to your TV. The
command will execute after the signal is demodulated. IR receiver modules are
used to receive IR signals.

Quick Steps (Estimated time: 5 mins.)

1. Make the connections as described in the diagrams.

2. Open the respective code given in the Arduino IDE (irReceive.ino)

3. Upload the sketch to the Arduino Uno board.


1. Open serial monitor, and press some buttons on the remote, it should display some values.

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-“.

Real Life Applications

• 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.

• Infrared obstacle avoidance sensor - An IR Obstacle Sensor works in accordance with


the infrared reflection principle to detect obstacles. When there is no object, the infrared re-
ceiver receives no signals. When there is an object ahead which blocks and reflects the infra-
red light, the infrared receiver will receive signals.

• Eyeball Motion Controlled Wheelchair Using IR Sen-


sors - In this project each eye will be having IR transmitter
and receiver. Transmitter IR will transmit the light over iris
and reflected light will received by IR receiver. Depending
upon the intensity of reflected light falling on the receiver,
the controller will understand the user intention of wheel-
chair movement. Now controller will take the decision of
moving forward, left or right as long as IR receiver receives
the directions information from the user.

• Precision agriculture using IR sensors on drones - Precision agriculture allows farmers


to maximize yields using minimal resources such as water, fertilizer, and seeds. By deploying
LESSON 28
RFID SYSTEM

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x RFID Module

• 1 x RFID Key tag

• 1 x Servo Motor

• 1 x I2C LCD1602

• 1 x Breadboard

• Jumper Wires

Wiring Diagram

Note: For this module, please


use a 3.3V power supply, or the
RFID will get damaged!
Note: For this module, please use a 3.3V power supply, or the RFID will
get damaged!

Quick Steps (Estimated time: 15 mins.)

1. Make the connections as described in the diagrams. The wiring between RFID and
Arduino Uno is as follows:

RFID Arduino Uno


VCC 3.3V
RST 9
GND GND
IRQ
MISO 12
MOSI 11
SCK 13
SDA 10

The wiring between I2C LCD1602 and Arduino Uno:

I2C LCD1602 Arduino Uno


GND GND
VCC 5v
SDA A4
SCL A5
The wiring between Relay Module and Arduino Uno:

Servo Motor Arduino Uno


SIG 3
VCC 5V
GND GND

2. Open the respective code given in the Arduino IDE (rfidTest.ino)

3. Upload the sketch to the Arduino Uno board.

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.

• Interactive Marketing - RFID in marketing brings a certain level of interaction to


campaigns. Whereas traditional advertising campaigns push a message onto the con-
sumer, interactive campaigns invite the consumer to engage with the brand.
LESSON 29
PASSWORD LOCK

Hardware Required:

• 1 x Arduino Uno board

• 1 x USB cable

• 1 x 1 Channel Relay Module

• 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

Format of alphanumeric keys in the keypad, this could be changed by programming.

Quick Steps Estmated time: 20 mins.

1. Make the connections as described in the diagrams. The wiring between I2C LCD1602
and Arduino Uno is as follows:

I2C LCD1602 Arduino Uno


GND GND
VCC 5v
SDA A4
SCL A5

The wiring between the relay module and the Arduino board:

Relay Module Arduino Uno


SIG PIN 3
VCC 5V
GND GND
2. Open the respective code given in the Arduino IDE.

3. Upload the sketch to the Arduino Uno board. (lock,ino)

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.

5. Press "*" key, it will prompt “Input Your Code: ".


6. If you enter “123456” and press “#” key to confirm, the indicator LED on the relay mod-
ule will light up. The I2C LCD1602 will display “Input Correct" "Please Come In". The
password can be altered in the code given.

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.

Real Life Applications

• Digital Keypad Security Door Lock

• Security and Alarm System

• Password-based Systems

You might also like