SunFounder Sensor Kit V1.0 User manual

Preface
About SunFounder
SunFounder is a technology company focused on Raspberry Pi and Arduino open source
community development. Committed to the promotion of open source culture, we strive to
bring the fun of electronics making to people all around the world and enable everyone to
be a maker. Our products include learning kits, development boards, robots, sensor modules
and development tools. In addition to high quality products, SunFounder also offers video
tutorials to help you build your own project. If you have interest in open source or making
something cool, welcome to join us! Visit www.sunfounder.com for more!
About Sensor Kit V1.0
This kit is suitable for SunFounder Uno, SunFounder Mega 2560, SunFounder Duemilanove and
SunFounder Nano. All the code in this user manual is compatible with these boards.
Our SunFounder board is fully compatible with Arduino board.
You can go to our official website www.sunfounder.com to download related code by
clicking LEARN -> Get Tutorials. If you have any questions, please send an email to
support@sunfounder.com. Also welcome to leave a message and share your projects on our
FORUM.
Note: This kit is different from other kits. All the components in this kit are provided in the form
of modules which integrate some necessary components, such as comparator, resistor, and
capacitor and so on. Therefore it is convenient for circuit connection.
Reprint 2.0
SunFounder

Contents
Components List .................................................................................................................................. 1
Notice .................................................................................................................................................... 8
Lesson 1 Hall Sensor ........................................................................................................................... 10
Lesson 2 RGB LED ............................................................................................................................... 15
Lesson 3 Dual-color Common-Cathode LED ................................................................................. 18
Lesson 4 Shock Switch ....................................................................................................................... 20
Lesson 5 Knock Sensor ...................................................................................................................... 22
Lesson 6 Infrared Transmitter ............................................................................................................ 24
Lesson 7 Laser Transmitter ................................................................................................................. 26
Lesson 8 Reed Switch ........................................................................................................................ 28
Lesson 9 Infrared-Receiver ............................................................................................................... 31
Lesson 10 Analog Temperature Sensor ........................................................................................... 33
Lesson 11 Digital Temperature Sensor ............................................................................................ 35
Lesson 12 Buzzer ................................................................................................................................. 37
Lesson 13 Button Switch .................................................................................................................... 40
Lesson 14 Photo-interrupter .............................................................................................................. 42
Lesson 15 Tilt-Switch ........................................................................................................................... 44
Lesson 16 Mercury Switch ................................................................................................................. 46
Lesson 17 Magic Cup ........................................................................................................................ 48
Lesson 18 DS18B20 Temperature Sensor ......................................................................................... 50
Lesson 19 Rotary Encoder ................................................................................................................ 52
Lesson 20 7-Color Auto-flash LED ..................................................................................................... 55
Lesson 21 Photoresistor Sensor ......................................................................................................... 56
Lesson 22 Humiture Sensor ................................................................................................................ 58
Lesson 23 Obstacle Avoidance Sensor .......................................................................................... 60
Lesson 24 Tracking Sensor ................................................................................................................. 62
Lesson 25 Microphone Sensor .......................................................................................................... 64
Lesson 26 Metal Touch Sensor ......................................................................................................... 67
SunFounder

Lesson 27 Flame Sensor ..................................................................................................................... 69
Lesson 28 Relay Module ................................................................................................................... 71
Lesson 29 Joystick PS2 ....................................................................................................................... 73
Lesson 30 MQ-2 Gas Sensor.............................................................................................................. 75
Lesson 31 Password Lock .................................................................................................................. 77
Lesson 32 Lie Detector ...................................................................................................................... 79
Lesson 33 Fire Alarm .......................................................................................................................... 81
Lesson 34 Thermostatic Water Tank System ................................................................................... 83
Lesson 35 Intelligent Environment Monitoring ................................................................................ 85
SunFounder

1
Components List
No. Name Qty. Component
1 Analog Hall Sensor 2
2 Switch Hall Sensor 1
3 RGB LED 2
4 Dual-color
Common-Cathode LED
2
SunFounder

2
5 Shock Switch 1
6 Knock Sensor 1
7 Infrared Transmitter 1
8 Laser Transmitter 1
9 Reed Switch 1
10 Mini Reed 1
11 Infrared Receiver 1
SunFounder

3
12 Analog Temperature
Sensor
1
13 Digital Temperature
Sensor
1
14 Active Buzzer 1
15 Passive Buzzer 1
16 Button Switch 1
17 Photo-interrupter 1
18 Tilt Switch 1
SunFounder

