Elego 37 SENSOR KIT Operation instructions

Http://www.elego.cc
1/ 137
37 SENSOR KIT TUTORIAL FOR UNO

Http://www.elego.cc
2/ 137
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 official website is: Http://www.elego.cc
Our USA amazon shop is: Http://www.amazon.com/shops/A2WWHQ25ENKVJ1
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 service@elego.cc.
We will very appreciate and improve ourselves so that we can offer you a better service.

Http://www.elego.cc
3/ 137
Packing List

Http://www.elego.cc
4/ 137

Http://www.elego.cc
5/ 137
Lesson Listing
Lesson 0 Installing IDE......................................................................................................................................... 6
Lesson 1 Add Libraries....................................................................................................................................... 14
Lesson 2 TEMP AND HUMIDITYMODULE .......................................................................................................... 18
Lesson 3 DS18B20 DIGITAL TEMPERATURE SENSOR MODULE ......................................................................... 23
Lesson 4 BUTTON SWITCH MODULE ................................................................................................................. 28
Lesson 5 FOUR TYPE OF SWITCH MODULE........................................................................................................ 31
Lesson 6 IR RECEIVER AND EMISSION ............................................................................................................... 37
Lesson 7 Active and passive buzzer................................................................................................................... 43
Lesson 8 LASER MODULE .................................................................................................................................. 49
Lesson 9 SMD RGB MODULE AND RGB MODULE.............................................................................................. 53
Lesson 10 PHOTO-INTERRUPTER MODULE ....................................................................................................... 59
Lesson 11 DUAL-COLOR COMMON-CATHODE LED ........................................................................................... 63
Lesson 12 PHOTORESISTOR MODULE ............................................................................................................... 68
Lesson 13 BIG SOUND SENSOR MODULE AND SMALL SOUND SENSOR MODULE ............................................ 73
Lesson 14 REED SWITCH AND MINI REED SWITCH MODULE ............................................................................ 78
Lesson 15 DIGITAL TEMPERATURE MODULE .................................................................................................... 85
Lesson 16 LINEAR HALL AND ANALOG HALL MODULE...................................................................................... 91
Lesson 17 FLAME SENSOR MODULE.................................................................................................................. 98
Lesson 18 MENTAL TOUCH MODULE .............................................................................................................. 102
Lesson 19 7 COLOR FLASH LED MODULE......................................................................................................... 106
Lesson 20 Magic light cup MODULE................................................................................................................ 109
Lesson 21 JOYSTICK MODULE ......................................................................................................................... 112
Lesson 22 TRACKING MODULE........................................................................................................................ 117
Lesson 23 Infrared 38KHz obstacle avoidance module ................................................................................... 120
Lesson 24 ROTARY ENCODERS MODULE......................................................................................................... 125
Lesson 25 1 CHANNEL RELAY MODULE ........................................................................................................... 130
Lesson 26 HEARTBEAT MODULE ..................................................................................................................... 134

Http://www.elego.cc
6/ 137
Lesson 0 Installing IDE
Introduction
In this lesson, you will learn how to setup your computer to use Arduino and how to set about
the lessons that follow.
Installing Arduino (Windows)
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.

Http://www.elego.cc
7/ 137
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.

Http://www.elego.cc
8/ 137
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.

Http://www.elego.cc
9/ 137
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'.
Installing Arduino (Mac and Linux)
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!

Http://www.elego.cc
10 / 137
Save the install software to your desktop or wherever
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.

Http://www.elego.cc
11 / 137
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.
Boards and Ports
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.

Http://www.elego.cc
12 / 137
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.

Http://www.elego.cc
13 / 137
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

Http://www.elego.cc
14 / 137
Lesson 1 Add Libraries
Once you are comfortable with the Arduino software and using the built-in functions,
you may want to extend the ability of your Arduino with additional libraries.
What are Libraries?
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.
How to Install a Library
Using the Library Manager
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.

Http://www.elego.cc
15 / 137
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.

Http://www.elego.cc
16 / 137
Importing a .zip Library
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.)

Http://www.elego.cc
17 / 137
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
....
or like this (on Mac and Linux):
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.

Http://www.elego.cc
18 / 137
Lesson 2 TEMP AND HUMIDITYMODULE
Overview
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:
(1) x Elego Uno R3
(1) x USB cable
(1) x DHT11 module
(x) x F-M wires
Component Introduction
Temp and humidity sensor:

Http://www.elego.cc
19 / 137
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.
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: 16Bit
Repeatability: ±1% RH
Accuracy: At 25℃±5% RH
Interchangeability: fully interchangeable
Response time: 1 / e (63%) of 25℃6s
1m / s air 6s
Hysteresis: <± 0.3% RH
Long-term stability: <± 0.5% RH / yr in
Temperature:
Resolution: 16Bit

Http://www.elego.cc
20 / 137
Repeatability: ±0.2℃
Range: At 25℃±2℃
Response time: 1 / e (63%) 10S
Electrical Characteristics
Power supply: DC 3.5~5.5V
Supply Current: measurement 0.3mA standby 60μA
Sampling period: more than 2 seconds
Pin Description:
1, the VDD power supply 3.5~5.5V DC
2 DATA serial data, a single bus
3, NC, empty pin
4, GND ground, the negative power
Typical Application
Connection
Schematic
Table of contents