37 SENSOR KIT TUTORIAL FOR UNO AND MEGA v1.0 PDF
37 SENSOR KIT TUTORIAL FOR UNO AND MEGA v1.0 PDF
37 SENSOR KIT TUTORIAL FOR UNO AND MEGA v1.0 PDF
com
V1.0.18.10.25
Preface
Our Company
Established in 2011, Elegoo Inc. is a thriving technology company dedicated to
research & development, production, and marketing of open-source hardware.
Located in Shenzhen, the Silicon Valley of China, we have grown to over 150+
employees with a 10,763+ square ft.factory.
Our product lines include DuPont wires, UNO R3 boards and complete starter kits
designed for customers of any level to learn Arduino knowledge. In addition, we also
sell Raspberry Pi accessories like TFT touch screens. Additionally, we plan to
expand our offerings to include other technologies, including products related to
3D printing. All of our products comply with international quality standards and
have been praised by our customers in a variety of different marketplaces
throughout the world.
Official website:
http://www.elegoo.com
Amazon US storefront:
http://www.amazon.com/shops/A2WWHQ25ENKVJ1
Amazon Canada storefront:
http://www.amazon.ca/shops/A2WWHQ25ENKVJ1
Amazon Mexico storefront:
https://www.amazon.com.mx/shops/A2WWHQ25ENKVJ1
Amazon UK storefront:
http://www.amazon.co.uk/shops/AZF7WYXU5ZANW
Amazon Germany storefront:
http://www.amazon.de/shops/AZF7WYXU5ZANW
Amazon France storefront:
http://www.amazon.fr/shops/AZF7WYXU5ZANW
Amazon Spain storefront:
http://www.amazon.es/shops/AZF7WYXU5ZANW
Amazon Italy storefront:
http://www.amazon.it/shops/AZF7WYXU5ZANW
Our Tutorial
This tutorial is designed for beginners. You will learn all the basic information about
how to use the Arduino controller board, sensors and components. If you want to
study Arduino in more depth, we recommend that you read the book “Arduino
Cookbook” by Michael Margolis.
Some code in this tutorial has been edited by Simon Monk. Simon Monk is th e
author of a number of books relating to Open Source Hardware. Some of his works
include “Programming Arduino”, “30 Arduino Projects for the Evil Genius” and
“Programming the Raspberry Pi” and can be found on Amazon
Customer Service
As a continuously and quickly growing technology company, we strive to
of fer you excellent products and quality service. You can reach out to us by email
at service@elegoo.com or EUservice@elegoo.com. We look forward to hearing
from you and any comments or suggestions are of great value to us.
Any problems or questions that you have with our products will be promptly
answered by our experienced engineers within 12 hours (24hrs during holiday)
3 / 193
Http://www.elegoo.com
Packing List
4 / 193
Http://www.elegoo.com
5 / 193
Http://www.elegoo.com
Lesson Listing
Lesson 0 Installing IDE .............................................................................................................................................. 7
Lesson 15 Large Microphone Module and Small Microphone Module .............................................................. 107
Lesson 16 Reed Switch and Mini Reed Switch Module ....................................................................................... 114
6/193
Http://www.elegoo.com
Introduction
The Arduino Integrated Development Environment (IDE) is the software side of the
Arduino platform.
In this lesson, you will learn how to setup your computer to use Arduino and how
to set about the lessons that follow.
The Arduino software that you will use to program your Arduino is available for
Windows, Mac and Linux. The installation process is different for all three platforms
and unfortunately there is a certain amount of manual work to install the software.
The version available at this website is usually the latest version, and the
actual version may be newer than the version in the picture.
7/193
Http://www.elegoo.com
8/193
Http://www.elegoo.com
9/193
Http://www.elegoo.com
Click Next
You can press Browse… to choose an installation path or directly type in the directory you want.
10/193
Http://www.elegoo.com
Finally, the following interface appears, click Install to finish the installation.
11/193
Http://www.elegoo.com
You may directly choose the installation package for installation and skip the contents
below and jump to the next section. But if you want to learn some methods other than the
installation package, please continue to read the section.
Unzip the zip file downloaded, Double-click to open the program and enter the desired
development environment
12/193
Http://www.elegoo.com
13/193
Http://www.elegoo.com
14/193
Http://www.elegoo.com
Right-click on the device and select the top menu option (Update Driver Software...).
You will then be prompted to either ‘Search Automatically for updated d r i v e r
software’ or ‘Browse my computer for driver software’. Select the option to browse
and navigate to theX\arduino1.8.5\drivers.
15/193
Http://www.elegoo.com
Click 'Next' and you may get a security warning, if so, allow the software to be installed. Once
the software has been installed, you will get a confirmation message.
Windows users may skip the installation directions for Mac and Linux systems and
jump to Lesson 1. Mac and Linux users may continue to read this section.
16/193
Http://www.elegoo.com
Download and Unzip the zip file, double click the Arduino. app to enter Arduino IDE; the system
will ask you to install Java runtime library if you don’t have it in your computer. Once the
17/193
Http://www.elegoo.com
·Arduino IDE
18/193
Http://www.elegoo.com
TIPS: If you have problems in installing the drivers, please refer to the
UNO R3, MEGA, NANO DRIVER FAQ.
19/193
Http://www.elegoo.com
20/193
Http://www.elegoo.com
Then the library manager will open and you will find a list of libraries that are already installed
or ready for installation. In this example we will install the Bridge library. Scroll the list to find
it, then select the version of the library you want to install. Sometimes only one version of
the library is available. If the version selection menu does not appear, don't worry: it is
normal.
There are times you have to be patient with it, just as shown in the figure. Please refresh it and
wait.
21/193
Http://www.elegoo.com
Finally click on install and wait for the IDE to install the new library. Downloading may take time
depending on your connection speed. Once it has finished, an Installed tag should appear next to the
Bridge library. You can close the librarymanager.
You can now find the new library available in the Include Library menu. If you want to add
your own library open a new issue on github.
22/193
Http://www.elegoo.com
You will be prompted to select the library you would like to add. Navigate to the .zip file's location and
open it.
23/193
Http://www.elegoo.com
24/193
Http://www.elegoo.com
Return to the Sketch > Import Library menu. You should now see the library at the bottom of the
drop-down menu. It is ready to be used in your sketch. The zip file will have been expanded in the
libraries folder in your Arduino sketches directory.
NB: the Library will be available to use in sketches, but examples for the library will not be exposed
in the File > Examples until after the IDE has restarted.
Those two are the most common approaches. MAC and Linux systems can be handled likewise. The
manual installation to be introduced below as an alternative may be seldom used and users with no
needs may skip it.
Manualinstallation
To install the library, first, quit the Arduino application. The nun zip the ZIP file containing the library.
For example, if you're installing a library called "Arduino Party", uncompressed Arduino Party .zip. It
should contain a folder called Arduino Party, with files like Arduino Party. cpp and Arduino Party .h
inside. (If the.cpp and.h files aren’t in a folder, you'll need to create one. In this case, you'd make a
folder called "Arduino Party" and move into it all the files that we rein the ZIP file, like Arduino
Party .cpp and Arduino Party .h.)
Drag the Arduino Party folder into this folder (your libraries folder). Under Windows, it will
likely
be called "My Documents\Arduino\libraries". For Mac users, it will likely be called
"Documents/Arduino/libraries". On Linux, it will be the "libraries" folder in your sketchbook.
Your Arduino library folder should now look like this (on Windows):
My Documents\Arduino\libraries\ArduinoParty\ArduinoParty.cpp
My Documents\Arduino\libraries\ArduinoParty\ArduinoParty.h
My Documents\Arduino\libraries\ArduinoParty\examples
....
Documents/Arduino/libraries/ArduinoParty/ArduinoParty .cpp
Documents/Arduino/libraries/Arduino Party/examples
....
25/193
Http://www.elegoo.com
There may be more files than just the .cpp and .h files so make sure they're all there. (The
library won't work if you put the .cpp and .h files directly into the libraries folder or if they're
nested in an extra folder. For example: Documents\Arduino\libraries\ArduinoParty.cpp and
Documents\Arduino\libraries\ArduinoParty\ArduinoParty\ArduinoParty.cpp won't work.)
Restart the Arduino application. Make sure the new library appears in the Sketch > Import
Library menu. That's it. You've installed a library!
26/193
Http://www.elegoo.com
In this tutorial we will learn how to use a DHT11 Temperature and Humidity Sensor.
It’s accurate enough for most projects that need to keep track of humidity and
temperature readings.
Again we will be using a Library specifically designed for these sensors that will make our
code short and easy to write.
Component Required:
27/193
Http://www.elegoo.com
Component Introduction
DHT11 digital temperature and humidity sensor is a composite sensor contain sac a liberated digital
signal output of the temperature and humidity. Application of a dedicated digital modules collection
technology and the temperature and humidity sensing technology, to ensure that the product has
high reliability and excellent long-term stability. The sensor includes a capacitive sense of wet
components and an NTC temperature measurement devices, and connected with a high-
performance 8-bit microcontroller
Applications: HVAC, dehumidifier, testing and inspection equipment, consumer goods, automotive,
automatic control, data loggers, weather stations, home appliances, humidity regulator, medical and
other humidity measurement and control.
Product parameters
Relative humidity: Resolution:
16 Bit
1 m/sari 6s Hysteresis:
<±0.3% RH
28/193
Http://www.elegoo.com
Resolution: 16 Bit
Repeatability: ±0.2℃
Range: At 25℃±2℃ Response
DC 3.5 ~5.5V
seconds
negative power
Typical Application
Connection
Schematic
29/193
Http://www.elegoo.com
wiring diagram
30/193
Http://www.elegoo.com
31/193
Http://www.elegoo.com
Result
Upload the program then open the monitor, we can see the data as below :( It shows
the temperature of the environment, we can see it is 28 degree)
32/193
Http://www.elegoo.com
33/193
Http://www.elegoo.com
In this experiment, we will learn how to use DS18B20 module test the environmental temperature
and make a thermometer.
Since the previous temperature sensor output is analog. So we need to add additional A/D and D/A chip
into the line transformation. More -over, the Arduino external port is not rich resources and the
utilization rate is not high.so we are create the Ds18b20 module.
The new DS18B20 Temperature Sensor Module is very good solve the problem. It have the
characteristic of the economy, unique 1-wire bus and it can fully apply the Arduino platform.
Users can easily form a sensor net work through using this module.
Product parameters
• Temperature range: -55 to +125°C
• Typical accuracy: 0.5°C
• Resolution: 9-12 Bit, depending on the program
34/193
Http://www.elegoo.com
Component Required:
Component Introduction
DS18B20:
35/193
Http://www.elegoo.com
Principle
DS18B20 module is using a single bus. The power supply voltage range of 3.0 V to 5.5 V and no standby
power supply. It can Measure temperature range for-55 degree to +125 degree with accuracyof+/-
0.5 °C.
The programmable DPI of temperature sensor is from 9 to 12. Temperature conversion is 12 digits
lattice type. Maximum is 750 milliseconds. Families can be defined non-volatile temperature a l a r m
Settings.
Each DS18B20 contains a unique serial number so that multiple ds18b20s can ex is tin a bus.
Connection
Schematic
36/193
Http://www.elegoo.com
wiring diagram
37/193
Http://www.elegoo.com
38/193
Http://www.elegoo.com
Result
Temperature sensor can detect temperature in numbers of different places at the same time.
Upload the program then open the monitor, we cansee the data as below:
39/193
Http://www.elegoo.com
49/193
Http://www.elegoo.com
A built-in 10 K ohm resistor is connected between the center pin and the ‘S’ pin and
can be used as a pull up or pull down resistor. The push button connects the two
outer pins.
Component Required:
Component Introduction
PUSH SWITCHES:
Switches are really simple components. When you press a button or flip a lever, they connect two
contacts to get her so that electricity can flow through them.
41/193
Http://www.elegoo.com
Actually, there are only really two electrical connections, as inside the switch package pins B and C are
connected together, as are A and D.
Principle
Button switch and number 13 port have the built-in LED simple circuit. To produce a switch
flasher, we can use connect the digital port 13 to the built-in LED and connect the button switch
Sport to number 3 port of Elegoo Uno board .When the switch sensing, LED twinkle light to the
switch signal.
Connection
Schematic
42/193
Http://www.elegoo.com
Wiring diagram
43/193
Http://www.elegoo.com
Result
Connect the circuit as above and upload theprogram. Then push the button, you can see led on and
off.
44/193
Http://www.elegoo.com
Tilt Switchmodule
A built-in 10 K ohm resistor is connected between the center pin and the ‘S’pin
and can be used as a pull up or pull down resistor. The switch contacts connect to
the two outer pins.
Hit SensorModule
Vibration sensor module. The momentary switch contacts are connected between
the two outer pins.
45/193
Http://www.elegoo.com
Component Required:
Principle
Switch and number 13 port have the built-in LED simple circuit. To produce a switch flasher, we can
use connect the digital port 13 to the built-in LED and connect the switch sport to number 3 port of
Elegoo Uno board. When the SWITCH sensing, LED twinkle light to the switch signal.
46/193
Http://www.elegoo.com
Connection
Schematic
47/193
Http://www.elegoo.com
Wiring diagram:
48/193
Http://www.elegoo.com
48/193
Http://www.elegoo.com
Result
Connect the circuit as above and upload the program, you can see led on and off.
49/193
Http://www.elegoo.com
A built-in 10 K Ohm resistor connected between the middle and ‘S’ pin is
available for pull up or pull down use. The switch contacts connect to the two
outer pins .Load switching max: 12V DC 50 mA.
50/193
Http://www.elegoo.com
Component Required:
Principle:
Switch and number 13 port have he built-in LED simple circuit .to produce a switch flasher,
we can use connect the digital port 13 to the built-in LED and connect the switch Sport to
number 3 port of Elegoo Uno board. When the SWITCH sensing, LED twinkle light to the switch
signal.
51/193
Http://www.elegoo.com
Connection
Schematic
52/193
Http://www.elegoo.com
Wiring diagram
53/193
Http://www.elegoo.com
54/193
Http://www.elegoo.com
Result
Connect the circuit as above and upload the program, you can see led on and off.
55/193
Http://www.elegoo.com
In this experiment, we will learn how to use Infrared Receiver and IR transmitter module.
In fact now in our daily life they play an important role, a lot of household electrical appliances
are used to this kind of device, such as air conditioning, TV, DVD, etc. Actually it is based on its
wire less remote sensing and it is very convenient by using them.
IR Receiver module
Infrared sensor type 1838 for use with 38 KHz IR signals.
• Supply voltage: 2.7 to 5.5 V
• Frequency: 37.9 KHz
• Receiver range: 18 m (typical)
• Receiving angle: 90°
IR Transmitter module
56/193
Http://www.elegoo.com
Component Required:
Component Introduction
IR RECEIVER SENSOR:
IR detectors are little microchips with a photocell that are tuned to listen to infrared light. They are
almost always used for remote control detection - every TV and DVD player has one of these in the
front to listen for the IR signal from the clicker. Inside the remote control is a matching IR LED, which emits IR
pulses to tell the TV to turn on, off or change channels. IR light is not visible to the human eye, which means
it takes a little more work to test a setup.
There are a few difference between these and say a CdS Photocells:
IR detectors are specially filtered for Infrared light, they are not good at detecting visible light. On the
other hand, photocells are good at detecting yellow/green visible light, not good at IR light
IR detectors have a demodulator inside that looks for modulated IR at 38 KHz. Just shining an IR
LED won't be detected, it has to be PWM blinking at 38 KHz. Photocells do not have any sort of
demodulator and can detect any frequency (including DC) within the response speed of the
photocell (which is about 1 KHz)
IR detectors are digital out - either they detect 38 KHz IR signal and output low (0 V) or they do
not detect any and output high (5V). Photocells act like resistors, the resistance changes
depending on how muchlight they are exposed to.
58/193
Http://www.elegoo.com
As you can see from these data sheet graphs, the peak frequency detection is at 38 KHz and
the peak LEDcolor is 940 nm .You can use from about 35 KHz to 41 KHz but the sensitivity will
drop off so that it wont detect as well from a far. Like wise, you can use 850 to 1100 nm LEDs
but they won’t work as well as 900 to 1000 nm so make sure to get matching LEDs! Check the
datasheet for your IR LED to verify the wavelength try to get a 940 nm - remember that 940 nm is not
visible light (its Infra Red)!
59/193
Http://www.elegoo.com
Principle
Firstly, let's know the structure of the infrared receiving head: there are two important elements
inside the infrared receiving head, IC and PD. IC is receiving head processing components, mainly
composed of silicon and circuit. It is a highly integrated device. The main function is filter, plastic,
decoding, amplification, etc. PD is a photosensitive diode. The main function is to receive the light signal.
Infrared emitting diode launch out the modulation signal and infrared receiver head will receive,
decode, filter and soon to regain the signal.
Infrared emitting diode: keep clean and in good condition. All the parameters in the process of working
shall not exceed the limit value (positive To the current 30~60 mA, positive pulse current 0.3~1 A,
reverse voltage 5V, dissipation power 90 mW, working temperature range -25~+80℃, and storage
temperature range between 40~100℃, the welding temperature 260℃) infrared to be with a closed
head should be matching use, other wise it will influence the sensitivity.
60/193
Http://www.elegoo.com
Connection
Firstly, take a UNO board and connect the Infrared Emission module according to the attached picture.
Then follow the previous procedure to write the Infrared Emission program.
Next, take another UNO board, connect the Infrared Receiver module as shown below and write IR
Receiver program.
Note: Before downloading, be sure to reselect the download port. There will be two serial ports
When you connect two UNO boards, we must choose the new one, as the picture shown.
60/193
Http://www.elegoo.com
After wrote successfully, align the infrared emission module with the infrared receiver module. Observe the
UNO of the Infrared receiver, if you can see the L light flashes, it says the experiment is successful. The
principle of the experiment is that the infrared emission module transmits the specific coded signal .After
the infrared receiver module received, the UNO will decode and operates the L lamp to blink. This
experiment can be extended use: The IR signal control UNO to operate other modules such as robot, toys,
appliances and etc.
Schematic
61/193
Http://www.elegoo.com
Wiring diagram
62/193
Http://www.elegoo.com
63/193
Http://www.elegoo.com
64/193
Http://www.elegoo.com
Result:
65/193
Http://www.elegoo.com
Troubleshooting:
If the L lamp didn't flash, it may be the error of connection or the wrong operation when you wrotethe
program .Please refer to the previous steps and modify the mistakes.
But if you are sure the connection and program are correct. There are two ways to help you determine
whether the IR receiver module and the IR emission module are damaged.
The receiver module.
Please use your TV remote control to control the IR receiver module. If the IR receiver module flashes, it
shows the IR receiver module is normal. If not, it couldn't be used.
The emission module.
Open your Android phone's camera, put in front of the IR emission's LED. If you could see thepurple light,
it shows this module is correct, or else it's wrong.
If the modules came across defective, please contact us and we will send the replacement to yourplace.
66/193
Http://www.elegoo.com
Overview
With the Arduino we can complete a lot of interactive work, commonly what we used is the light shows.
And we has been use the LED small lights in the experiment before. In this experiment we will
make the circuit having noise. The common components that can make sound are buzzer and
speakers. Compared to the speaker, buzzer is more simple and easy to use so in this experiment we
adopts the buzzer.
Tip to avoid mix up: The buzzer housing is slightly taller than the loudspeaker housing and has a label
showing the + pinidentification.
Component Required:
67/193
Http://www.elegoo.com
Component Introduction
Active Buzzer:
As a type of electronic buzzer with integrated structure, buzzers, which are supplied by DC power, are
widely used in computers, printers, photocopiers, alarms, electronic toys, automotive electronic
devices, telephones, timers and other electronic products for voice devices.
Turn the pins of two buzzers face up, and the one with a green circuit board is a passive buzzer,
while the other enclosed with a black tape is an active one.
An active buzzer has a built-in oscillating source, so it will make sounds when electrified. But a passive
buzzer does not have such source, so it will not tweet if DC signals are used; instead, you need to
use square waves whose frequency is between 2K and 5K to drive it. The active buzzer is often more
expensive than the passive one because of multiple built-in oscillating circuits.
68/193
Http://www.elegoo.com
Connection
Schematic
69/193
Http://www.elegoo.com
Wiring diagram
70/193
Http://www.elegoo.com
Result
After we connect the circuit as the picture, we upload the program of each module. We can hear
that the active buzzer can make sound in one voice. And the passive can sing a song.
71/193
Http://www.elegoo.com
Passive Buzzer
Mini loudspeaker module ca. 16 Ohm Impedance, (maximum continuous current
through the speaker coil is approximately 25 mA.) Don’t mix this one up with the
buzzer module! The outer two pins connect to the speaker. Polarity is unimportant.
Tip to avoid mix up: The loudspeaker housing is not as tall as the buzzer housing.
Component Required:
72/193
Http://www.elegoo.com
Component Introduction
Passive Buzzer:
Passive buzzer, in fact, just use PWM generating audio, drives the buzzer, all owing the air to
vibrate, can sound. Appropriately changed as long as the vibration frequency, it can generate
different sound scale. For example, sending apulsewave can be generated 523 Hz Al to Do, pulse
587 Hz can produce midrange Re, 659 Hz can produce midrange Mi. If you then with a
different beat, you can playa song. Here be careful not to use the
Arduino analog Write () function to generate a pulse wave, because the frequency analog Write ()
is fixed (500Hz), no way to scale the output of different sounds.
Now a small buzzer on the market because of its small size (diameter of only ll mm), light
weight, low price, solid structure, and is widely used in a variety of needs audible electrical
From the exterior, two kinds of buzzer seems the same, but acloser look, a slight difference
between the height of the active buzzer a, height of 9 mm, and passive buzzer b height of 8
mm. When the buzzer as the two pins are facing up, you can see there is a green circuit
board is passive buzzer, no closed circuit boards with a vinyl is active buzzer.
Further determine the active and passive buzzer, you can also use a multimeter to test the
resistance profile Rxl file: buzzer with black pen then "+" pin, the red pen to touch on another
pin back and forth, if trigger a cracking, cracking sound and the resistance only 8Ω (or 16Ω)
is passive buzzer; If you can emit continuous sound, and the resistance in Europe and more
than a few hundred, and is an active buzzer.
Active buzzer directly connected to the rated power (new buzzer has stated on the label)
can be a continuous sound; rather passive electromagnetic buzzer and speaker are the
same, you need to take in order to sound the audio output circuit.
Connection
Schematic
73/193
Http://www.elegoo.com
Wiring diagram
74/193
Http://www.elegoo.com
Result
After we connect the circuit as the picture, we upload the program of each module. We
can hear that the active buzzer can make sound in one voice. And the passive can sing a
song.
75/193
Http://www.elegoo.com
76/193
Http://www.elegoo.com
Laser emitter
Red Laser module for direct connection to a 5 V supply. Connect the 5 V supply to
the ‘S’ pin and ground to the ‘-’ pin. Transmission wavelength: 650 nm
Component Required:
Component Introduction
Laser sensor:
77/193
Http://www.elegoo.com
78/193
Http://www.elegoo.com
Connection
Schematic
79/193
Http://www.elegoo.com
Wiring diagram
80/193
Http://www.elegoo.com
Result
After we connect the circuit as the picture, we upload the program. We can see the module can
emission lasers.
81/193
Http://www.elegoo.com
In this experiment, we will learn how to use SMD RGB LED module and RGB LED module.
Actually, the function of SMD RGB LED module and RGB LED module are almost the same. But we
can choose the shape we like or we need.
SMD RGB LED module and RGB module are made from a patch of full-color LED. By adjusting the
voltage input of R, G, B pins, we can adjust the strength of the three primary colors (red/blue/green) so
as to implementation result of full color effect.
82/193
Http://www.elegoo.com
Component Required:
Component Introduction
RGB LED:
83/193
Http://www.elegoo.com
Connection
Schematic
84/193
Http://www.elegoo.com
Wiring diagram
85/193
Http://www.elegoo.com
86/193
Http://www.elegoo.com
Result
After we connect the circuit as the picture, we upload the program of each module. We can see the
module changing their color as the code set. If you want to make it change the color in different way,
you can revise the code.
87/193
Http://www.elegoo.com
88/193
Http://www.elegoo.com
Light blocking
Slotted light barrier. The middle pin connects to + 5 V supply and the pin marked‘-’
connects to ground. The output signal (with a 10 K ohm pull up to +5 V) is available
on the pin on the right.
Component Required:
Component Introduction
89/193
Http://www.elegoo.com
Opto Interrupters are commonly used in many arcade games e.g. steering assembly in
Older driving games, scoring switches in Whack a Crock etc. Uninterrupted light beam will turn the
phototransistor "ON" connecting the ground to the game board input. When the light beam is
interrupted the phototransistor turns "OFF", the ground is disconnected from the input and the pull-
up resistor R1 forces the input to go "HIGH"(5V level).
Principle
90/193
Http://www.elegoo.com
Photo-interrupter module and number 13 port have the built-in LED simple circuit. To produce a
switch flasher, we can use connect the digital port 13 to the built-in LED and connect the Photo-
interrupter MODULE S port to number 3 port of Elegoo Uno board. When the switch sensing, LED
twinkle light to the switch signal.
Connection
Schematic
91/193
Http://www.elegoo.com
Wiring diagram
92/193
Http://www.elegoo.com
Result
After we connect the circuit as the picture, we upload the program, we sensing the opto Interrupter,
the new can see the LED 13 light up and light off.
93/193
Http://www.elegoo.com
94/193
Http://www.elegoo.com
The 3mm bi-color LED has a common cathode (- pin), connected with the ‘-’ pin on
the PCB. The center pin activates the red light and the ‘S’ pin the green light .No
series resistor is included in the circuit. A suitable value for low voltage operation
would be 220 ohms.
Component Required:
Component Introduction
96/193
Http://www.elegoo.com
Connection
Schematic
Wiring diagram
97/193
Http://www.elegoo.com
98/193
Http://www.elegoo.com
Result
After we connect the circuit as the picture, we upload the program of each module. We
can see the module changing their color as the code set. If you want to make it change the
color in different way, you can revise the code.
99/193
Http://www.elegoo.com
100/193
Http://www.elegoo.com
In this experiment, we will learn how to use the Light Dependent Resistor Module.
Light Dependent Resistor Module is very common in our daily life. It is mainly used
in intelligent switch so as to bring convenience to our life. At the same time, in our daily
life, we also use it in electronic design. So in order to use it in a better, we provide
the corresponding modules to help us to use it moreconveniently andefficiently.
Component Required:
101/193
Http://www.elegoo.com
Component Introduction
PHOTOCELL:
The photocell used is of a type called a light dependent resistor, sometimes called an LDR. As the name
suggests, these components act just like a resistor, except that the resistance changes in response to
how much light is falling on them.
This one has a resistance of about 50 kΩ in near darkness and 500 Ω in bright light. To convert this
varying value of resistance into something we can measure on an Arduino's analog input, it need to
be converted into a voltage.
The resistor and photocell together behave rather like a pot. When the light is very bright, then the
resistance of the photocell is very low compared with the fixed value resistor, and so it is as if the pot
were turned to maximum.
Whenthephotocellisindulllighttheresistancebecomesgreaterthanthefixed1kΩresistor and it is as if
the pot were being turned to wards GND.
Load up the sketch given in the next section and try covering the photo cell with your finger, and
holding it near alight source.
102/193
Http://www.elegoo.com
Connection
Schematic
Wiring diagram
103/193
Http://www.elegoo.com
Result
104/193
Http://www.elegoo.com
Uploadthe programthen open the monitor, we can see the data as below:
105/193
Http://www.elegoo.com
In the test, we only read the output analog voltage value of photo-resistor module. In the test results,
we will find that when there is lighting, high voltage out put equivalently of switch on, when there is
no light, low voltage equivalently of switch off. This is what we can use this in practice.
106/193
Lesson 15 Large Microphone Module and
Small Microphone module
Overview
In this experiment, we will learn how to use the High-sensitive Voice Sensor.
107/193
Component Required:
Component Introduction
Sound sensor:
The sound sensor module provides an easy way to detect sound and is generally used for detecting
sound intensity. This module can be used for security, switch, and monitoring applications. Its
accuracy can be easily adjusted for the convenience of usage.
It uses a microphone which supplies the input to an amplifier, peak detector and buffer. When the
sensor detects a sound, it processes an output signal voltage which is sent to a microcontroller then
performs necessary processing.
108/193
Connection
Schematic
109/193
Wiring diagram
110/193
Result
111/193
LED1 should be lit, showing power. LED2 indicates sound input, and the sensitivity is adjusted by potentiometer.
There is a tiny screw on the blue potentiometer block that you can use for adjustment.
Turning that clockwise lowers the potentiometer value, while counter-clockwise raises the potentiometer value.
112/193
Open Serial Plotter:
113/193
Lesson 16 Reed Switch Module and MiniReed
Switch Module
Overview
In this experiment, we will learn how to use reed switch and minireed switch
module.
114/193
Component Required:
Component Introduction
Although a reed switch can be activated by placing it inside an electrical coil, many reed switches and
reedsensorsareusedforproximitysensingandareactivatedbyamagnet.As the magnet is brought in to
the proximity of the reed sensor/switch, the device deactivates. The magnet is removed from the
proximity of the reed sensor/switch, the device deactivates. However, the magnetic interaction
involved in activating the reed switch contacts is not necessarily obvious. One way of thinking about
the interaction is that the magnet induces magnetic poles in to the metal parts of the reed switch
and the resulting attraction between theelectrical contacts causes the reed switch to activate.
Another equally valid way of thinking about the interaction between a magnet and a reed switch is
that the magnet induces magnetic flux through the electrical contacts. When the magnetic flux is high
enough, the magnetic attraction between the contacts causes the reed switch to close.
115/193
The following are examples of typical reed switch and reed sensor activate distances.
Difference between the reed switch module and mini reed switch module
As we can see, the reed switch module is bigger than the mini reed switch module. So the bigger one may
have more function than the mini one. The reed switch can output in two ways: digital and analog. The
mini reed can only out put in digital.
In the 37 sensor kit, there have 7 red pcb modules. The difference between the red and small pcb is
same as above.
Principle
116/193
As can be seen, the magnetic orientation and location relative to the reed switch play important
role sin the activation distances. In addition, the size of the activate regions (lobes) will vary
depending on the strength of the magnet and the sensitivity of the reed switch. Proper orientation of
the magnet with respect to the reed sensor/switch is an important consideration in meeting the
application’s requirements across the tolerance range for mechanical systems, magnetic strength and
reed sensor or reed switch sensitivity.
117/193
Connection of mini reed switch module
Schematic
Wiring diagram
118/193
Result
119/193
Upload the program, When the module access to magnetic, you can see the led on or off. Mini switch
module and number 13 port have the built-in LED simple circuit. To produce a switch flasher, we can
use connect the digital port 13 to the built-in LED and connect the switch module S port to number 3
port of Elegoo Uno board. When the switch sensing, LED twinkle light to the switch signal.
120/193
Wiring diagram
121/193
Result
122/193
In this experiment, we use the AO pin of reed switch module. When the sensor sensing magnetism,
the module will out put a data which reflect the strength of the magnetism. The number is from 0 to
1023.
Uploadthe programthen open the monitor, we can see the data as below:
123/193
Lesson 17 Digital Temperature Sensor Module
Overview
In this experiment, we will learn how to use digital temperature module and analog temp module.
Digital Temp
Temperature sensing module using an NTC thermistor. The out put signal
at ‘DO’ switches high when the preset (adjustable) temperature is
reached. An analog output signal from the sensor is available at pin ‘AO’.
Analog Temp
NTC Temperature sensor module. The sensor resistance is approximately 10 kohm
at room temperature. The NTC sensor is connected between the two outer pins .A
fixed 10 K ohm resistor connected between the middle pin and the ‘S’ pin is
included on the module. This simplifies the building of a measurement bridge circuit.
124/193
Component Required:
Component Introduction
Thermistor:
These thermistors have a narrow tolerance on the B-value, the result of which provides a very small
tolerance on the nominal resistance value over a wide temperature range. For this reason the usual
graphs of R = f(T) are replaced by Resistance Values at Intermediate Temperatures Tables, together
with a formula to calculate the characteristics with a high precision.
125/193
Connection of digital temperature module
Wiring diagram
126/193
Result
127/193
Uploadthe program, open the monitor then you can seethe data as below:
128/193
Connection of temperature module
Schematic
Wiring diagram
129/193
Result
130/193
Upload the program then open the monitor, we can see the data as below:
131/193
Lesson 18 Linear Hall and analog Hall Module
Overview
In this experiment, we will learn how to use the linear hall and analog hall module.
132/193
Class Hall Magnetic Sensor
The Hall-Sensor-Switch (bipolar) module features a 44E311, 3144EUA-Sor
3144LUA-S sensor together with an LED and resistor. The LED switches on when
a magnetic field is detected. The ground pin is marked ‘-’, center pin is +5 V
supply (Vs) and the output signal is on the ‘S’pin.
Component Required:
Component Introduction
Hall Sensor:
133/193
134/193
Design Factors–Magnetic TypesUnipolar: Only as out pole will operate the
sensor. The sensor turns on with thes out pole (+) and off when the
Activate the sensor; a north pole (-) is designed to deactivate. It’s possible that the sensor could turn
135/193
Connection
Schematic
Wiring diagram
136/193
137/193
Result
For the hall sensor module, we can choose the output: digital output or analog output. In the
following picture, we use the DO port to output. So we can see that if the hall sensor sensing the
magnetic force, the light will turn on.
138/193
139/193
Connection
Wiring diagram
140/193
Result
In this example, If no magnetic field is present, the signal line of the sensor is HIGH (3.5 V). If a
magnetic field is presented to the sensor, the signal line goes LOW, at the same time the LED on the
sensor lights up.
The connection as below:
141/193
Lesson 19 Flame Sensor Module
Overview
In this experiment, we will learn how to use the flame sensor module.
This module is sensitive to the flame and radiation. It can detect infrared light source in the
range of a wavelength 760 nm-1100 nm. The detection distance is up to 100 cm. The Flame sensor
can output digital or analog signal. It can be used as a flame alarm or in fire fighting robots.
Flame
A sensor module to detect flames. The spectral sensitivity of the sensor
is optimized to detect emissions from naked flames. The output signal
‘DO’ is pulled high (active high) when a flame is detected. The switching
threshold is adjustable via a preset pot. An analog output signal from
the sensor is available at pin‘AO’.
• Typical spectral sensitivity: 720-1100 nm
• Typical detection angle: 60°
Component Required:
142/193
Component Introduction
Flame sensor:
•Detectsaflameoralightsourceofawavelengthintherangeof760nm-1100nm
• Detection distance: 20 cm (4.8V) ~ 100 cm (1V)
• Detectionangle about 60 degrees, it is sensitive to the flame spectrum.
• Comparator chip LM393 makes module readings stable.
• Adjustable detection range.
• Operating voltage 3.3V-5V
• Digital and Analog Output
analog voltage output
Connection
Schematic
143/193
Wiring diagram
144/193
Result
For the flame sensor module, we can choose the output: digital output or analog output. In the
following picture, we use the DO port to output. so we can see that if the flame sensor sensing
the flame, the light will turn on.
In the following picture, we use the AO port to output. so we can see that if the flame sensor sensing
the flame,themodulewilloutputadatawhichreflectthestrengthoftheflame.The number is from 0 to
1023.
145/193
Uploadthe programthen open the monitor, we can see the data as below:
146/193
Lesson 20 Touch Sensor Module
Overview
In this experiment, we will learn how to use the mental touch module.
Touch
Touch sensitive switch. Touching the sensor pin produces an output at the ‘DO’ pin. The output is
not a clean signal but includes 50 Hz mains induced signals (‘mains hum’). The output signal is
‘active high’ and the circuit sensitivity can be adjusted with a pot. An analog output signal from the
sensor is available at pin ‘AO’.
Component Required:
Connection
Schematic
147/193
Wiring diagram
148/193
Result
For the mental touch module, we can choose the output: digital output or analog output. In
the following picture, we use the DO port to output. so we can see that if the sensor sensing,
the light will turn on.
149/193
In the following picture, we use the AO port to output. so we can see that if the sensor sensing ,the
module will output data. The number is from 0 to 1023.
150/193
Uploadthe programthen open the monitor, we can see the data as below:
151/193
Lesson 21 Seven-Color Flash Module
Overview
In this experiment, we will learn how to use the Seven-Color flash Module
Seven-Color flash Module
Clear 5 mm LED for direct operation from 5V. The LED color automatically
Cycles through a seven-color sequence. The 5 V supply connects to the ‘S’pin
and ground on the centerpin.
Component Required:
Component Introduction
7 color flashing LED module automatically uses 5mm round high-brightness light-emitting diode which
has the following characteristics:
152/193
LED 5 mm DIP type
Color: pink yellowgreen (high brightness) Lens type: white
mist
Connection
Schematic
Wiring diagram
153/193
154/193
Result
155/193
Lesson 22 Switch Light Module
Overview
In this experiment, we will learn how to use the switch light module.
Component Required:
156/193
Component Introduction
Magic light cup module is a product which can easily interact with the ARDUINO module, the
principle is to use the PWM dimming, change the brightness of the two modules. Mercury switch
provides digital signal, trigger PWM adjustment. Through the design program, we can see the result
which is similar to the effect of two cup full of light pouring to each other.
Connection
Schematic
Wiring diagram
157/193
Result
158/193
159/193
Lesson 23 Joystick Module
Overview
Just like a joystick on game console. you can control x, y and z dimensions input by this joystick
module. It can be considered as combination of potentiometers and one button. Data type of the x,
y dimensions are analog input signals and z dimension is digital input signal. Thus the x and y ports
connect to analog pins of Sensor Shield, while z port connects to digital pin.
Joystick
An analog 2-axis joystick with 2x 10K ohm pots and push button function.
Connector pin descriptions are printed on the PCB. A push-on operating
knob is included with themodule.
Component Required:
(1)xJoystick module
160/193
Component Introduction
Joystick sensor:
Lots of robot projects need joystick. This module provides an affordable solution. By simply
connecting to two analog inputs, the robot is at your commands with X, Y control. It also has
a switch that is connected to a digital pin. This joystick module can be easily connected to
Arduino by IO Shield. This module is for Arduino (V5) with cables supplied.
Specification
Supply Voltage: 3.3V to 5V Interface:
Weight:12g
The module has 5 pins: Vcc, Ground, X, Y, Key. Note that the labels on yours may be slightly different,
depending on where you got the module from. The thumb stick is analog and should provide more
accurate readings than simple ‘directional’ joysticks tact use some forms of buttons, or mechanical
switches. Additionally, you can press the joystick down (rather hard on mine) to activate a ‘press to
select’ push-button.
We have to use analog Arduino pins to read the data from the X/Y pins, and a digital pin to read the
button. The Key pin is connected to ground, when the joystick is pressed down, and is floating
otherwise. To get stable readings from the Key /Select pin, it needs to be connected to Vcc via a
pull-up resistor. The built in resistors on the Arduino digital pins can be used. For a tutorial on how to
activate the pull-up resistors for Arduino pins, configured as inputs
161/193
Connection
Schematic
162/193
Wiring diagram
163/193
Result
Analog joysticks are basically potentiometers so they return analog values.
When the joystick is in the resting position or middle, it should return a value of about 512. The range of values go
from 0 to 1024.
164/193
165/193
Lesson 24 Line Tracking Module
Overview
In this experiment, we will learn how to use the tracking module and avoidance module.
Infrared obstacle avoidance sensor is designed for the design of a wheeled robot obstacle avoidance
sensor distance adjustable. This ambient light sensor Adaptable, high precision, having a pair of
infrared transmitter and receiver, transmitter tubes emit a certain frequency of infrared, When
detecting the direction of an obstacle (reflector), the infrared receiver tube receiver is reflected back,
when the indicator is lit, Through the circuit, the signal output interface output digital signal that
can be detected by means of potentiometer knob to adjust the distance, the effective distance
From 2 ~ 40 cm, working voltage of 3.3V-5V, operating voltage range as broad, relatively large
fluctuations in the power supply voltage of the situation Stable condition and still work for a
variety of microcontrollers, Arduino controller, BS2 controller, attached to the robot that can sense
changes in the ir surroundings
Tracking
IR light reflection switch, useful for obstacle avoidance or line following
on models that move around the floor. An obstacle in front of the
sender/receiver diodes will cause the ‘out’ pin to be pulled low (active
low). A pot allows adjustment of the circuit’s sensitivity. The detection
distance can be up to approximately 1 cm.
166/193
Component Required:
Connection
Schematic
167/193
Wiring diagram
Result
168/193
169/193
Lesson 25 Obstacle Avoidance Sensor Module
Overview
Non logic chip oscillation frequency regulation 38 KHz detection circuit. This infrared 38 KHZ
obstacle avoidance module can completely block the traditional photoelectric obstacle detection
distance and a single normally open or normally closed signal out put function.
Avoid
IR-reflection sensor, useful for obstacle avoidance applications. When
an obstacle is in front of the IR sender/receiver the ‘Out’ pin is switched
low (active low). The circuit sensitivity can be adjusted with a pot. The
obstacle detection distance can be adjusted up to approximately 7 cm.
An enable (EN) jumper can be fitted for continuous operation. Removal
of the EN jumper allows an external logic signal (at the EN pin) to
switch the detector on and off (low = active, high = off).
Component Required:
170/193
Component Introduction
Obstacle avoidancemodule:
Specifications
Output signal: TTL level (low level there is an obstacle, no obstacle high)
Size: 9 g
The basic concept of IR (infrared) obstacle detection is to transmit the IR signal (radiation) in a
direction and a signal is received at the IR receiver when the IR radiation bounces back from a
surface of the object.
171/193
172/193
There are two potentiometers on the module one controlling operating frequency (centered at 38
kHz) the other controlling intensity. The detector was designed for 38 kHz and the onboard oscillator
circuit is based on a 555 timer. Tweaking gives a little better range but I'd suggest leaving it alone
because the useful range is narrow.
Infrared obstacle avoidance sensor is designed for the design of a wheeled robot obstacle avoidance
sensor distance adjustable. This ambient light sensor Adaptable, high precision, having a pair of infrared
transmitter and receiver, transmitter tubes emit a certain frequency of infrared, When detecting the
direction of an obstacle (reflector), the infrared receiver tube receiver is reflected back, when the
indicator is lit, Through the circuit, the signal output interface output digital signal that can be detected
by means of potentiometer knob to adjust the distance, the effective distance From 2 ~ 40 cm,
working voltage of 3.3V-5V, operating oltage range as broad, relatively large fluctuations in the power
supply voltage of the situation Stable condition and still work for a variety of microcontrollers,
Arduino controller, BS2 controller, attached to the robot that Can sense changes in their
surroundings.
173/193
Connection
Schematic
174/193
Wiring diagram
Result
175/193
Here we use the obstacle avoidance module and a digital interface, built-in 13 LED build a simple
circuit, making avoidance warning lamp, the obstacle avoidance Sensor Access Digital 3 interface,
when obstacle avoidance sensor senses a signal, LED light, and vice versa off.
176/193
Lesson 26 Rotary Encode Module
Overview
Component Required:
Component Introduction
Rotary Encoders:
177/193
Principle
Incremental encoder
Incremental encoders give two-phase square wave, the phase difference between them 90 °,
often referred to as A and B channels. One of the channels is given and speed-related
Information, at the same time, by sequentially comparing two channel signals, the direction of
rotation of the information obtained. There is also a special signal called Z or Zero channel, which gives
the absolute zero position encoder, the signal is a square wave with the center line of channel a
square wave coincide.
Clockwise counterclockwise
178/193
Incremental encoder accuracy depends on the mechanical and electrical two factors, these
factors are: Raster indexing error, disc eccentricity, bearing eccentricity, e-reading Several means into
the optical portion of the errors and inaccuracies. Determine the encoder resolution is measured in
electrical degrees, the encoder accuracy depends Set the pulse encoder generates indexing. The
following electrical degrees with a 360 ° rotation of the shaft to said machine, and rotation of the shaft
must be a full week of Period. To know how much electrical equivalent of the mechanical angle
of 360 degrees can be calculated with the following formula: Electrical 360 = Machine 360 ° / n °
pulses / revolution encoder indexing error is the electrical angle of the unit two successive pulse
maximum offset to represent. Error exists in any encoder, which is caused by the aforementioned
factors. Eltra encoder maximum error is ± 25 electrical degrees (declared in any condition),
equivalent to the rated Offset values ± 7%, as the phase difference 90 ° (electrical) of the two
channels of the maximum deviation ± 35 electrical degrees is equal to ±10% deviation left ratings
Right.
Connection
Schematic
179/193
Wiring diagram
180/193
Result
181/193
Upload the program, rotate the encodes, and then open the monitor, and we can see the data
as below:
182/193
Lesson 27 Relay Module
Overview
Relay is a kind of component when the change of the input variables (incentive) to specified
requirements, the output electric circuits of the charged amount occurs due to the step change of a
kind of electrical appliances. This company produces the relay module can meet in 28 v to 240 v ac or
dc power to control all kinds of other electric parts. MCU can be used to achieve the goal of timing
control switch. Can be applied to guard against theft and alarm, toys, construction and other fields.
Relay is an electrical control device. It has a control system (also called input circuit) and control
system (also called the output circuit), the interaction between. Usually used in automatic control
circuit, it is actuallywithasmallcurrenttocontrollargecurrentoperationofakindof"automatics.
Relay
A relay module suitable for direct connection to an Arduino board. The
module requires 5 V power supply. The input control signal is identified
with an ‘S’. The relay has one change-over contact. It is capable of
switching resistive loads up to 10 A at 250 V AC and up to 10 A at 30 V
maximum.
Don’t forget to provide interference suppression for the switched load!
183/193
Component Required:
Component Introduction
Relay:
A relay is an electrically operated switch. Many relays use an electromagnet to m e c h a n i c a l l y
operate a switch, but other operating principles are also used, such as solid-state relays. Relays are
used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation
between control and controlled circuits), or where several circuits must be controlled by one signal. The
first relays were used in long-distance telegraph circuits as amplifiers: they repeated the signal
coming in from one circuit and re-transmitted it on another circuit. Relays were used extensively in
telephone exchanges and early computers to perform logical operations.
A type of relay that can handle the high power required to directly control an electric motor or other
loads is called a contactor. Solid-state relays control power circuits with no moving parts, instead using
a semiconductor device to perform switching. Relays with calibrated operating characteristics and
sometimes multiple operating coils are used to protect electrical circuits from over load or faults;
in modern electric power systems these functions are performed by digital instruments still called
"protectiverelays".
Bellow is the schematic of how to drive relay with Arduino (download from the Arduino .cc)
184/193
Connection
Schematic
185/193
Wiring diagram
186/193
187/193
Result
188/193
Lesson 28 Heartbeat Sensor Module
Overview
This project uses bright infrared (IR) LED and a phototransistor to detect the pulse of the finger, are
LED flashes with each pulse. Pulse monitor works as follows: The LED is the light side of the finger, and
photo transistor on the other side of the finger, phototransistor used to obtain the flux emitted,
when the blood pressure pulse by the finger when the resistance of the photo transistor will be slightly
changed. The project's schematic circuit as shown, we chose a very high resistance resistor R1,
because most of the light through the finger is absorbed, it is desirable that the photo transistor is
sensitive enough. Resistance can be selected by experiment to get the best results. The most
important is to keep the shield stray light into the phototransistor. For home lighting that is
particularly important because the lights at home mostly based 50 HZ or 60 HZ fluctuate, so far the
heartbeat will add considerable noise.
When running the program the measured values are printed. To get a real heartbeat from this could be
challenging.
Tilt Switch
Mercury tilt switch which makes or breaks depending on its attitude.
189/193
Component Required:
(1)xElegoo Uno R3
Connection
Schematic
190/193
Wiring diagram
191/193
Result
Uploadthe program then open the monitor, we can see the data as below:
192/193
193/193