4
19 Mercury Switch 1
20 Magic Cup 2
21 DS18B20 Temperature
Sensor
1
22 Rotary Encoder 1
23 7-color Auto-flash LED 1
24 Photoresistor Sensor 1
SunFounder

5
25 Humiture Sensor 1
26 Obstacle Avoidance
Sensor
1
27 Tracking Sensor 1
28 Microphone Sensor 1
29 High-sensitive Voice
Sensor
1
30 Metal Touch Sensor 1
31 Flame Sensor 1
SunFounder

6
32 Relay Module 1
33 Joystick PS2 1
34 MQ-2 Gas Sensor 1
35 LCD1602 1
36 4x4 Keypad 1
37 Remote Control 1
SunFounder

7
38 250k Ohm
Potentiometer
1
39 470k Ohm Resistor 1
40 Breadboard 1
41 Jumper Wire
(M to F)
40
42 Jumper Wire
(M to M)
20
SunFounder

8
Notice
All the experiments in this kit are done with SunFounder Uno R3 board, but they are also
compatible with SunFounder Mega 2560, SunFounder Nano and all official Arduino Boards.
All the code included in this kit works with these boards.
So what does COMPATIBLE mean here? It means you can use any of the three boards to do
the same experiment with the same wiring. Take turning on an LED as an example. We use
SunFounder Uno as the microcontroller, but you can also use SunFounder Nano or
SunFounder Mega 2560 to serve the same function. Just select the right Board and COM
when compiling.
SunFounder

9
SunFounder

10
Lesson 1 Hall Sensor
Introduction
Based on the Hall Effect, a hall sensor is one that varies its output voltage in response to a
magnetic field. Hall sensors are used for proximity switching, positioning, speed detection,
and current sensing applications.
Hall sensors can be categorized into linear (analog) Hall sensors and switch Hall sensors. A
switch Hall sensor consists of voltage regulator, Hall element, differential amplifier, Schmitt
trigger, and output terminal and it outputs digital values. A linear Hall sensor consists of a Hall
element, linear amplifier, and emitter follower and it outputs analog values.
There are three types of hall sensor module in this kit (as shown below): linear Hall sensor (in
two forms) which outputs analog signals, and switch Hall sensor which outputs digital signals.
If you add a comparator to the linear Hall sensor, it will be able to output both analog and
digital signals.
SunFounder

11
Components
- 1 * SunFounder Uno board
- 1 * USB data cable
- 1 * Hall sensor module
- 1 * LCD1602
- 1 * Potentiometer
- Several jumper wires
Experimental Principles
Hall Effect
Hall Effect is a kind of electromagnetic effect. It was discovered by Edwin Hall in 1879 when
he was researching conductive mechanism about metals. The effect is seen when a
conductor is passed through a uniform magnetic field. The natural electron drift of the
charge carriers causes the magnetic field to apply a Lorentz force (the force exerted on a
charged particle in an electromagnetic field) to these charge carriers. The result is what is
seen as a charge separation, with a buildup of either positive or negative charges on the
bottom or on the top of the plate.
Hall Sensor
A hall sensor is a kind of magnetic field sensor based on the effect.
Electricity carried through a conductor will produce a magnetic field that varies with current,
and a Hall sensor can be used to measure the current without interrupting the circuit.
Typically, the sensor is integrated with a wound core or permanent magnet that surrounds
the conductor to be measured.
SunFounder

12
Experimental Procedures
For linear Hall sensor module, please take the following steps.
Step 1: Build the circuit
Linear Hall Sensor Module SunFounder Uno
S ---------------------------------------- A5
- ---------------------------------------- GND
+ ----------------------------------------- 5V
Step 2: Program (Please refer to the example code in LEARN -> Get Tutorial on our website)
Step 3: Compile
Step 4: Upload the sketch to SunFounder Uno
Now, you can see the LED attached to pin 13 on SunFounder Uno board blinking. If a magnet
approaches the linear Hall sensor, the blinking frequency of LED will increase or decrease.
SunFounder

13
For Switch Hall Sensor module
Step 1: Build the circuit
Switch Hall Sensor Module SunFounder Uno
S ----------------------------------------Digital 8
- ---------------------------------------- GND
+ ---------------------- ----------------- 5V
Step 2: Program (Please refer to the example code in LEARN -> Get Tutorial on our website)
Step 3: Compile
Step 4: Upload the sketch to SunFounder Uno
Now, place a magnet close to the switch Hall sensor. Then the indicator LED on the switch
Hall sensor will light up and the buzzer will beep. At the same time, the LED attached to pin
13 on the SunFounder Uno board will light up.
SunFounder

