37 Sensor Kit Tutorial For Uno
37 Sensor Kit Tutorial For Uno
cc
1 / 137
Http://www.elego.cc
Preface
Our Company
Established in 2011, Elego Inc. is a professional manufacturer and exporter that is concerned
with the design, development production and marketing of arduino, 3d printers, raspberry pi
and STM32. We are located in Shenzhen which is known as Chinese Silicon Valley. All of our
products comply with international quality standards and are greatly appreciated in a
variety of different markets throughout the world.
Our Tutorial
The tutorial is for beginners. In the tutorial, you can learn how to use arduino controller board,
sensors and components. You can also learn the basic knowledge of all the parts. But if you
want to study arduino systematically, we recommend you to buy the book "Arduino
Cookbook" which is written by Michael Margolis.
Our after-sales
If you have any question or suggestion about our company, product or tutorial. Please send
us a email. Our email address is [email protected].
We will very appreciate and improve ourselves so that we can offer you a better service.
2 / 137
Http://www.elego.cc
Packing List
3 / 137
Http://www.elego.cc
4 / 137
Http://www.elego.cc
Lesson Listing
Lesson 0 Installing IDE ......................................................................................................................................... 6
Lesson 13 BIG SOUND SENSOR MODULE AND SMALL SOUND SENSOR MODULE ............................................ 73
5 / 137
Http://www.elego.cc
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. There is no installer program,
but rather you have to unzip a folder which gives you an Arduino folder that contains the
Arduino program and a few other items.
In a separate step, you must then install USB drivers, which is the only bit that is a bit fiddly.
Get started by visiting the Arduino.cc website. As of April 2014 we suggest v1.05 as 1.5 is still
in beta. If 1.5 is no longer in beta when you read this you can try it out!
Start by downloading the zip file for Windows. There is only one version of the software,
whether you are using Windows XP through to Windows 7.
6 / 137
Http://www.elego.cc
When the zip file has downloaded, extract the contents onto the Desktop, by right-clicking
on the file and selecting 'Extract All...' from the pop-up menu.
Next select your Desktop and click 'Extract'. You can move it somewhere else onto your
computer later, just by moving the folder, but for now, just keep it on the Desktop.
The Arduino folder contains both the Arduino program itself and also the drivers that allow
the Arduino to be connected to your computer by a USB cable. Before we launch the
Arduino software, you are going to install the USB drivers.
Plug one end of your USB cable into the Arduino and the other into a USB socket on your
computer. The power light on the LED will light up and you may get a 'Found New Hardware'
message from Windows. Ignore this message and cancel any attempts that Windows makes
to try and install drivers automatically for you.
The most reliable method of installing the USB drivers is to use the Device Manager. This is
accessed in different ways depending on your version of Windows. In Windows 7, you first
have to open the Control Panel, then select the option to view Icons, and you should find
the Device Manager in the list.
Under the section ‘Other Devices’ you should see an icon for ‘unknown device’ with a little
yellow warning triangle next to it. This is your Arduino.
7 / 137
Http://www.elego.cc
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 driver software’ or
‘Browse my computer for driver software’. Select the option to browse and navigate to the
arduino-1.0.2-windows\arduino1.0.2\drivers.
8 / 137
Http://www.elego.cc
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.
That's it, you are now ready for action, so Skip the next section on installation on Mac and
Linux and move straight on to 'Boards and Ports'.
Get started by visiting the Arduino.cc website and downloading the matching IDE for your
operating system. As of April 2014 we suggest v1.05 as 1.5 is still in beta. If 1.5 is no longer in
beta when you read this you can try it out!
9 / 137
Http://www.elego.cc
The process for installing the Arduino software on the Mac is a lot easier than on the PC. As
before, the first step is to download the file. In the case of the Mac, it is a zip file.
Once downloaded, double-click on the zip file, which will extract a single file called
‘Arduino.app’. This is the whole Arduino application, just drag it into your Applications
Folder.
10 / 137
Http://www.elego.cc
You can now find and launch the Arduino software in your Applications folder. As you are
going to use it frequently, you may wish to right-click its icon in the dock and set it to Keep In
Dock.
There are many different LINUX distributions and the instructions for each distribution are a
little different. The Arduino community has done a great job of putting together sets of
instructions for each distribution. So follow the link below and select one of the ten or more
distributions on offer.
You are now ready to start the Arduino Software, so whatever platform you are using, open
the Arduino folder and open the Arduino application contained within it.
11 / 137
Http://www.elego.cc
This will start the Arduino IDE, but before you can get programming, you have to tell the
Arduino software which type of Arduino board you are using and also select the port it is
connecting to.
To tell the Arduino IDE which type of board you are using. From the 'Tools' menu, select
Board and then 'Arduino Uno' or 'Leonardo' as appropriate.
Also on the 'Tools' menu, you will find the 'Serial Port' option. Select this option.
12 / 137
Http://www.elego.cc
If you are using Windows, there will probably only be one option here and it will either say
COM3 or COM4. Even though there is only one option, you will still need to select it.
If you are using a Mac or Linux, there will be more options there, but it will usually be the top
option in the list, as this will be the device most recently plugged in. This is useful, as the
name of the port may not look like it has anything to do with Arduino. It will probably be
called something like /dev/tty.usbmodemXXXX or /dev/ttyUSBn
13 / 137
Http://www.elego.cc
Libraries are a collection of code that makes it easy for you to connect to a sensor, display,
module, etc. For example, the built-in LiquidCrystal library makes it easy to talk to character
LCD displays. There are hundreds of additional libraries available on the Internet for
download. The built-in libraries and some of these additional libraries are listed in the
reference. To use the additional libraries, you will need to install them.
To install a new library into your Arduino IDE you can use the Library Manager (available
from IDE version 1.6.2). Open the IDE and click to the "Sketch" menu and then Include
Library > Manage Libraries.
14 / 137
Http://www.elego.cc
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.
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 library manager.
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.
15 / 137
Http://www.elego.cc
Libraries are often distributed as a ZIP file or folder. The name of the folder is the name of the
library. Inside the folder will be a .cpp file, a .h file and often a keywords.txt file, examples
folder, and other files required by the library. Starting with version 1.0.5, you can install 3rd
party libraries in the IDE. Do not unzip the downloaded library, leave it as is.
In the Arduino IDE, navigate to Sketch > Include Library. At the top of the drop down list,
select the option to "Add .ZIP Library''.
You will be prompted to select the library you would like to add. Navigate to the .zip file's
location and open it.
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 > Examplesuntil after the IDE has restarted.
Manual installation
To install the library, first quit the Arduino application. Then uncompress the ZIP file containing
the library. For example, if you're installing a library called "ArduinoParty", uncompress
ArduinoParty.zip. It should contain a folder calledArduinoParty, with files like
ArduinoParty.cpp and ArduinoParty.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 "ArduinoParty" and move into it
all the files that were in the ZIP file, like ArduinoParty.cpp and ArduinoParty.h.)
16 / 137
Http://www.elego.cc
Drag the ArduinoParty 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/ArduinoParty/ArduinoParty.h
Documents/Arduino/libraries/ArduinoParty/examples
....
There may be more files than just the .cpp and .h files, just 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 item of the software. That's it! You've installed a library!
Summary
In this lesson, we will install all the libraries which we will use in the tutorial. So in the following
lesson, we don't need to install them anymore. We just connect the component as the
schematic and upload the code provided. Then the kit will work.
17 / 137
Http://www.elego.cc
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:
Component Introduction
18 / 137
Http://www.elego.cc
DHT11 digital temperature and humidity sensor is a composite Sensor contains a calibrated
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 resistive sense of wet components and an NTC temperature measurement
devices, and connected with a high-performance 8-bit microcontroller.
Product parameters
Relative humidity:
Resolution: 16Bit
Repeatability: ±1% RH
1m / s air 6s
Temperature:
Resolution: 16Bit
19 / 137
Http://www.elego.cc
Repeatability: ±0.2℃
Electrical Characteristics
Pin Description:
Typical Application
Connection
Schematic
20 / 137
Http://www.elego.cc
wiring diagram
Result
21 / 137
Http://www.elego.cc
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 21 degree)
22 / 137
Http://www.elego.cc
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. These cause a big challenge. So we are create
the Ds18b20 module.
The new DS18B20 Temperature Sensor Module is very good solve the problem. It have the
characteristicoftheeconomy,unique1-wirebusanditcanfullyapplytheArduinoplatform. Users
can easily forma sensor network through using this module.
Component Required:
23 / 137
Http://www.elego.cc
Component Introduction
DS18B20:
24 / 137
Http://www.elego.cc
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 Measuretemperaturerangefor-55degreeto+125degree
with accuracy of+/-0.5°C.
Each DS18B20 contains a unique serial number so that multiple ds18b20 scan exist in a bus.
Connection
Schematic
25 / 137
Http://www.elego.cc
wiring diagram
Result
26 / 137
Http://www.elego.cc
Temperature sensor can detect temperature in numbers of different places at the same
time.
Upload the program then open the monitor, we can see the data as below:
27 / 137
Http://www.elego.cc
Component Required:
Component Introduction
PUSH SWITCHES:
Switches are really simple components. When you press a button or flip a lever, they
connect two contacts together so that electricity can flow through them.
The little tactile switches that are used in this lesson have four connections, which can be a
little confusing.
28 / 137
Http://www.elego.cc
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 SWITCHS port to number3 port of Elego Uno board. When the switch sensing, LED
twinkle light to the switch signal.
Connection
Schematic
29 / 137
Http://www.elego.cc
wiring diagram
Result
Connect the circuit as above and upload the program. Then push the button, you can see
led on and off.
30 / 137
Http://www.elego.cc
Including shock switch module, mercury switch module, tilt switch module and knock switch
module.
31 / 137
Http://www.elego.cc
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 S port to
number 3 port of Elego Uno board. When the SWITCH sensing, LED twinkle light to the SWITCH
signal.
Connection
Schematic
32 / 137
Http://www.elego.cc
wiring diagram
33 / 137
Http://www.elego.cc
34 / 137
Http://www.elego.cc
Result
35 / 137
Http://www.elego.cc
Connect the circuit as above and upload the program. Then lean or shock the sensor, you
can see led on and off.
36 / 137
Http://www.elego.cc
In this experiment, we will learn how to use Infrared Receiver and IR Emission 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 wireless remote sensing and it is very convenient by using them.
Component Required:
37 / 137
Http://www.elego.cc
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 38KHz. 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 1KHz)
IR detectors are digital out - either they detect 38KHz IR signal and output low (0V) or
they do not detect any and output high (5V). Photocells act like resistors, the resistance
changes depending on how much light they are exposed to.
38 / 137
Http://www.elego.cc
As you can see from these datasheet graphs, the peak frequency detection is at 38 KHz and
the peak LED color 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 afar. Likewise, you can use 850 to 1100 nm LEDs
but they wont work as well as 900 to 1000nm so make sure to get matching LEDs! Check the
datasheet for your IR LED to verify the wavelength.
Try to get a 940nm - remember that 940nm is not visible light (its Infra Red)!
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.
39 / 137
Http://www.elego.cc
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~60mA, positive pulse current 0.3~1A, reverse voltage 5V, dissipation power 90mW,
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,
otherwise it will influence the sensitivity.
Connection
Schematic
40 / 137
Http://www.elego.cc
wiring diagram
41 / 137
Http://www.elego.cc
Result
42 / 137
Http://www.elego.cc
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.
Component Required:
43 / 137
Http://www.elego.cc
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. Buzzers can be categorized as active and passive ones (see the following picture).
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.
Passive Buzzer:
Passive buzzer, in fact, just use PWM generating audio, drives the buzzer, allowing the air to
vibrate, can sound. Appropriately changed as long as the vibration frequency, it can
generate different sound scale. For example, sending a pulse wave can be generated
523Hz Alto Do, pulse 587Hz can produce midrange Re, 659Hz can produce midrange Mi. If
you then with a different beat, you can play a 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
44 / 137
Http://www.elego.cc
From the exterior, two kinds of buzzer seems the same, but a closer look, a slight difference
between the height of the active buzzer a, height of 9mm, and passive buzzer b height of
8mm. 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
45 / 137
Http://www.elego.cc
wiring diagram
46 / 137
Http://www.elego.cc
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.
47 / 137
Http://www.elego.cc
48 / 137
Http://www.elego.cc
Component Required:
Component Introduction
Laser sensor:
49 / 137
Http://www.elego.cc
Connection
Schematic
50 / 137
Http://www.elego.cc
wiring diagram
51 / 137
Http://www.elego.cc
Result
After we connect the circuit as the picture, we upload the program. We can see the
module can emission lasers.
52 / 137
Http://www.elego.cc
In this experiment, we will learn how to use SMD RGB module and RGB module.
Actually, the function of SMD RGB module and RGB 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.
Component Required:
53 / 137
Http://www.elego.cc
Component Introduction
SMD RGB:
RGB:
54 / 137
Http://www.elego.cc
Connection
Schematic
55 / 137
Http://www.elego.cc
wiring diagram
56 / 137
Http://www.elego.cc
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.
57 / 137
Http://www.elego.cc
58 / 137
Http://www.elego.cc
Component Required:
Component Introduction
59 / 137
Http://www.elego.cc
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
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 Elego Uno board. When
the switch sensing, LED twinkle light to the switch signal.
60 / 137
Http://www.elego.cc
Connection
Schematic
wiring diagram
61 / 137
Http://www.elego.cc
Result
After we connect the circuit as the picture, we upload the program, we sensing the opto
Interrupter, then we can see the LED13 light up and light off.
62 / 137
Http://www.elego.cc
Component Required:
Component Introduction
63 / 137
Http://www.elego.cc
64 / 137
Http://www.elego.cc
Connection
Schematic
wiring diagram
65 / 137
Http://www.elego.cc
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.
66 / 137
Http://www.elego.cc
67 / 137
Http://www.elego.cc
Photo-resistor 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 more conveniently and efficiently.
Component Required:
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
68 / 137
Http://www.elego.cc
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.
When the photocell is in dull light the resistance becomes greater than the fixed 1kΩ resistor
and it is as if the pot were being turned towards GND.
Load up the sketch given in the next section and try covering the photocell with your finger,
and holding it near a light source.
Connection
Schematic
69 / 137
Http://www.elego.cc
wiring diagram
70 / 137
Http://www.elego.cc
Result
Upload the program then open the monitor, we can see the data as below:
71 / 137
Http://www.elego.cc
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 output equivalently of switch
on, when there is no light, low voltage equivalently of switch off. This is what we can use this
in practice.
72 / 137
Http://www.elego.cc
In this experiment, we will learn how to use the High-sensitive Voice Sensor.
Component Required:
73 / 137
Http://www.elego.cc
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.
Connection
Schematic
74 / 137
Http://www.elego.cc
wiring diagram
Result
DO, when the intensity of the sound to reach a certain threshold, the output high and low
level signal, the threshold-sensitivity can be achieved by potentiometer adjustment period.
The installation of 3mm screw holes use 5 v dc power supply have analog output
turn a threshold level of output microphone GaoGan degree, high sensitivity. has a power
light the comparator output indicator light. Upload the program then open the monitor, we
75 / 137
Http://www.elego.cc
76 / 137
Http://www.elego.cc
77 / 137
Http://www.elego.cc
In this experiment, we will learn how to use reed switch and mini reed switch module.
Component Required:
78 / 137
Http://www.elego.cc
Component Introduction
Although a reed switch can be activated by placing it inside an electrical coil, many reed
switches and reed sensors are used for proximity sensing and are activated by a magnet. As
the magnet is brought into the proximity of the reed sensor/switch, the device activates. As
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 into the metal parts of the reed switch and the resulting attraction between
the electrical 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.
The following are examples of typical reed switch and reed sensor activate distances.
79 / 137
Http://www.elego.cc
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 output 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
As can be seen, the magnetic orientation and location relative to the reed switch play
important roles in 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.
80 / 137
Http://www.elego.cc
wiring diagram
81 / 137
Http://www.elego.cc
Result
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 Elego Uno board. When the switch sensing, LED
twinkle light to the switch signal.
82 / 137
Http://www.elego.cc
wiring diagram
Result
83 / 137
Http://www.elego.cc
In this experiment, we use the AO pin of reed switch module. When the sensor sensing
magnetism, the module will output a data which reflect the strength of the magnetism. The
number is from 0 to 1023.
Upload the program then open the monitor, we can see the data as below:
84 / 137
Http://www.elego.cc
In this experiment, we will learn how to use digital temperature module andanalog temp
module.
Component Required:
85 / 137
Http://www.elego.cc
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.
86 / 137
Http://www.elego.cc
Result
Upload the program, open the monitor then you can see the data as below:
87 / 137
Http://www.elego.cc
88 / 137
Http://www.elego.cc
wiring diagram
Result
89 / 137
Http://www.elego.cc
In this experiment, we use the AO pin of reed switch module. When the sensor sensing
temperature, the module will output a data which reflect the temperature. The number is
from 0 to 1023.
Upload the program then open the monitor, we can see the data as below:
90 / 137
Http://www.elego.cc
In this experiment, we will learn how to use the linear hall and analog hall module.
Component Required:
91 / 137
Http://www.elego.cc
Component Introduction
Hall Sensor:
92 / 137
Http://www.elego.cc
Unipolar: Only a south pole will operate the sensor. The sensor turns on
with the south pole(+) and off when the south pole is removed.
that the sensor could turn off and still be within a positive Gauss level.
to make certain that when the south pole(+) is removed from the sensor, it
or -).
Connection
Schematic
93 / 137
Http://www.elego.cc
wiring diagram
94 / 137
Http://www.elego.cc
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.
95 / 137
Http://www.elego.cc
Connection
wiring diagram
Result
In the following picture, we use the AO port to output. so we can see that if the hall sensor
sensing the magnetic force, the module will output a data which reflect the strength of the
96 / 137
Http://www.elego.cc
Upload the program then open the monitor, we can see the data as below:
Upload the program then open the monitor, we can see the data as below:
97 / 137
Http://www.elego.cc
In this experiment, we will learn how to use the flame sensor module.
This module is sensitive to the flame and radiation. It also can detect ordinary light source in
the range of a wavelength 760nm-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.
Component Required:
Component Introduction
Flame sensor:
98 / 137
Http://www.elego.cc
Connection
Schematic
wiring diagram
99 / 137
Http://www.elego.cc
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.
100 / 137
Http://www.elego.cc
In the following picture, we use the AO port to output. so we can see that if the flame sensor
sensing the flame, the module will output a data which reflect the strength of the flame. The
number is from 0 to 1023.
Upload the program then open the monitor, we can see the data as below:
101 / 137
Http://www.elego.cc
In this experiment, we will learn how to use the mental touch module.
Component Required:
Connection
Schematic
102 / 137
Http://www.elego.cc
wiring diagram
Result
103 / 137
Http://www.elego.cc
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.
In the following picture, we use the AO port to output. so we can see that if the sensor
sensing, the module will output a data. The number is from 0 to 1023.
104 / 137
Http://www.elego.cc
Upload the program then open the monitor, we can see the data as below:
105 / 137
Http://www.elego.cc
In this experiment, we will learn how to use the 7 color flash LED module.
Component Required:
Component Introduction
7 color flashing LED module automatically uses 5mm round high-brightness light-emitting
diode which has the following characteristics:
106 / 137
Http://www.elego.cc
Connection
Schematic
wiring diagram
107 / 137
Http://www.elego.cc
Result
108 / 137
Http://www.elego.cc
In this experiment, we will learn how to use the light cup module.
Component Required:
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
109 / 137
Http://www.elego.cc
Schematic
wiring diagram
110 / 137
Http://www.elego.cc
Result
111 / 137
Http://www.elego.cc
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.
Component Required:
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
112 / 137
Http://www.elego.cc
Size: 40*28mm
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
Connection
Schematic
113 / 137
Http://www.elego.cc
wiring diagram
Result
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.
114 / 137
Http://www.elego.cc
115 / 137
Http://www.elego.cc
116 / 137
Http://www.elego.cc
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 ~ 40cm, 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
Component Required:
117 / 137
Http://www.elego.cc
Component Introduction
Connection
Schematic
wiring diagram
118 / 137
Http://www.elego.cc
Result
Upload the program then open the monitor, we can see the data as below:
119 / 137
Http://www.elego.cc
Non logic chip oscillation frequency regulation 38KHz detection circuit. This infrared 38KHZ
obstacle avoidance module can completely block the traditional photoelectric obstacle
detection distance and a single normally open or normally closed signal output function.
Component Required:
Component Introduction
Specifications
Output signal: TTL level (low level there is an obstacle, no obstacle high)
120 / 137
Http://www.elego.cc
Effective angle: 35 °
Weight Size: 9g
121 / 137
Http://www.elego.cc
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 ~ 40cm, 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.
122 / 137
Http://www.elego.cc
Connection
Schematic
123 / 137
Http://www.elego.cc
wiring diagram
Result
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.
124 / 137
Http://www.elego.cc
In this experiment, we will learn how to use the rotary encoders module.
Component Required:
Component Introduction
Rotary Encoders:
125 / 137
Http://www.elego.cc
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
126 / 137
Http://www.elego.cc
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
127 / 137
Http://www.elego.cc
wiring diagram
128 / 137
Http://www.elego.cc
Result
Upload the program, rotate the encodes then open the monitor, we can see the data as
below:
129 / 137
Http://www.elego.cc
In this experiment, we will learn how to use the1 channel relay module.
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
actually with a small current to control large current operation of a kind of "automatics
Component Required:
Component Introduction
Relay:
130 / 137
Http://www.elego.cc
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 overload or faults; in modern electric power systems these functions
are performed by digital instruments still called "protective relays".
Bellow is the schematic of how to drive relay with arduino (down load from the arduino.cc)
Connection
Schematic
131 / 137
Http://www.elego.cc
wiring diagram
132 / 137
Http://www.elego.cc
Result
133 / 137
Http://www.elego.cc
This project uses bright infrared (IR) LED and a phototransistor to detect the pulse of the
finger, a red LED flashes with each pulse. Pulse monitor works as follows: The LED is the light
side of the finger, and phototransistor 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 phototransistor 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 50HZor 60HZfluctuate, so faint heartbeat will add consider able
noise.
When running the program the measured values are printed. To get a real heartbeat from
this could be challenging.
Component Required:
134 / 137
Http://www.elego.cc
Connection
Schematic
wiring diagram
135 / 137
Http://www.elego.cc
Result
136 / 137
Http://www.elego.cc
Upload the program then open the monitor, we can see the data as below:
137 / 137