14
For linear Hall sensor module (with a comparator added)
Step 1: Build the circuit
Linear Hall Sensor Module SunFounder Uno
AO ------------------------------------------- A0
DO ------------------------------------------- Digital 8
- -------------------------------------------- GND
+ ---------------------------------------------- 5V
LCD1602 connection: connect pin RS to digital pin 3; R/W to GND; E to digital pin 4; D4~D7 to
digital pin 9 to 12; VSS to GND; VDD to 5V; A to 3.3V; K to GND
Potentiometer connection: Connect its middle pin to VO of LCD1602 and any other pin to
GND
Step 2: Program (Please refer to the example code in LEARN -> Get Tutorial on our website)
Step 3: Compile
Step 4: Upload the sketch to SunFounder Uno
Now, put a magnet close to the linear Hall sensor, and the indicator LED on the linear Hall
sensor will light up. At the same time, the analog and digital value displayed on the LCD will
change accordingly.
SunFounder

15
Lesson 2 RGB LED
Introduction
There are two kinds of packages for RGB LED (as shown below) in this kit. One is Surface
Mount Device (SMD) type, and the other is Dual In-line Package (DIP) type.
Components
- 1 * SunFounder Uno board
- 1 * USB data cable
- 1 * RGB LED module
- Several jumper wires
Experimental Principle
RGB LED modules can emit various colors of light. Three LEDs of red, green, and blue are
packaged into a transparent or semitransparent plastic shell with four pins led out. The three
primary colors, red, green, and blue, can be mixed into various kinds of color by brightness,
so you can make an RGB LED emit colorful light by controlling the circuit.
In this experiment, we will also use PWM technology to control the brightness of RGB.
Before we talk about PWM, let’s take a look at the applications of PWM first. PWM has been
successfully applied in motor speed regulation, steering angle control, light intensity control
and signal output. For example, when PWM is applied to a horn, it will make sounds. After we
know about its special functions, let’s find out what PWM really is.
Pulse Width Modulation commonly refers to PWM. Pulse Width Modulation (PWM) is a digital
coding method for analog signal levels. Since a computer cannot output an analog voltage
but digital voltage value 0V or 5V, we modulate the duty cycle of square waves to encode
a specific level of analog signal by using a high-resolution counter. PWM signals are
essentially digital signals, for the full amplitude DC power supply is either 5V (ON) or 0V (OFF)
SunFounder

16
at any given time. Voltage or current source is applied to an analog load in the form of ON
or OFF repetitive pulse sequence. When it is on, DC power supply will be applied to the load;
when it is off, DC power supply will be disconnected. If only the bandwidth is wide enough,
any analog value can be encoded by PWM. The output voltage value is calculated by the
on and off time. V
out
= (T
on
/ T)*V
max
.
We can see from the top oscillogram that the amplitude of DC voltage output is 5V. However,
the actual voltage output is only 3.75V through PWM, for the high level only takes up 75% of
the total voltage within a period.
Here is the introduction to three basic parameters of PWM:
1. The term duty cycle describes the proportion of 'on' time to the regular interval or 'period'
of time
SunFounder

17
2. Period describes the reciprocal of pulses in one second
3. U
pwm
describes the mean value of output voltage (e.g. 0V-5V)
Here we input any value between 0 and 255 to the three pins of the RGB LED to make it flash
different colors.
RGB LEDs can be categorized into common anode type and common cathode type. In this
experiment, we use common cathode RGB LED.
Experimental Procedures
Step 1: Build the circuit
RGB LED Module SunFounder Uno
R -------------------------------------D11
G ------------------------------------ D10
B ------------------------------------- D9
- ------------------------------------- GND
Step 2: Program (Please refer to the example code in LEARN -> Get Tutorial on our website)
Step 3: Compile
Step 4: Upload the sketch to SunFounder Uno
Now, you can see the RGB LED flash red, green and blue first, and then red, orange, yellow,
green, blue, indigo and purple.
SunFounder
Table of contents
Other SunFounder Accessories manuals
Popular Accessories manuals by other brands

senva
senva CHTWL Series installation instructions

netvox
netvox R72632A01 user manual

IFM Electronic
IFM Electronic efector 300 SU8000 operating instructions

Orion
Orion Sirius EQ?G instruction manual

Honeywell
Honeywell 5000TC Series Operation and maintenance manual

PCB Piezotronics
PCB Piezotronics 209C01 Installation and operating manual