Ks0068 keyestudio 37 in 1 Sensor Kit for Arduino Starters: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
 
(138 intermediate revisions by the same user not shown)
Line 1: Line 1:
=='''37 in 1 Box for Arduino Starters'''==


<br>[[File:ks0068-1.png|500px|frameless|thumb]]<br>
==kesestudio 37 in 1 Sensor Kit for Arduino Starters==
Sensor kit for Arduino <br>
Based on open-source hardware <br>
37 various sensors in one box <br>
For you to make interesting projects <br>


=='''1. Summary''' ==
[[File:KS0068_(13).jpg|500px|frameless|thumb]]
This is an Arduino sensor learning kit developed by Keyestudio. We bring together 36 basic sensors and modules, aiming for the convenience of its learning for starters. Inside this box, there are digital and analog sensors and also some special modules such as ultrasonic, bluetooth,, acceleration modules etc. For each module, there is clear connection diagram and sample code. So even if you are totally new at this, you can get started easily. <br>
The sample codes for this sensor kit are based on ARDUINO because it's open source and easy. And if you are good at this, you can also apply this kit to other MCU development platform, such as 51, STM32, Raspberries Pi. The working principle is pretty much the same. <br>
Now, let us embrace this fascinating world of ARDUINO and learn together!    <br>
<br>[[File:37-1.png|500px|frameless|thumb]]<br>


=='''2. Kit list'''==
* Sensor kit for Arduino <br>
1: Digital White LED Light Module project <br>
* Based on open-source hardware <br>
2: Piranha LED Light Module <br>
* 37 kinds of sensors packed in one box <br>
3: 3W LED Module <br>
* To make interesting projects <br>
4: RGB LED module <br>
5: Analog temperature sensor <br>
6: Photocell sensor <br>
7: Analog Sound Sensor <br>
8: Analog Rotation Sensor <br>
9: Passive Buzzer module <br>
10: Digital Buzzer Module <br>
11: Digital Push Button <br>
12: Digital Tilt Sensor <br>
13: photo interrupter module <br>
14. Capacitive Touch Sensor <br>
15: Knock Sensor Module <br>
16: Hall Magnetic Sensor <br>
17: Line Tracking Sensor <br>
18: Infrared Obstacle Avoidance Sensor <br>
19: PIR Motion Sensor <br>
20: Flame Sensor <br>
21: Vibration Sensor <br>
22: Analog Gas Sensor <br>
23: Analog Alcohol Sensor <br>
24: Digital IR Transmitter Module <br>
25: Digital IR Receiver Module <br>
26: Rotary Encoder module <br>
27: LM35 Temperature Sensor <br>
28: 18B20 Temperature Sensor <br>
29: ADXL345 Three Axis Acceleration Module  <br>
30: DHT11 Temperature and Humidity Sensor  <br>
31: Bluetooth Module <br>
32: TEMT6000 ambient light sensor <br>
33: Keyestudio SR01 Ultrasonic Sensor  <br>
34: Joystick Module <br>
35: DS3231 Clock Module <br>
36: 5V Relay Module <br>
37: Vapor Sensor <br>


=='''3. Project Details''' ==
<br>


=== '''Project 1: LED Light Module '''===
=='''Summary''' ==
<br>[[File:ks0068 1-1.png|500px|frameless|thumb]]<br>
This is keyestudio sensor learning kit. We bring together 37 basic sensors and modules, aiming for the convenient learning for starters.
Inside this box, there are digital and analog sensors and also some special modules such as ultrasonic, Bluetooth, acceleration module,etc. <br>
For each module, there is clear connection diagram and sample code. So even if you are totally new at this, you can get started easily.The sample codes for this sensor kit are based on ARDUINO because it's open source and easy to use.
If you are good at this, you can also apply this kit to other MCU development platforms, such as 51, STM32, Raspberries Pi.
The working principle is pretty much the same. <br>
Now, let us embrace this fascinating world of ARDUINO and learn together! 
<br>[[File:KS0068 (6).jpg|600px|frameless|thumb]]<br>


'''Introduction:'''<br>
=='''Project Details''' ==
This LED light module has a shiny color, ideal for Arduino starters. It can be easily connected to IO/Sensor shield. <br>


'''Specification:'''<br>
<br>
*Type: Digital
=== '''Project 1: White LED Light ''' ===
*PH2.54 socket
<br>
*White LED light module
'''Introduction''' <br>
*Enables interaction with light-related works
This is a white LED module. The main function is to control a plugin LED on and off. When connecting to ARDUINO, after programming, it will emit white light color.<br>
*Size: 30*20mm
The pin pitch of 3Pin is 2.54mm. This LED module has 3 Pins; - pin is connected to ground, + pin is connected to VCC(3.3-5V), S pin is for signal control; you can set the High or Low level to control the LED on and off.  <br>
*Weight: 3g
You can combine with other sensors to do various interactive experiments.
You can also choose other LED modules to emit different light color like blue, green, yellow and red.<br>
<br>[[File:Ks0016-1.png|350px|frameless|thumb]]<br>


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 1-2.png|500px|frameless|thumb]]<br>
'''Features''' <br>
* Control interface: Digital
* Working voltage: DC 3.3-5V
* Pin pitch: 2.54mm
* LED color: white
* Easy to use
* Useful for light projects


'''Sample Code:'''<br>
<br>
'''Connect It Up'''<br>
Connect the LED module to control board using three jumper wires. Then connect the control board to your PC with a USB cable.<br>
<br>[[File:Ks0016-2.png|600px|frameless|thumb]]<br>


<br>
'''Upload the Code'''<br>
Copy and paste below code to Arduino IDE and upload.
 
<pre>
<pre>
*****************************************************************************
int led = 7;  
int led = 3;
void setup()
void setup()
{
{
   pinMode(led, OUTPUT);    //Set Pin3 as output
   pinMode(led, OUTPUT);    //Set Pin7 as output
}
}
void loop()
void loop()
{
{   digitalWrite(led, HIGH);  //Turn off led
          digitalWrite(led, HIGH);  //Turn on led
           delay(1000);
           delay(2000);
           digitalWrite(led, LOW);    //Turn on led
           digitalWrite(led, LOW);    //Turn off led
           delay(1000);
           delay(2000);
}
}
*******************************************************************************
</pre>
</pre>


=== '''Project 2: Piranha LED Light Module '''===
<br>
<br>[[File:ks0068 2-1.png|500px|frameless|thumb]]<br>
'''Test Result'''<br>
The LED will flash on for one second, then off for one second, repeatedly and alternately. <br>
If it doesn’t, make sure you have assembled the circuit correctly and verified and uploaded the code to your board. <br>
<br>[[File:Ks0017.png|600px|frameless|thumb]]<br>


'''Introduction:'''<br>
<br>
This is a special LED module. When you connect it to ARDUINO development board, after program, it can emit beautiful light. Of course, you can also control it using PWM. It will be like fireflies at night. Isn’t cool? We can also combine it with other sensors to do various interesting interactive experiments.  <br>


'''Specification:'''<br>
=== '''Project 2: Red LED Light '''===
*Module type: digital
<br>
*Working voltage: 5v
'''Introduction''' <br>
*Distance between pins: 2.54mm
This is a red LED module. The main function is to control a plugin LED on and off. When connecting to ARDUINO, after programming, it will emit red light color.<br>
*Size: 30*20mm
The pin pitch of 3Pin is 2.54mm.
*Weight: 3g
This LED module has 3 Pins; - pin is connected to ground, + pin is connected to VCC(3.3-5V), S pin is for signal control; you can set the High or Low level to control the LED on and off. <br>
You can combine with other sensors to do various interactive experiments. <br>
You can also choose other LED modules to emit different light color like blue, green, yellow and white.<br>
<br>[[File:Ks0232-1.png|350px|frameless|thumb]]<br>


<br>
'''Features''' <br>
* Control interface: Digital
* Working voltage: DC 3.3-5V
* Pin pitch: 2.54mm
* LED color: red
* Easy to use
* Useful for light projects


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 2-2.png|500px|frameless|thumb]]<br>
'''Technical Details''' <br>
* Dimensions: 34mm*20mm*11.5mm
* Weight: 2.7g


'''Sample Code:'''<br>
<br>
'''Connect It Up''' <br>
Connect the red LED module to control board using three jumper wires. Then connect the control board to your PC with a USB cable.<br>
<br>[[File:Ks0232-2.png|600px|frameless|thumb]]<br>


<br>
'''Upload the Code''' <br>
Copy and paste below code to Arduino IDE and upload.  <br>
<pre>
<pre>
*****************************************************************************
int led = 7;  
int led = 3;  
void setup()
void setup()
{
{
   pinMode(led, OUTPUT);    //Set Pin3 as output
   pinMode(led, OUTPUT);    //Set Pin7 as output
}
}
void loop()
void loop()
{     digitalWrite(led, HIGH);  //Turn off led
{   digitalWrite(led, HIGH);  //Turn off led
           delay(2000);
           delay(1000);
           digitalWrite(led, LOW);    //Turn on led
           digitalWrite(led, LOW);    //Turn on led
           delay(2000);
           delay(1000);
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Test Result'''<br>
The LED will flash on for one second, then off for one second, repeatedly and alternately. <br>
If it doesn’t, make sure you have assembled the circuit correctly and verified and uploaded the code to your board. <br>
<br>[[File:Ks0232-3.png|500px|frameless|thumb]]<br>


<br>
=== '''Project 3: 3W LED Module '''===  
=== '''Project 3: 3W LED Module '''===  
<br>[[File:ks0068 3-1.png|500px|frameless|thumb]]<br>
<br>
'''Introduction'''<br>
This LED module is of high brightness because the lamp beads it carries is 3W. We can apply this module to Arduino projects. <br>
For example, intelligent robots can use this module for illumination purpose.<br>
Please note that the LED light can't be exposed directly to human eyes for safety concerns.
<br>[[File:KS0010 (4).jpg|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
<br>
This LED module is of high brightness because the lamp beads it carries is 3w. We can apply this module to Arduino projects. For example, intelligent robots can use this module for illumination purpose. <br>
'''Specification'''<br>
Please note that the LED light can't be exposed directly to human eyes for safety concerns.<br>
* Color temperature: 6000~7000K
* Luminous flux: 180~210lm
* Current: 700~750mA
* IO Type: Digital
* Supply Voltage: 3.3V to 5V
* Power: 3W
* Light angle: 140 degree
* Working temperature: -50~80℃
* Storage temperature: -50~100℃
* High power LED module, controlled by IO port microcontroller
* Great for Robot and search & rescue platform application


'''Specification:'''<br>
<br>
*Color temperature: 6000~7000K
'''Connection Diagram'''  
*Luminous flux: 180~210lm
<br>[[File:Ks0010.png|700px|frameless|thumb]]<br>
*Current: 700~750mA
*Power: 3W
*Light angle: 140 degree
*Working temperature: -50~80'C
*Storage temperature: -50~100'C
*High power LED module, controlled by IO port microcontroller
*Great for Robot and search & rescue platform application
*IO Type: Digital
*Supply Voltage: 3.3V to 5V
*Size: 40x28mm
*Weight: 6g


<br>


'''Connection Diagram:'''<br>
'''Sample Code''' <br>
<br>[[File:ks0068 3-2.png|500px|frameless|thumb]]<br>
 
'''Sample Code:'''<br>
 
<pre>
<pre>
*****************************************************************************
// the setup function runs once when you press reset or power the board
// the setup function runs once when you press reset or power the board
void setup() {
void setup() {
Line 169: Line 168:
   delay(1000);              // wait for a second
   delay(1000);              // wait for a second
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result'''<br>
Done wiring and powered up,upload well the code, both D13 led and the led on the module blink for one second then off, circularly.
<br>[[File:KS0349 3-2.png|800px|frameless|thumb]]<br>


=== '''Project 4: RGB LED module '''===
<br>
<br>[[File:ks0068 4-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
<br>
This is a full-color LED module, which contains 3 basic colors-red, green and blue. They can be seen as separate LED lights. After program, we can turn them on and off by sequence. We can also use PWM analog output to mix the three colors to generate different colors. <br>
=== '''Project 4: RGB LED '''===
 
'''Introduction''' <br>
This is a full-color LED module, which contains 3 basic colors-red, green and blue. They can be seen as separate LED lights. <br>
After programming, you can turn them on and off by sequence or can also use PWM analog output to mix three colors to generate different colors.  
<br>[[File:Ks0032-3.png|500px|frameless|thumb]]<br>


'''Specification:'''<br>
<br>
'''Specification'''<br>
*Color: red, green and blue  
*Color: red, green and blue  
*Brightness: High
*Brightness: High
*Voltage: 5V
*Voltage: 5V
*Input: digital level
*Input: digital level
*Size: 30 * 20mm
*Weight: 3g


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 4-2.png|500px|frameless|thumb]]<br>
'''Connection Diagram'''  
 
<br>[[File:0032.jpg|700px|frameless|thumb]]<br>  
'''Sample Code:'''<br>


<br>
'''Sample Code''' <br>
<pre>
<pre>
*****************************************************************************
int redpin = 11; //select the pin for the red LED
int redpin = 11; //select the pin for the red LED
int bluepin =10; // select the pin for the blue LED
int bluepin =10; // select the pin for the blue LED
Line 215: Line 220:
   analogWrite(9, 128-val);
   analogWrite(9, 128-val);
   delay(1);   
   delay(1);   
  }
}
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result''' <br>
Done uploading the code, you should see the RGB LED flashing with different colors.
<br>[[File:Ks0032-1.png|500px|frameless|thumb]]<br>


=== '''Project 5: RGB LED moduleAnalog temperature sensor '''===
<br>
<br>[[File:ks0068 5-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
=== '''Project 5: Analog Temperature '''===
This module is based on the working principle of a thermistor (resistance varies with temperature change in the environment). It can sense temperature change in its surrounding and send the data to the analog IO in the Arduino board. All we need to do is to convert the sensor output data to degrees Celsius temperature by simple programming and display it. It's both convenient and effective, and it’s widely applied in gardening, home alarm system and other devices. <br>
<br>
'''Introduction'''<br>
This module is based on the working principle of a thermistor (resistance varies with temperature change in the environment). <br>
It can sense temperature change in its surrounding and send the data to the analog IO in the Arduino board. <br>
All we need to do is to convert the sensor output data into degrees Celsius temperature via simple programming, finally to display it. <br>
It's both convenient and effective, thus it is widely applied in gardening, home alarm system and other devices.
<br>[[File:Ks0033.png|500px|frameless|thumb]]<br>


'''Specification:'''<br>
<br>
*Interface type: analog
'''Specification'''<br>
*Working voltage: 5V
*Interface Type: analog
*Temperature range: -55℃~315℃
*Working Voltage: 5V
*Size: 30*20mm
*Temperature Range: -55℃~315℃
*Weight: 3g


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 5-2.png|500px|frameless|thumb]]<br>
'''Connection Diagram''' <br>
<br>[[File:Ks0033-.png|700px|frameless|thumb]]<br>  


'''Sample Code:'''<br>
<br>
'''Sample Code'''<br>  
Copy and paste the below code to Arduino software.


<pre>
<pre>
*****************************************************************************
void setup()  
void setup()  
{Serial.begin(9600);
{Serial.begin(9600);
Line 249: Line 263:
Serial.println(sensorValue);
Serial.println(sensorValue);
   delay(1); }
   delay(1); }
We can see that the analog value is changing according to the temperature change in the environment. But it’s not very obvious. Let’s solve this by using the following equation. The value read from the serial port is similar to normal temperature, eg. The temperature right now is 30C.  
</pre>
 
<br>
The above code is only for analog value. <br>
You can see that the analog value is changing according to the temperature change in the environment. But it’s not very obvious.<br>
Let’s solve this by using the following equation. Then upload the code below to the Arduino board. The value read from the serial port is similar to normal temperature. <br>
e.g. The temperature right now is 30°C. <br>
 
<pre>
#include <math.h>
#include <math.h>
double Thermister(int RawADC) {
void setup()
double Temp;
{
Temp = log(((10240000/RawADC) - 10000));
  Serial.begin(9600);
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
}
Temp = Temp - 273.15; // Convert Kelvin to Celcius
void loop()
return Temp;
{
  double val=analogRead(0);
  double fenya=(val/1023)*5;
  double r=(5-fenya)/fenya*4700;
  Serial.println( 1/( log(r/10000) /3950 + 1/(25+273.15))-273.15);
  delay(1000);
}
}
void setup()
{Serial.begin(9600);
} void loop() { Serial.print(Thermister(analogRead(0))); // display Fahrenheit Serial.println("c"); delay(500); }
*******************************************************************************
</pre>
</pre>


<br>
'''Result'''
<br>[[File:KS0349 19-2.png|800px|frameless|thumb]]<br>
Done wiring and powered up, upload well the code, then open the serial monitor, you will see the current temperature value. Shown below.
<br>[[File:KS0349 19-3.png|900px|frameless|thumb]]<br>


=== '''Project 6: Photocell sensor '''===
<br>
<br>[[File:ks0068 6-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
=== '''Project 6: Photocell Sensor '''===
Photocell is commonly seen in our daily life and is mainly used in intelligent switch, also in common electronic design. To make it easier and more effective, we supply corresponding modules.<br>
<br>[[File:KS0349 21-1.png|500px|frameless|thumb]]<br>
Photocell is a semiconductor. It has features of high sensitivity, quick response, spectral characteristic, and R-value consistence, maintaining high stability and reliability in environment extremes such as high temperature, high humidity. It’s widely used in automatic control switch fields like cameras, garden solar lights, lawn lamps, money detectors, quartz clocks, music cups, gift boxes, mini night lights, sound and light control switches, etc. <br>


'''Specification:'''<br>
'''Introduction'''<br>
*Interface type: analog
Photocell is commonly seen in our daily life and is mainly used in intelligent switch, also in common electronic design. <br>
*Working voltage: 5V
To make it more easier and effective, we supply corresponding modules.
*Size: 30*20mm
Photocell is a semiconductor. It has features of high sensitivity, quick response, spectral characteristic, and R-value consistence, maintaining high stability and reliability in environment extremes such as high temperature, high humidity. <br>
*Weight: 3g
It’s widely used in automatic control switch fields like cameras, garden solar lights, lawn lamps, money detectors, quartz clocks, music cups, gift boxes, mini night lights, sound and light control switches, etc.


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 6-2.png|500px|frameless|thumb]]<br>
'''Specification'''<br>
*Interface Type: analog
*Working Voltage: 5V


'''Sample Code:'''<br>
<br>
'''Connection Diagram'''  
<br>[[File:Ks0028.png|700px|frameless|thumb]]<br>  


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
int sensorPin =A0 ;  
int sensorPin =A0 ;  
int value = 0;  
int value = 0;  
Line 293: Line 324:
{
{
  value = analogRead(sensorPin);  
  value = analogRead(sensorPin);  
 
Serial.println(value, DEC);  
Serial.println(value, DEC);  
 
delay(50); }
delay(50);  
 
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result'''
<br>[[File:KS0349 21-2.png|800px|frameless|thumb]]<br>
Done wiring and powered up, upload well the code, then open the serial monitor, if cover the photocell on the sensor with your hand, you will see the analog value decrease. Shown as below.
<br>[[File:KS0349 21-3.png|1000px|frameless|thumb]]<br>


=== '''Project 7: Analog Sound Sensor '''===  
<br>
<br>[[File:ks0068 7-1.png|500px|frameless|thumb]]<br>
=== '''Project 7: Analog Sound '''===  
 
<br>
'''Introduction:'''<br>
'''Introduction'''<br>
Analog Sound Sensor is typically used in detecting the loudness in ambient environment. The Arduino can collect its output signal by imitating the input interface. You can use it to make some interesting interactive works such as a voice operated switch.<br>
The keyestudio microphone sensor is typically used in detecting the loudness in ambient environment. The Arduino can collect its output signal by analog input interface. <br>
 
The S pin is analog output, that is voltage signal real-time output of microphone. The sensor comes with a potentiometer, so that you can turn it to adjust the signal gain.<br>
'''Specification:'''<br>
It also has a fixed hole so that you can mount the sensor on any other devices.
*Supply Voltage: 3.3V to 5V
You can use it to make some interactive works, such as a voice operated switch.
*Detecting sound intensity
<br>[[File:Ks0035(1).png|400px|frameless|thumb]]<br>
*Interface: Analog
*Size: 30*20mm
*Weight: 4g
 


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 7-2.png|500px|frameless|thumb]]<br>
'''Specification'''<br>
* Operating voltage: 3.3V-5V(DC)
* Operating current:  <10mA
* Interface:3PIN
* Output signal: Analog


'''Sample Code:'''<br>
<br>
'''Connection Diagram''' <br>
<br>[[File:Ks0035(2).png|700px|frameless|thumb]]<br>  


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
int sensorPin =A0 ;  // define analog port A0
void setup()
int value = 0;    //set value to 0
void setup()  
{
{
  Serial.begin(9600); // open serial port, set the baud rate to 9600 bps
Serial.begin(9600); //set the baud rate to 9600
}
}  
void loop()
void loop()  
{
{
      int val;
value = analogRead(sensorPin); //set the value as the value read from A0
      val=analogRead(0);   //connect mic sensor to Analog 0
Serial.println(value, DEC); //print the value and line wrap
      Serial.println(val,DEC);//print the sound value to serial       
delay(200); //delay 0.2S
      delay(100);
}  
}
</pre>
 
<br>
'''Test Result''' <br>
Connect it up and upload the code successfully, then open the serial monitor on the right upper corner of Arduino IDE.
<br>
The analog value will pop up on the monitor window. The greater the sound, the greater the analog value is.
<br>[[File:Ks0035(3).png|700px|frameless|thumb]]<br>


*******************************************************************************
<br>
</pre>


=== '''Project 8: Analog Rotation Sensor '''===  
=== '''Project 8: Analog Rotation Sensor '''===  
<br>[[File:ks0068 8-1.png|500px|frameless|thumb]]<br>
<br>[[File:KS0349 20-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
<br>
This analog Rotation Sensor is arduino compatible. It is based on a potentiometer. Its voltage can be subdivided into 1024, easy to be connected to Arduino with our sensor shield. Combined with other sensors, we can make interesting projects by reading the analog value from the IO port. <br>
'''Introduction'''<br>
This analog Rotation Sensor is arduino compatible. It is based on a potentiometer. Its voltage can be subdivided into 1024, easy to be connected to Arduino with our sensor shield. Combined with other sensors, we can make interesting projects by reading the analog value from the IO port.  


'''Specification:'''<br>
<br>
'''Specification'''<br>
*Supply Voltage: 3.3V to 5V
*Supply Voltage: 3.3V to 5V
*Interface: Analog
*Interface: Analog
*Size: 30*20mm
*Weight: 8g


<br>
'''Connection Diagram'''
<br>[[File:Ks0014.png|600px|frameless|thumb]]<br>


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 8-2.png|500px|frameless|thumb]]<br>
'''Sample Code'''  
 
'''Sample Code:'''<br>
 
<pre>
<pre>
*****************************************************************************
///Arduino Sample Code
void setup()
void setup()
{
{
Line 370: Line 414:
delay(100);
delay(100);
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result'''
<br>[[File:KS0349 20-2.png|800px|frameless|thumb]]<br>
Done wiring and powered up, upload well the above code, then open the serial monitor and set the baud rate as 9600, finally you will see the analog value. If rotate the knob on the rotation sensor, the value will be changed within 0-1023. Shown below.
<br>[[File:KS0349 20-3.png|800px|frameless|thumb]]<br>


=== '''Project 9: Passive Buzzer module '''===
<br>
<br>[[File:ks0068 9-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
=== '''Project 9: Passive Buzzer '''===
We can use Arduino to make many interactive works of which the most commonly used is acoustic-optic display. All the previous experiment has something to do with LED. However, the circuit in this experiment can produce sound. Normally, the experiment is done with a buzzer or a speaker while buzzer is simpler and easier to use. The buzzer we introduced here is a passive buzzer. It cannot be actuated by itself, but by external pulse frequencies. Different frequencies produce different sounds. We can use Arduino to code the melody of a song, which is actually quite fun and simple.  <br>
[[File:KS0019 (4).jpg|300px|frameless|right]]
 
'''Specification:'''<br>
*Working voltage: 3.3-5v
*Interface type: digital
*Size: 30*20mm
*Weight: 4g


'''Introduction'''<br>
We can use Arduino to make many interactive works of which the most commonly used is acoustic-optic display.  <br>
The circuit in this experiment can produce sound. Normally, the experiment is done with a buzzer or a speaker while buzzer is simpler and easier to use.  <br>
The buzzer we introduced here is a passive buzzer. It cannot be actuated by itself, but by external pulse frequencies. Different frequencies produce different sounds.  <br>
We can use Arduino to code the melody of a song, which is quite fun and simple.


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 9-2.png|500px|frameless|thumb]]<br>
'''Specification'''<br>
* Working voltage: 3.3-5v
* Interface type: digital


'''Sample Code:'''<br>
<br>
'''Connection Diagram'''  
<br>[[File:0019.png|600px|frameless|thumb]]<br>


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
int buzzer=3;//set digital IO pin of the buzzer
int buzzer=8;//set digital IO pin of the buzzer
void setup()  
void setup()  
{  
{  
Line 412: Line 463:
digitalWrite(buzzer,HIGH);// sound
digitalWrite(buzzer,HIGH);// sound
digitalWrite(buzzer,LOW);//not sound
digitalWrite(buzzer,LOW);//not sound
delay(2);//2ms delay  
delay(2);//2ms delay  
}
}  
}  
}  
}  
}
*******************************************************************************
</pre>
</pre>


After downloading the program, buzzer experiment will been finished.
<br>
'''Test Result'''<br>
After downloading the program, buzzer experiment is complete. You should hear the buzzer ringing.
<br>[[File:Ks0019-1-.png|600px|frameless|thumb]]<br>




=== '''Project 10: Digital Buzzer Module '''===
<br>
<br>[[File:ks0068 10-1.png|500px|frameless|thumb]]<br>
 
'''Introduction:'''<br>
Here is the simplest sound making module. You can use high/low level to drive it. Changing the frequency it buzzes can produce different sound. This module is widely used on your daily appliance, like PC, refrigerator, phones etc. And you can also create many interesting interactive project with this small but useful module. <br>
Just try it!! You will find the electronic sound it creates so fascinating.  <br>
 
'''Specification:'''<br>
*Working voltage: 3.3-5v
*Interface type: digital
*Size: 30*20mm
*Weight: 4g


=== '''Project 10: Digital Buzzer '''===
<br>
'''Introduction'''<br>
Here is the simplest sound making module. You can use high/low level to drive it. Changing the frequency it buzzes can produce different sound. This module is widely used on your daily appliance, like PC, refrigerator, phones etc. And you can also create many interesting interactive project with this small but useful module.
Just try it!! You will find the electronic sound it creates so fascinating.
<br>[[File:KS0349 5-1.png|500px|frameless|thumb]]<br>


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 10-2.png|500px|frameless|thumb]]<br>
'''Specification'''<br>
*Working Voltage: 3.3-5v
*Interface Type: digital


'''Sample Code:'''<br>
<br>
'''Connection Diagram'''  
<br>[[File:Ks0018-.png|600px|frameless|thumb]]<br>  


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
int buzzPin =  3;    //Connect Buzzer on Digital Pin3
int buzzPin =  3;    //Connect Buzzer on Digital Pin3
  void setup()   
  void setup()   
Line 456: Line 508:
   delay(1);         
   delay(1);         
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Test Result''' <br>
After uploading the code, you can hear the buzzer beep continually.
<br>[[File:Ks0018-1.png|600px|frameless|thumb]]<br>
<br>


=== '''Project 11: Digital Push Button '''===  
=== '''Project 11: Digital Push Button '''===  
<br>[[File:ks0068 11-1.png|500px|frameless|thumb]]<br>
<br>
 
'''Introduction'''<br>
'''Introduction:'''<br>
This is a basic button application module. Momentary Pushbutton Switch usually stays open. When it is pressed down, circuit connected; when it is released, it will bounce back to the status of disconnection.
This is a basic application module. You can simply plug it into an IO shield to have your first taste of Arduino. <br>
The module has three pins for easy connection. You can simply plug it into an IO shield to have your first try of Arduino.  
Advantages: <br>
<br>[[File:Ks0029-.png|700px|frameless|thumb]]<br>  
Wide voltage range from 3.3V to 5V <br>
Standard assembling structure (two 3mm diameter holes with multiple of 5mm as distance from center) <br>
Easily recognizable interfaces of sensors ("A" for analog and "D" for digital) <br>
Icons illustrate sensor function clearly <br>
High quality connector <br>
Immersion gold surface <br>
 
 
'''Specification:'''<br>
*Supply Voltage: 3.3V to 5V
*Easy to 'plug and operate'
*Large button keypad and high-quality first-class cap
*Achieve interesting and interactive work
*Interface: Digital
*Size: 30*20mm
*Weight: 4g
 


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 11-2.png|500px|frameless|thumb]]<br>
'''Details'''<br>
* Interface: Digital
* Supply Voltage: 3.3V to 5V
* Easy to plug and operate
* Large button keypad and high-quality button cap
* Standard assembling structure
* Easily recognizable pins
* Icons illustrate sensor function clearly
* Achieve interactive works


'''Sample Code:'''<br>
<br>
'''Connection Diagram'''  
<br>[[File:Ks0029.png|700px|frameless|thumb]]<br>  


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
/* # When you push the digital button, the Led 13 on the board will turn on. Otherwise,the led turns off.
/* # When you push the digital button, the Led 13 on the board will turn on. Otherwise,the led turns off.
*/
*/
Line 506: Line 557:
     digitalWrite(ledPin, HIGH); // turn LED ON
     digitalWrite(ledPin, HIGH); // turn LED ON
   }
   }
  }
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result'''<br>
When you push the digital button, the Led 13 on UNO board will be on. When release the button,the led is off. Shown as below.
<br>[[File:KS0349 7-3.png|800px|frameless|thumb]]<br>


<br>
=== '''Project 12: Digital Tilt Sensor '''===  
=== '''Project 12: Digital Tilt Sensor '''===  
<br>[[File:ks0068 12-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
'''Introduction'''<br>
Tilt Sensor is a digital tilt switch. It can be used as a simple tilt sensor. Simplly plug it to our IO/Sensor shield; you can make amazing interactive projects. With dedicated sensor shield and Arduino, you can achieve interesting and interactive work. <br>
Tilt sensor is a digital tilt switch. It can be used as a simple tilt sensor.  
 
Tilt sensors (tilt ball switch) allow you to detect orientation or inclination. They are small, inexpensive, low-power and easy-to-use.
 
Simply connect the sensor to our IO/Sensor shield, so you can make amazing interactive projects.  
'''Specification:'''<br>
[[File:KS0025 (3).jpg|500px|frameless|thumb]]
<br>
'''Specification'''<br>
*Supply Voltage: 3.3V to 5V
*Supply Voltage: 3.3V to 5V
*Interface: Digital
*Interface: Digital
*Size: 30*20mm
*Weight: 3g
'''Connection Diagram:'''<br>
<br>[[File:ks0068 12-2.png|500px|frameless|thumb]]<br>


'''Sample Code:'''<br>
<br>
'''Connection Diagram'''  
<br>[[File:Ks0025.png|700px|frameless|thumb]]<br>  


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
int ledPin = 13;                // Connect LED to pin 13
int ledPin = 13;                // Connect LED to pin 13
int switcher = 3;                // Connect Tilt sensor to Pin3
int switcher = 3;                // Connect Tilt sensor to Pin3
Line 552: Line 605:
     }
     }
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result''' <br>
Upload the code to the board. Then tilt the sensor, you will see the led on the sensor is turned on. Shown as below.
<br>[[File:KS0349 14-3.png|800px|frameless|thumb]]<br>


=== '''Project 13: Photo interrupter module '''===
<br>
<br>[[File:ks0068 13-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
=== '''Project 13: Photo Interrupter '''===
Upright part of this sensor is an infrared emitter and on the other side, it’s a shielded infrared detector. By emitting a beam of infrared light from one end to other end, the sensor can detect an object when it passes through the beam. It is used for many applications including optical limit switches, pellet dispensing, general object detection, etc. <br>
<br>[[File:KS0349 11-1.png|500px|frameless|thumb]]<br>


'''Introduction'''<br>
Upright part of this sensor is an infrared emitter and on the other side, it’s a shielded infrared detector. By emitting a beam of infrared light from one end to other end, the sensor can detect an object when it passes through the beam. It is used for many applications including optical limit switches, pellet dispensing, general object detection, etc.


'''Specification:'''<br>
<br>
'''Specification'''<br>
*Supply Voltage: 3.3V to 5V
*Supply Voltage: 3.3V to 5V
*Interface: Digital
*Interface: Digital
*Size: 30*20mm
*Weight: 3g


<br>
'''Connection Diagram'''
<br>[[File:Ks0009.png|700px|frameless|thumb]]<br>


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 13-2.png|500px|frameless|thumb]]<br>
'''Sample Code'''  
 
'''Sample Code:'''<br>
 
<pre>
<pre>
*****************************************************************************
// photo interrupter module
// photo interrupter module
   
   
Line 599: Line 654:
   }
   }
}
}
*******************************************************************************
</pre>
</pre>


<br>
=== '''Project 14: Capacitive Touch '''===
<br>[[File:KS0349 15-1.png|500px|frameless|thumb]]<br>


=== '''Project 14: Capacitive Touch Sensor '''===
'''Introduction'''<br>
<br>[[File:ks0068 14-1.png|500px|frameless|thumb]]<br>
Are you tired of clicking mechanic button? Well, try our capacitive touch sensor. You can find touch sensors mostly used on electronic device. So upgrade your Arduino project with our new version touch sensor and make it cool!!<br>
 
This little sensor can "feel" people and metal touch and feedback a high/low voltage level. Even isolated by some cloth and paper, it can still feel the touch. Its sensitivity decreases as isolation layer gets thicker.  
'''Introduction:'''<br>
Are you tired of clicking mechanic button? Well, try our capacitive touch sensor. We can find touch sensors mostly on electronic device. So upgrade your Arduino project with our new version touch sensor and make it cool!! <br>
This little sensor can "feel" people and metal touch and feedback a high/low voltage level. Even isolated by some cloth and paper, it can still feel the touch. Its sensetivity decrease as isolation layer gets thicker. For detail of usage, please check our wiki. To perfect user’s experience of our sensor module, we made following improvements. <br>
 


'''Specification:'''<br>
<br>
'''Specification'''<br>
*Supply Voltage: 3.3V to 5V
*Supply Voltage: 3.3V to 5V
*Interface: Digital
*Interface: Digital
*Size: 30*20mm
*Weight: 3g
'''Connection Diagram:'''<br>
<br>[[File:ks0068 14-2.png|500px|frameless|thumb]]<br>


'''Sample Code:'''<br>
<br>
'''Connection Diagram'''  
<br>[[File:Ks0031-1.png|700px|frameless|thumb]]<br>  


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
int ledPin = 13;                // Connect LED on pin 13, or use the onboard one
int ledPin = 13;                // Connect LED on pin 13, or use the onboard one
int KEY = 2;                // Connect Touch sensor on Digital Pin 2
int KEY = 2;                // Connect Touch sensor on Digital Pin 2
Line 641: Line 692:
     }
     }
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result''' <br>
Done wiring and powered up, upload well the code, then touch the sensor with your finger,  both D2 led on the sensor and D13 indicator on UNO board are on. Otherwise, those two indicators are turned off.
<br>[[File:Ks0031-2.png|800px|frameless|thumb]]<br>


=== '''Project 15: Knock Sensor Module '''===  
<br>
<br>[[File:ks0068 15-1.png|500px|frameless|thumb]]<br>
=== '''Project 15: Knock Module '''===  
 
This is a knock sensor module. When you knock it, it can send a momentary signal. You can combine it with Arduino to make some interesting experiment, e.g. electronic drum.
'''Introduction:'''<br>
* Working voltage: 5V
This module is a knock sensor. When you knock it, it can send a momentary signal. We can combine it with Arduino to make some interesting experiment, e.g. electronic drum. <br>
<br>[[File:Ks0024.png|400px|frameless|thumb]]<br>
 
 
'''Specification:'''<br>
*Working voltage: 5V
*Size: 30*20mm
*Weight: 3g
 
 
'''Connection Diagram:'''<br>
<br>[[File:ks0068 15-2.png|500px|frameless|thumb]]<br>


'''Sample Code:'''<br>
<br>
'''Connection Diagram'''  
<br>[[File:Ks0024-.png|700px|frameless|thumb]]<br>  


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
Sample Code
int Led=13;//define LED interface
int Led=13;//define LED interface
int Shock=3//define knock sensor interface
int Shock=3;//define knock sensor interface
;int val;//define digital variable val
int val;//define digital variable val
void setup()
void setup()
{
{
Line 686: Line 732:
}
}
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result''' <br>
Upload the code to the board. When the sensor detects a knock signal, both the led on the sensor and led 13 on the UNO board are turned on.


=== '''Project 16: Hall Magnetic Sensor '''===
<br>
<br>[[File:ks0068 16-1.png|500px|frameless|thumb]]<br>
'''Extension'''<br>
You can extend to connect an external LED; when knock the sensor, the external LED will turn on. For example:<br>
<br>[[File:图片-KS0024.png|500px|frameless|thumb]]<br>  


'''Introduction:'''<br>
<br>
This is a Magnetic Induction Sensor. It senses the magnetic materials within a detection range up to 3cm. The detection range and the strength of the magnetic field are proportional. The output is digital on/off. This sensor uses the SFE Reed Switch - Magnetic Field Sensor. <br>


<br>
=== '''Project 16: Hall Magnetic Sensor '''===


'''Specification:'''<br>
'''Introduction'''<br>
*Sensing magnetic materials
This is a Magnetic Induction Sensor. It senses the magnetic materials within a detection range up to 3cm. The detection range and the strength of the magnetic field are proportional.The output is digital on/off.
*Detection range: up to 3cm
This sensor uses the SFE Reed Switch - Magnetic Field Sensor.<br>
*Output: digital on/off
<br>[[File:KS0020 (2).jpg|500px|frameless|thumb]]<br>
*Detection range and magnetic field strength are proportional
*Size: 30*20mm
*Weight: 3g


<br>
'''Specification'''<br>
* Sensing magnetic materials
* Detection range: up to 3cm
* Output: digital on/off
* Detection range and magnetic field strength are proportional


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 16-2.png|500px|frameless|thumb]]<br>
'''Connection Diagram'''  
 
<br>[[File:Ks0020.png|700px|frameless|thumb]]<br>  
'''Sample Code:'''<br>


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
int ledPin = 13;                // choose the pin for the LED
int ledPin = 13;                // choose the pin for the LED
int inputPin = 3;              // Connect sensor to input pin 3  
int inputPin = 3;              // Connect sensor to input pin 3  
Line 719: Line 773:
void setup() {
void setup() {
   pinMode(ledPin, OUTPUT);      // declare LED as output
   pinMode(ledPin, OUTPUT);      // declare LED as output
   pinMode(inputPin, INPUT);    // declare pushbutton as input
   pinMode(inputPin, INPUT);    // declare push button as input
}
}
   
   
Line 730: Line 784:
   }
   }
}
}
*******************************************************************************
</pre>
</pre>


=== '''Project 17: Line Tracking Sensor '''===
<br>
<br>[[File:ks0068 17-1.png|500px|frameless|thumb]]<br>
'''Result''' <br>
Wire it up and upload well the code to board, you will see that D13 indicator on UNO board is off, and led on the module is also off.
But if put a magnetic ball close to the hall module, you will see the D13 indicator on UNO board is turned on, and led on the module is also turned on.
<br>[[File:KS0349 12-3.png|600px|frameless|thumb]]<br>


'''Introduction:'''<br>
<br>
This Line Tracking Sensor can detect white lines in black and black lines in white. The single line-tracking signal provides a stable output signal TTL for a more accurate and more stable line. Multi-channel option can be easily achieved by installing required line-tracking robot sensors. <br>


<br>
=== '''Project 17: Line Tracking Sensor '''===


'''Specification:'''<br>
'''Introduction'''<br>
*Power supply: +5V
This Line Tracking Sensor can detect white lines in black and black lines in white. The single line-tracking signal provides a stable output signal TTL for a more accurate and more stable line. <br>
*Operating current: <10mA
Multi-channel option can be easily achieved by installing required line-tracking robot sensors.
*Operating temperature range: 0°C ~ + 50°C
<br>[[File:KS0349 9-1.png|500px|frameless|thumb]]<br>
*Output interface: 3-wire interface (1 - signal, 2 - power, 3 - power supply negative)
*Output Level: TTL level
*Size: 41.7*10.7mm
*Weight: 3g


<br>
'''Specification'''<br>
* Power supply: +5V
* Operating current: <10mA
* Operating temperature range: 0°C ~ + 50°C
* Output interface: 3-PIN (1 - signal ; 2 - power ; 3 - power supply negative)
* Output Level: TTL level


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 17-2.png|500px|frameless|thumb]]<br>
'''Connection Diagram'''  
 
<br>[[File:Ks0050-1.png|700px|frameless|thumb]]<br>  
'''Sample Code:'''<br>


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
///Arduino Sample Code
///Arduino Sample Code
void setup()
void setup()
Line 767: Line 827:
   delay(500);
   delay(500);
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result '''<br>
Done uploading the code to board, open the serial monitor and set the baud rate as 9600, then you can see the data from the sensor. Shown below.
<br>[[File:KS0349 9-2.png|600px|frameless|thumb]]<br>


=== '''Project 18: Infrared Obstacle Avoidance Sensor '''===
<br>[[File:ks0068 18-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
<br>
Infrared obstacle avoidance sensor is equipped with distance adjustment function and is especially designed for wheeled robots. This sensor has strong adaptability to ambient light and is of high precision. It has a pair of infrared transmitting and receiving tube. When infrared ray launched by the transmitting tube encounters an obstacle (its reflector), the infrared ray is reflected to the receiving tube, and the indicator will light up; the signal output interface outputs digital signal. We can adjust the detection distance through the potentiometer knob ( effective distance: 2~40cm, working Voltage: 3.3V-5V ). Thanks to a wide voltage range, this sensor can work steadily even under fluctuating power supply voltage and is suitable for the use of various micro-controllers,  Arduino controllers and BS2 controllers. A robot mounted with the sensor can sense changes in the environment. <br>


=== '''Project 18: Infrared Obstacle Avoidance '''===
<br>[[File:KS0349 10-1.png|500px|frameless|thumb]]<br>


'''Specification:'''<br>
'''Introduction'''<br>
*Working voltage: DC 3.3V-5V
Infrared obstacle avoidance sensor is equipped with distance adjustment function and is especially designed for wheeled robots. <br>
*Working current: ≥20mA
This sensor has strong adaptability to ambient light and is of high precision. It has a pair of infrared transmitting and receiving tube.
*Working temperature: -10℃—+50℃
When infrared ray launched by the transmitting tube encounters an obstacle (its reflector), the infrared ray is reflected to the receiving tube, and the indicator will light up; the signal output interface outputs digital signal. <br>
*Detection distance: 2-40cm
*IO Interface: 4 wire interface (-/+/S/EN)
*Output signal: TTL voltage
*Accommodation mode: Multi-circle resistance regulation
*Effective Angle: 35°
*Size: 41.7*16.7mm
*Weight: 5g


We can adjust the detection distance through the potentiometer knob (effective distance: 2~40cm, working Voltage: 3.3V-5V ). <br>
Thanks to a wide voltage range, this sensor can work steadily even under fluctuating power supply voltage and is suitable for the use of various micro-controllers,Arduino controllers and BS2 controllers.
A robot mounted with the sensor can sense changes in the environment.<br>


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 18-2.png|500px|frameless|thumb]]<br>
'''Specification'''<br>
* Working voltage: DC 3.3V-5V
* Working current: ≥20mA
* Working temperature: -10℃ to+50℃
* Detection distance: 2-40cm
* IO Interface: 4 PIN (-/+/S/EN)
* Output signal: TTL voltage
* Accommodation mode: Multi-circle resistance regulation
* Effective Angle: 35°


'''Sample Code:'''<br>
<br>
'''Connection Diagram'''  
<br>[[File:0051.png|700px|frameless|thumb]]<br>  


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
const int sensorPin = 3;    // the number of the sensor pin
const int sensorPin = 2;    // the number of the sensor pin
const int ledPin =  13;      // the number of the LED pin
const int ledPin =  13;      // the number of the LED pin
int sensorState = 0;        // variable for reading the sensor status
int sensorState = 0;        // variable for reading the sensor status
Line 812: Line 881:
   }  
   }  
   else {
   else {
       digitalWrite(ledPin, LOW);  
       digitalWrite(ledPin, LOW);  
   }
   }
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result''' <br>
Done uploading the code to board, you can see the led on both UNO board and obstacle detector sensor is turned on.<br>
If we put a foam block in front of the sensor, this time when sensor detects the obstacle, sled on the sensor will be turned on.
<br>[[File:KS0349 10-3.png|500px|frameless|thumb]]<br>
<br>


=== '''Project 19: PIR Motion Sensor '''===  
=== '''Project 19: PIR Motion Sensor '''===  
<br>[[File:ks0068 19-1.png|500px|frameless|thumb]]<br>
<br>[[File:KS0349 18-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
'''Introduction:'''<br>
Pyroelectric infrared motion sensor can detect infrared signals from a moving person or moving animal, and output switching signals. It can be applied to a variety of occasions to detect the movement of human body. Conventional pyroelectric infrared sensors require body pyroelectric infrared detector, professional chip, complex peripheral circuit, so the size is bigger, with complex circuit, and lower reliability. Now we launch this new pyroelectric infrared motion sensor, specially designed for Arduino. It uses an integrated digital body pyroelectric infrared sensor, has smaller size, higher reliability, lower power consumption and simpler peripheral circuit. <br>
Pyroelectric infrared motion sensor can detect infrared signals from a moving person or moving animal, and output switching signals. It can be applied to a variety of occasions to detect the movement of human body. Conventional pyroelectric infrared sensors require body pyroelectric infrared detector, professional chip, complex peripheral circuit, so the size is bigger, with complex circuit, and lower reliability. Now we launch this new pyroelectric infrared motion sensor, specially designed for Arduino. It uses an integrated digital body pyroelectric infrared sensor, has smaller size, higher reliability, lower power consumption and simpler peripheral circuit. <br>


 
<br>
'''Specification:'''<br>
'''Specification:'''<br>
*Input Voltage: 3.3 ~ 5V, 6V Maximum
*Input Voltage: 3.3 ~ 5V, 6V Maximum
Line 837: Line 911:
*Output Indicator LED (When output HIGH, it will be ON)
*Output Indicator LED (When output HIGH, it will be ON)
*Pin limit current: 100mA
*Pin limit current: 100mA
*Size: 30*20mm
*Weight: 4g


<br>
'''Connection Diagram:'''<br>
'''Connection Diagram:'''<br>
<br>[[File:ks0068 19-2.png|500px|frameless|thumb]]<br>
Connect the S pin of module to Digital 3 of UNO board, connect the negative pin to GND port, positive pin to 5V port.
<br>[[Image:Ks0052.jpg|700px|frameless]]<br>


<br>
'''Sample Code:'''<br>
'''Sample Code:'''<br>
<pre>
<pre>
*****************************************************************************
byte sensorPin = 3;
byte sensorPin = 3;
byte indicator = 13;
byte indicator = 13;
Line 866: Line 938:
   delay(500);
   delay(500);
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result''' <br>
Done wiring and powered up, upload well the code, if the sensor detects someone moving nearby, D13 indicator on UNO board will light up, and "Somebody is in this area!" is displayed on the serial monitor. <br>
If no movement, D13 indicator on UNO board not lights, and "No one!" is displayed on the serial monitor.
<br>[[Image:KS0335-4.jpg|800px|frameless]]<br>
<br>
=== '''Project 20: Flame Sensor '''===  
=== '''Project 20: Flame Sensor '''===  
<br>[[File:ks0068 20-1.png|500px|frameless|thumb]]<br>
<br>[[File:KS0349 16-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
'''Introduction'''<br>
This flame sensor can be used to detect fire or other lights whose wavelength stands at 760 nm ~ 1100 nm. In the fire-fighting robot game, the flame plays an important role in the probe, which can be used as the robot's eyes to find fire source. <br>
This flame sensor can be used to detect fire or other lights with wavelength stands at 760nm ~ 1100nm. <br>
In the fire-fighting robot game, the flame plays an important role in the probe, which can be used as the robot's eyes to find fire source.


 
<br>
'''Specification:'''<br>
'''Specification'''<br>
*Supply Voltage: 3.3V to 5V
*Supply Voltage: 3.3V to 5V
*Detection range: 20cm (4.8V) ~ 100cm (1V)
*Detection Range: 20cm (4.8V) ~ 100cm (1V)
*Rang of Spectral Bandwidth: 760nm to 1100nm
*Rang of Spectral Bandwidth: 760nm to 1100nm
*Operating temperature: -25℃to 85℃
*Operating Temperature: -25℃ to 85℃
*Interface: digital
*Interface: Digital
*Size: 44*16.7mm
*Weight: 4g


<br>
'''Connection Diagram''' <br>
Connect the D0 pin to digital 2, GND pin to GND port, VCC pin to 5V port.
<br>[[File:Ks0036-1.png|700px|frameless|thumb]]<br>


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 20-2.png|500px|frameless|thumb]]<br>
'''Sample Code'''  
 
'''Sample Code:'''<br>
 
<pre>
<pre>
*****************************************************************************
const int flamePin = 2;    // the number of the flame pin
const int flamePin = 2;    // the number of the flame pin
const int ledPin =  13;      // the number of the LED pin
const int ledPin =  13;      // the number of the LED pin
Line 907: Line 984:
State = digitalRead(flamePin);
State = digitalRead(flamePin);
   if (State == HIGH) {     
   if (State == HIGH) {     
     // turn LED on:     
     // turn LED on:     
     digitalWrite(ledPin, HIGH);   
     digitalWrite(ledPin, HIGH);   
Line 914: Line 990:
     // turn LED off:
     // turn LED off:
     digitalWrite(ledPin, LOW);  
     digitalWrite(ledPin, LOW);  
  }
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result''' <br>
Done wiring and powered up, upload well the code to the board.
Then if you put a lighter close to the sensor, when the sensor detects the flame, another led on the sensor is turned on.
<br>[[File:KS0349 16-3.png|800px|frameless|thumb]]<br>
<br>
<br>
=== '''Project 21: Vibration Sensor '''===  
=== '''Project 21: Vibration Sensor '''===  
<br>[[File:ks0068 21-1.png|500px|frameless|thumb]]<br>
<br>[[File:KS0037 (2).jpg|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
'''Introduction'''<br>
What's the simplest way to check vibration with Arduino? Well, use a vibration sensor from keyestudio. You can directly plug it on our sensor Shield V5, vibrate this sensor, and Arduino can receive a digital signal, making it easy to make computation and programs in Arduino.<br>
What's the simplest way to check vibration with Arduino? Well, use a vibration sensor from keyestudio. You can directly plug it on our sensor Shield V5, vibrate this sensor, and Arduino can receive a digital signal, making it easy to make computation and programs in Arduino.<br>
Despite its simplicity, you can make full use of it with creative thinking, step counting, and crash warning light etc.  <br>
Despite its simplicity, you can make full use of it with creative thinking, step counting, and crash warning light etc.  <br>


 
<br>
'''Specification:'''<br>
'''Specification:'''<br>
*IO Type: Digital
*IO Type: Digital
*Supply Voltage: 3.3V to 5V
*Supply Voltage: 3.3V to 5V
*Size: 40.7*16.7mm
*Weight: 5g


<br>
'''Connection Diagram:'''<br>
'''Connection Diagram:'''<br>
<br>[[File:ks0068 21-2.png|500px|frameless|thumb]]<br>
<br>[[File:Ks0037.png|700px|frameless|thumb]]<br>  
 
'''Sample Code:'''<br>


<br>
'''Sample Code:'''
<pre>
<pre>
*****************************************************************************
#define SensorLED    13
#define SensorLED    13
#define SensorINPUT  3  //Connect the sensor to digital Pin 3 which is Interrupts 1.
#define SensorINPUT  3  //Connect the sensor to digital Pin 3 which is Interrupts 1.
Line 964: Line 1,044:
{  state++;
{  state++;
}
}
*******************************************************************************
</pre>
</pre>


<br>


=== '''Project 22: Analog Gas Sensor '''===  
=== '''Project 22: Analog Gas Sensor '''===  
<br>[[File:ks0068 22-1.png|500px|frameless|thumb]]<br>
<br>[[File:KS0349 25-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
'''Introduction'''<br>
This analog gas sensor - MQ2 is used in gas leakage detecting equipment in consumer electronics and industrial markets. This sensor is suitable for detecting LPG, I-butane, propane, methane, alcohol, Hydrogen and smoke. It has high sensitivity and quick response. In addition, the sensitivity can be adjusted by the potentiometer.  <br>
This analog gas sensor - MQ2 is used in gas leakage detecting equipment in consumer electronics and industrial markets. This sensor is suitable for detecting LPG, I-butane, propane, methane, alcohol, Hydrogen and smoke. It has high sensitivity and quick response. In addition, the sensitivity can be adjusted by the potentiometer.  <br>


 
<br>
'''Specification:'''<br>
'''Specification'''<br>
*Power supply: 5V
*Power supply: 5V
*Interface type: Analog
*Interface type: Analog
Line 982: Line 1,062:
*Simple drive circuit
*Simple drive circuit
*Stable and long lifespan
*Stable and long lifespan
*Size: 49.7*20mm
*Weight: 8g


<br>
'''Connection Diagram'''<br>
<br>[[File:Ks0040-1.png|700px|frameless|thumb]]<br>


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 22-2.png|500px|frameless|thumb]]<br>
'''Sample Code'''<br>
 
'''Sample Code:'''<br>
 
<pre>
<pre>
*****************************************************************************
///Arduino Sample Code
///Arduino Sample Code
void setup()
void setup()
Line 1,005: Line 1,082:
delay(100);
delay(100);
}
}
*******************************************************************************
</pre>
</pre>
<br>
'''Result''' <br>
Done wiring and powered up, upload well the code, then open the serial monitor and set the baud rate as 9600, you will see the analog value. <br>
When detecting the gas, the value will make a change.
<br>[[File:KS0349 25-3.png|600px|frameless|thumb]]<br>
<br>


=== '''Project 23: Analog Alcohol Sensor '''===  
=== '''Project 23: Analog Alcohol Sensor '''===  
<br>[[File:ks0068 23-1.png|500px|frameless|thumb]]<br>
<br>[[File:KS0349 26-1.png|500px|frameless|thumb]]<br>
 
'''Introduction:'''<br>
This analog gas sensor - MQ3 is suitable for detecting alcohol. It can be used in a Breath analyzer. Also it has high sensitivity to alcohol and low sensitivity to Benzine. The sensitivity can be adjusted by the potentiometer.  <br>


'''Introduction'''<br>
This analog gas sensor - MQ3 is suitable for detecting alcohol. It can be used in a breath analyzer. <br>
It has good selectivity because it has higher sensitivity to alcohol and lower sensitivity to Benzine. <br>
The sensitivity can be adjusted by rotating the potentiometer.<br>


'''Specification:'''<br>
<br>
*Power supply: 5V
'''Specification'''<br>
*Interface type: Analog
*Power Supply: 5V
*Interface Type: Analog
*Quick response and High sensitivity
*Quick response and High sensitivity
Simple drive circuit
*Simple drive circuit
*Stable and long service life
*Stable and long service life
*Size: 49.7*20mm
*Weight: 6g


<br>
'''Connection Diagram'''
<br>[[File:Ks0040-2.png|700px|frameless|thumb]]<br>


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 23-2.png|500px|frameless|thumb]]<br>
'''Sample Code'''  
 
'''Sample Code:'''<br>
 
<pre>
<pre>
*****************************************************************************
///Arduino Sample Code
///Arduino Sample Code
void setup()
void setup()
Line 1,044: Line 1,127:
delay(100);
delay(100);
}
}
*******************************************************************************
</pre>
</pre>


=== '''Project 24: Digital IR Transmitter Module '''===
<br>
<br>[[File:ks0068 24-1.png|500px|frameless|thumb]]<br>
'''Result'''  
<br>[[File:KS0349 26-2.png|600px|frameless|thumb]]<br>
Done wiring and powered up, upload well the code, then open the serial monitor and set the baud rate as 9600, you will see the analog value. <br>
When detecting the alcohol gas, the value will make a change.
<br>[[File:KS0349 26-3.png|600px|frameless|thumb]]<br>
 
 
<br>


'''Introduction:'''<br>
=== '''Project 24: Digital IR Transmitter '''===
IR Transmitter Module is designed for IR communication which is widely used for operating the television device from a short line-of-sight distance. The remote control is usually contracted to remote.<br>
Since infrared (IR) remote controls use light, they require line of sight to operate the destination device. The signal can, however, be reflected by mirrors, just like any other light source.<br>
If operation is required where no line of sight is possible, for instance when controlling equipment in another room or installed in a cabinet, many brands of IR extenders are available for this on the market. Most of these have an IR receiver, picking up the IR signal and relaying it via radio waves to the remote part, which has an IR transmitter mimicking the original IR control.<br>
Infrared receivers also tend to have a more or less limited operating angle, which mainly depends on the optical characteristics of the phototransistor. However, it’s easy to increase the operating angle using a matte transparent object in front of the receiver.<br>


'''Introduction'''<br>
IR Transmitter Module is designed for IR communication which is widely used for operating the television device from a short line-of-sight distance. The remote control is usually contracted to remote. <br>
Since infrared (IR) remote controls use light, they require line of sight to operate the destination device. The signal can, however, be reflected by mirrors, just like any other light sources.  <br>
If operation is required where no line of sight is possible, for instance when controlling equipment in another room or installed in a cabinet, many brands of IR extenders are available for this on the market. Most of these have an IR receiver, picking up the IR signal and relaying it via radio waves to the remote part, which has an IR transmitter mimicking the original IR control. <br>
Infrared receivers also tend to have a more or less limited operating angle, which mainly depends on the optical characteristics of the phototransistor. However, it’s easy to increase the operating angle using a matte transparent object in front of the receiver.
<br>[[File:KS0027 (5).jpg|500px|frameless|thumb]]<br>


'''Specification:'''<br>
<br>
'''Specification'''<br>
*Power Supply: 3-5V
*Power Supply: 3-5V
*Infrared center frequency: 850nm-940nm
*Infrared Center Frequency: 850nm-940nm
*Infrared emission angle: about 20degree
*Infrared Emission Angle: about 20degree
*Infrared emission distance: about 1.3m (5V 38Khz)
*Infrared Emission Distance: about 1.3m (5V 38Khz)
*Interface socket: JST PH2.0
*Mounting Hole: inner diameter is 3.2mm, spacing is 15mm
*Mounting hole: inner diameter is 3.2mm, spacing is 15mm
*Size: 35*20mm
*Weight: 3g


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 24-2.png|500px|frameless|thumb]]<br>
'''Connection Diagram'''  
 
<br>[[File:Ks0027.png|700px|frameless|thumb]]<br>  
'''Sample Code:'''<br>


<br>
'''Sample Code 1:'''
<pre>
<pre>
*****************************************************************************
int led = 3;
int led = 3;
void setup() {                 
void setup() {                 
Line 1,080: Line 1,169:
void loop() {
void loop() {
   digitalWrite(led, HIGH);   
   digitalWrite(led, HIGH);   
   delay(1000);               
   delay(1000);               
   digitalWrite(led, LOW);   
   digitalWrite(led, LOW);   
   delay(1000); }
   delay(1000);  
}
</pre>
 
<br>
In the darkness of the environment, you are going to see blinking blue light on phone's screen when using camera to shoot the infrared LED.<br>
Upload well the above code to the board, the led on the sensor will blink red light.<br>
In the following, let’s move on to an interactive example between IR receiver and IR transmitter module.
 


<br>In the darkness of the environment, you are going to see blinking blue light on phone's screen when using camera to shoot the infrared LED.
<br>
*******************************************************************************
'''Infrared Remote/Communication:'''<br>
</pre>


'''Infrared remote/communication:'''<br>
'''Hardware List'''<br>
*Hardware List
*UNO R3 x2
*UNO R3 x2
*Digital IR Receiver x1
*Digital IR Receiver x1
*IR Transmitter Module x1
*IR Transmitter Module x1
*Get Arduino library [https://github.com/z3t0/Arduino-IRremote](Arduino-IRremote) and install it


'''Connection Diagram:'''<br>
Get Arduino library [https://github.com/z3t0/Arduino-IRremote Arduino-IRremote] and install it. <br>
IR Transmitter: same as above, Notice: Arduino-IRremote only supports D3 as transmitter.<br>
 
<br>[[File:ks0068 24-3.png|500px|frameless|thumb]]<br>
<br>
<span style=color:red> Note: here if you have no two main boards, you can replace it with the breadboard for connection, may be more easier and convenient. <br>


IR Receiver: connet it to D11 port.<br>
<br>
<br>[[File:ks0068 24-4.png|500px|frameless|thumb]]<br>
'''Connection Diagram'''<br>
'''For IR Transmitter:''' <br>
<span style=color:red> Notice: Arduino-IRremote only supports D3 as transmitter. <br>
<br>[[File:Ks0027.png|700px|frameless|thumb]]<br>  


'''Sample Code:'''<br>
<br>
'''For IR Receiver:''' <br>
connect it to D11 port.
<br>[[File:Ks0027-2.png|700px|frameless|thumb]]<br>


<br>
'''Upload code 2 to the UNO connected with IR Transmitter:'''<br>
<pre>
<pre>
*****************************************************************************
Upload code to the UNO connected with IR Transmitter:
  #include <IRremote.h>
  #include <IRremote.h>
   IRsend irsend;
   IRsend irsend;
Line 1,117: Line 1,217:
   irsend.sendRC5(0x1, 8);  
   irsend.sendRC5(0x1, 8);  
     delay(200); }
     delay(200); }
</pre>
Upload code to the UNO connected with IR Receiver:
 
#include <IRremote.h>
 
<br>
'''Upload code 3 to the UNO connected with IR Receiver:'''<br>
<pre>
#include <IRremote.h>
  const int RECV_PIN = 11;
  const int RECV_PIN = 11;
  const int LED_PIN = 13;
  const int LED_PIN = 13;
Line 1,132: Line 1,236:
   { if ( results.bits > 0 )
   { if ( results.bits > 0 )
     {
     {
       int state;
       int state;
       if ( 0x1 == results.value )
       if ( 0x1 == results.value )
Line 1,145: Line 1,248:
     }
     }
   irrecv.resume();        // prepare to receive the next value
   irrecv.resume();        // prepare to receive the next value
   }}f)
   }}
</pre>
 


<br>Result The "L" LED of the shield connected with IR Receiver will blink when IR Receiver faces to IR Transmitter.
<br>
*******************************************************************************
'''Test Result''' <br>
</pre>
When IR Receiver module receives the infrared signal from IR Transmitter, D1 led on the IR Receiver module will blink.Shown as below figure.
<br>[[File:KS0349 34-5.png|800px|frameless|thumb]]<br>


=== '''Project 25: Digital IR Receiver Module  '''===
<br>
<br>[[File:ks0068 25-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
<br>
IR is widely used in remote control. With this IR receiver, Arduino project is able to receive command from any IR remoter controller if you have the right decoder. Well, it will be also easy to make your own IR controller using IR transmitter. <br>
=== '''Project 25: Digital IR Receiver '''===


'''Introduction'''<br>
IR is widely used in remote control. With this IR receiver, Arduino project is able to receive command from any IR remoter controllers if you have right decoder. Well, it will be also easy to make your own IR controller using IR transmitter.
<br>[[File:KS0026 (3).jpg|500px|frameless|thumb]]<br>


'''Specification:'''<br>
<br>
'''Specification'''<br>
*Power Supply: 5V
*Power Supply: 5V
*Interface:Digital
*Interface: Digital
*Modulate Frequency: 38Khz
*Modulation Frequency: 38Khz
*Module interface socket:JST PH2.0
*Size: 30*20mm
*Weight: 4g


Wiring Diagram <br>
<br>
The following image shows a suggested connection method. You may use any Digital I/O pin that is not in use by another device. <br>
'''Connection Diagram''' <br>
NOTE: In the sample code below Digital pin 11 is in use, you may either change your wiring or change the sample code to match. <br>
The following image shows a suggested connection method. You may use any Digital I/O pin that is not in use by another device.  
<br>[[File:Ks0026.png|700px|frameless|thumb]]<br>


<span style=color:red> '''NOTE:''' In the sample code below Digital pin 11 is in use, you may either change your wiring or change the sample code to match. <br>


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 24-4.png|500px|frameless|thumb]]<br>
'''Sample Code''' <br>
 
<span style=color:red> '''Note:''' before compiling the code, do remember to place the library into libraries directory of Arduino IDE. Otherwise, compiling will fail. <br>
'''Sample Code:'''<br>


<pre>
<pre>
*****************************************************************************
#include <IRremote.h>
#include <IRremote.h>
  int RECV_PIN = 11;
  int RECV_PIN = 11;
Line 1,185: Line 1,291:
{
{
   Serial.begin(9600);
   Serial.begin(9600);
   irrecv.enableIRIn(); // Start the receiver
   irrecv.enableIRIn(); // Start the receiver
}
}
Line 1,194: Line 1,299:
   }
   }
}
}
*******************************************************************************
</pre>
</pre>


IR Remote Library Includes some sample codes for sending and receiving.<br>
<br>
https://github.com/shirriff/Arduino-IRremote
<span style=color:red>
IR Remote Library includes some sample codes for sending and receiving: <br>
[https://github.com/shirriff/Arduino-IRremote IR Remote Library]
 
<br>
'''Result''' <br>
Done wiring and uploading the code, then control the IR receiver module by an infrared remote control, D1 led will flash. Shown as below.
<br>[[File:KS0349 33-4.png|600px|frameless|thumb]]<br>


=== '''Project 26: Rotary Encoder module  '''===
<br>
<br>[[File:ks0068 26-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
<br>
The rotary encoder can count the pulse outputting times during the process of its rotation in positive and reverse direction by rotating. This rotating counting is unlimited, not like potential counting. It can be restored to initial state to count from 0 with the button on rotary encoder. <br>
=== '''Project 26: Rotary Encoder '''===


'''Introduction'''<br>
The rotary encoder can count the pulse outputting times during the process of rotation in positive and reverse direction by rotating. <br>
This rotating counting is unlimited, not like potential counting. It can be restored to initial state to count from 0.
<br>[[File:KS0013 (3).jpg|500px|frameless|thumb]]<br>


'''Specification:'''<br>
<br>
'''Specification'''<br>
*Power Supply: 5V
*Power Supply: 5V
*Interface: Digital
*Interface: Digital
*Size: 30*20mm
*Weight: 7g


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 26-2.png|500px|frameless|thumb]]<br>
'''Connection Diagram'''  
 
<br>[[File:Ks0013-1.png|700px|frameless|thumb]]<br>
'''Sample Code:'''<br>


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
const int interruptA = 0;       
const int interruptA = 0;       
const int interruptB = 1;       
const int interruptB = 1;       
Line 1,238: Line 1,350:
   pinMode(DAT, INPUT);  
   pinMode(DAT, INPUT);  
   digitalWrite(3, HIGH);  // Pull High Restance  
   digitalWrite(3, HIGH);  // Pull High Restance  
  pinMode(BUTTON, INPUT);  
pinMode(BUTTON, INPUT);  
   digitalWrite(4, HIGH);  // Pull High Restance
   digitalWrite(4, HIGH);  // Pull High Restance
   pinMode(LED1, OUTPUT);  
   pinMode(LED1, OUTPUT);  
Line 1,244: Line 1,357:
   Serial.begin(9600);
   Serial.begin(9600);
  }
  }


void loop()  
void loop()  
Line 1,260: Line 1,374:
//-------------------------------------------
//-------------------------------------------
void RoteStateChanged() //When CLK  FALLING READ DAT
void RoteStateChanged() //When CLK  FALLING READ DAT
{
{
  if  (digitalRead(DAT)) // When DAT = HIGH IS FORWARD
  if  (digitalRead(DAT)) // When DAT = HIGH IS FORWARD
Line 1,277: Line 1,390:
   }
   }
}
}
*******************************************************************************
</pre>
</pre>


=== '''Project 27: LM35 Linear Temperature Sensor '''===
<br>
<br>[[File:ks0068 27-1.png|500px|frameless|thumb]]<br>
'''Result'''<br>
Wiring well and uploading the above code, you can rotate the encoder module to randomly control two LED modules on and off. <br>
When you rotate the encoder module, one LED module is turned on first but another one is off. If you continue to rotate the encoder module, one LED module becomes off while another one is turned on, repeatedly.
<br>[[File:Ks0013.png|700px|frameless|thumb]]<br>
 
<br>


'''Introduction:'''<br>
<br>
LM35 Linear Temperature Sensor is based on semiconductor LM35 temperature sensor. It can be used to detect ambient air temperature. This sensor offers a functional range among 0 degree Celsius to 100 degree Celsius. Sensitivity is 10mV per degree Celsius. The output voltage is proportional to the temperature.<br>
=== '''Project 27: LM35 Linear Temperature '''===
This sensor is commonly used as a temperature measurement sensor. It includes thermocouples, platinum resistance, and thermal resistance and temperature semiconductor chips. The chip is commonly used in high temperature measurement thermocouples. Platinum resistance temperature sensor is used in the measurement of 800 degrees Celsius, while the thermal resistance and semiconductor temperature sensor is suitable for measuring the temperature of 100-200 degrees or below, in which the application of a simple semiconductor temperature sensor is good in linearity and high in sensitivity. The LM35 linear temperature sensor and sensor-specific Arduino shield can be easily combined.<br>


'''Introduction'''<br>
LM35 Linear Temperature Sensor is based on semiconductor LM35 temperature sensor. It can be used to detect ambient air temperature. <br>
This sensor offers a functional range among 0 degree Celsius to 100 degree Celsius. Sensitivity is 10mV per degree Celsius. The output voltage is proportional to the temperature.<br>
This sensor is commonly used as a temperature measurement sensor. It includes thermocouples, platinum resistance, and thermal resistance and temperature semiconductor chips. <br>
The chip is commonly used in high temperature measurement thermocouples. Platinum resistance temperature sensor is used in the measurement of 800 degrees Celsius, while the thermal resistance and semiconductor temperature sensor is suitable for measuring the temperature of 100-200 degrees or below, in which the application of a simple semiconductor temperature sensor is good in linearity and high in sensitivity. The LM35 linear temperature sensor and sensor-specific Arduino shield can be easily combined.
<br>[[File:Ks0022-1.png|500px|frameless|thumb]]<br>


'''Specification:'''<br>
<br>
'''Specification'''<br>
*Based on the semiconductor LM35 temperature sensor
*Based on the semiconductor LM35 temperature sensor
*Can be used to detect ambient air temperature
*Can be used to detect ambient air temperature
*Sensitivity: 10mV per degree Celcius
*Sensitivity: 10mV per degree Celcius
*Functional range: 0 degree Celsius to 100 degree Celsius
*Functional Range: 0 degree Celsius to 100 degree Celsius
*Size: 30*20mm
*Weight: 3g
 


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 27-2.png|500px|frameless|thumb]]<br>
'''Connection Diagram'''  
 
<br>[[File:Ks0022.png|700px|frameless|thumb]]<br>  
'''Sample Code:'''<br>


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
void setup()
void setup()
{
{
Line 1,318: Line 1,438:
     delay(500);
     delay(500);
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result''' <br>
<br>[[File:Ks0349-39-2.png|800px|frameless|thumb]]<br>
Wire it up as the above diagram and upload well the code to the board, then open the serial monitor and set the baud rate as 9600, finally you will see the current temperature value shown below. The value may be slight difference due to different place and weather.
<br>[[File:Ks0349-39-3.png|600px|frameless|thumb]]<br>


<br>
<br>
=== '''Project 28: 18B20 Temperature Sensor '''===  
=== '''Project 28: 18B20 Temperature Sensor '''===  
<br>[[File:ks0068 28-1.png|500px|frameless|thumb]]<br>
<br>[[File:Ks0023.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
'''Introduction:'''<br>
DS18B20 is a digital temperature sensor from DALLAS U.S. It can be used to quantify environmental temperature testing.<br>
DS18B20 is a digital temperature sensor. It can be used to quantify environmental temperature testing. <br>
The temperature range is -55 ~ +125 ℃, inherent temperature resolution 0.5 ℃. It also support multi-point mesh networking. Three DS18B20 can be deployed on three lines to achieve multi-point temperature measurement. It has a 9-12 bit serial output. <br>
The temperature range is -55 ~ +125 ℃, inherent temperature resolution 0.5 ℃. It also support multi-point mesh networking. <br>
 
The DS18B20 can be deployed to achieve multi-point temperature measurement. It has a 9-12 bit serial output.  


<br>
'''Specification:'''<br>
'''Specification:'''<br>
*Supply Voltage: 3.3V to 5V
*Supply Voltage: 3.3V to 5V
*Temperature range: -55 °C ~ +125 °C
*Temperature range: -55 °C ~ +125 °C
*Interface: Digital
*Interface: Digital
*Size: 30*20mm
*Weight: 3g


<br>
'''Connection Diagram:'''<br>
'''Connection Diagram:'''<br>
<br>[[File:ks0068 28-2.png|500px|frameless|thumb]]<br>
<br>[[File:Ks0023-.png|600px|frameless|thumb]]<br>  


<br>
'''Sample Code:'''<br>
'''Sample Code:'''<br>
OneWire Library Download: http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip


<pre>
<pre>
*****************************************************************************
// http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip
#include <OneWire.h>
#include <OneWire.h>
 
  int DS18S20_Pin = 2; //DS18S20 Signal pin on digital pin 2
  int DS18S20_Pin = 2; //DS18S20 Signal pin on digital 2
  //Temperature chip i/o
  //Temperature chip i/o
OneWire ds(DS18S20_Pin);  // on digital pin 2
OneWire ds(DS18S20_Pin);  // on digital pin 2
Line 1,358: Line 1,483:
   Serial.println(temperature);
   Serial.println(temperature);
    
    
   delay(100); //just here to slow down the output so it is easier to read
   delay(100); //to slow down the output so it is easier to read  
 
}
}
float getTemp(){
float getTemp(){
   //returns the temperature from one DS18S20 in DEG Celsius
   //returns the temperature from one DS18S20 in DEG Celsius
Line 1,390: Line 1,513:
   byte present = ds.reset();
   byte present = ds.reset();
   ds.select(addr);     
   ds.select(addr);     
   ds.write(0xBE); // Read Scratchpad
   ds.write(0xBE); // Read Scratchpad
   
   
Line 1,402: Line 1,524:
   
   
   float tempRead = ((MSB << 8) | LSB); //using two's compliment
   float tempRead = ((MSB << 8) | LSB); //using two's compliment
   float TemperatureSum = tempRead / 16;
   float TemperatureSum = tempRead / 16;
 
   return TemperatureSum;
   return TemperatureSum;
 
}
}
*******************************************************************************
</pre>
</pre>


Done uploading the code to the board, open the serial monitor, and you can see the measured temperature data.


=== '''Project 29: ADXL345 Three Axis Acceleration Module '''===  
<br>
<br>[[File:ks0068 29-1.png|500px|frameless|thumb]]<br>
 
=== '''Project 29: ADXL345 Three Axis Acceleration '''===  


'''Introduction:'''<br>
'''Introduction:'''<br>
The ADXL345 is a small, thin, low power, 3-axis MEMS accelerometer with high resolution (13-bit) measurement at up to +-16 g. Digital output data is formatted as 16-bit twos complement and is accessible through either a SPI (3- or 4-wire) or I2C digital interface.<br>
The ADXL345 is a small, thin, low power, 3-axis MEMS accelerometer with high resolution (13-bit) measurement at up to +-16 g. Digital output data is formatted as 16-bit twos complement and is accessible through either a SPI (3- or 4-wire) or I2C digital interface.<br>
The ADXL345 is well suited to measures the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion or shock. Its high resolution (4 mg/LSB) enables measurement of inclination changes less than 1.0 degrees.<br>
The ADXL345 is well suited to measure the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion or shock. Its high resolution (4 mg/LSB) enables measurement of inclination changes less than 1.0 degrees.
<br>[[File:Ks0012-.png|500px|frameless|thumb]]<br>


 
<br>
'''Specification:'''<br>
'''Specification'''<br>
*2.0-3.6VDC Supply Voltage
*2.0-3.6VDC Supply Voltage
*Ultra Low Power: 40uA in measurement mode, 0.1uA in standby@ 2.5V
*Ultra Low Power: 40uA in measurement mode, 0.1uA in standby@ 2.5V
*Tap/Double Tap Detection
*Tap/Double Tap Detection
*Free-Fall Detection
*Free-Fall Detection
*SPI and I2C interfaces
*SPI and I2C Interface
*Size: 30*20mm
*Weight: 3g


<br>
'''Connection Diagram'''
<br>[[File:Ks0012.png|700px|frameless|thumb]]<br>


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 29-2.png|500px|frameless|thumb]]<br>
'''Sample Code''' <br>
 
The circuit connection is follows:<br>
'''Sample Code:'''<br>
* VCC: 5V
* GND: ground
* SCL: UNO A5
* SDA: UNO A4


<pre>
<pre>
*****************************************************************************
/*
The circuit:
VCC: 5V
GND: ground
SCL: UNO SLC
SDA: UNO SDA
This example code is in the public domain.
*/
#include <Wire.h>
#include <Wire.h>
// Registers for ADXL345
// Registers for ADXL345
Line 1,457: Line 1,572:
// writes data to the slave's buffer
// writes data to the slave's buffer
void i2c_write(int address, byte reg, byte data) {
void i2c_write(int address, byte reg, byte data) {
   // Send output register address
   // Send output register address
   Wire.beginTransmission(address);
   Wire.beginTransmission(address);
Line 1,481: Line 1,597:
   // Request data from slave
   // Request data from slave
   // Count stands for number of bytes to request
   // Count stands for number of bytes to request
   Wire.requestFrom(address, count);
   Wire.requestFrom(address, count);
   while(Wire.available()) // slave may send less than requested
   while(Wire.available()) // slave may send less than requested
Line 1,497: Line 1,612:
   i2c_write(ADXL345_ADDRESS, 0x31, 0x0B);  // 13-bit mode  +_ 16g
   i2c_write(ADXL345_ADDRESS, 0x31, 0x0B);  // 13-bit mode  +_ 16g
   i2c_write(ADXL345_ADDRESS, 0x2D, 0x08);  // Power register
   i2c_write(ADXL345_ADDRESS, 0x2D, 0x08);  // Power register


   i2c_write(ADXL345_ADDRESS, 0x1E, 0x00);  // x
   i2c_write(ADXL345_ADDRESS, 0x1E, 0x00);  // x
Line 1,524: Line 1,640:
void setup() {
void setup() {
   Wire.begin();
   Wire.begin();
   Serial.begin(9600);
   Serial.begin(9600);
   for(int i=0; i<3; ++i) {
   for(int i=0; i<3; ++i) {
Line 1,531: Line 1,646:
   init_adxl345();
   init_adxl345();
}
}


void loop() {
void loop() {
Line 1,538: Line 1,654:
   Serial.print("\t");
   Serial.print("\t");
   Serial.print(float(accelerometer_data[1])*3.9/1000);
   Serial.print(float(accelerometer_data[1])*3.9/1000);
   Serial.print("\t");
   Serial.print("\t");
   Serial.print(float(accelerometer_data[2])*3.9/1000);
   Serial.print(float(accelerometer_data[2])*3.9/1000);
Line 1,543: Line 1,660:
   delay(100);
   delay(100);
}
}
*******************************************************************************
</pre>
</pre>


=== '''Project 30: DHT11 Temperature and Humidity Sensor  '''===
<br>
<br>[[File:ks0068 30-1.png|500px|frameless|thumb]]<br>
'''Result'''
<br>[[File:Ks0349-44-2.png|800px|frameless|thumb]]<br>
Wiring as the above diagram and power on, then upload the code and open the serial monitor, it will display the triaxial acceleration of sensor and its status, as the graph shown below.
<br>[[File:Ks0349-44-3.png|600px|frameless|thumb]]<br>


'''Introduction:'''<br>
<br>
This DHT11 Temperature and Humidity Sensor features calibrated digital signal output with the temperature and humidity sensor complex. Its technology ensures high reliability and excellent long-term stability. A high-performance 8-bit microcontroller is connected. This sensor includes a resistive element and a sense of wet NTC temperature measuring devices. It has excellent quality, fast response, anti-interference ability and high cost performance advantages.<br>
 
Each DHT11 sensor features extremely accurate calibration data of humidity calibration chamber. The calibration coefficients stored in the OTP program memory, internal sensors detect signals in the process, and we should call these calibration coefficients. The single-wire serial interface system is integrated to make it quick and easy. Qualities of small size, low power, and 20-meter signal transmission distance make it a wide applied application and even the most demanding one. Convenient connection, special packages can be provided according to users need.<br>
=== '''Project 30: DHT11 Temperature and Humidity Sensor '''===


'''Introduction'''<br>
This DHT11 Temperature and Humidity Sensor is a composite sensor which contains a calibrated digital signal output of the temperature and humidity.<br>
Its technology ensures high reliability and excellent long-term stability. A high-performance 8-bit microcontroller is connected. <br>
This sensor includes a resistive element and a sense of wet NTC temperature measuring devices. It has excellent quality, fast response, anti-interference ability and high cost performance advantages.<br>
Each DHT11 sensor features extremely accurate calibration data of humidity calibration chamber. The calibration coefficients stored in the OTP program memory, internal sensors detect signals in the process, and we should call these calibration coefficients. <br>
The single-wire serial interface system is integrated to make it quick and easy. Qualities of small size, low power, and 20-meter signal transmission distance make it a wide applied application or even the most demanding one. Convenient connection, special packages can be provided according to users’ need.
<br>[[File:KS0034 (3).jpg|500px|frameless|thumb]]<br>


'''Specification:'''<br>
<br>
'''Specification'''<br>
*Supply Voltage: +5 V
*Supply Voltage: +5 V
*Temperature range: 0-50 °C error of ± 2 °C
*Temperature Range: 0-50 °C error of ± 2 °C
*Humidity: 20-90% RH ± 5% RH error
*Humidity: 20-90% RH ± 5% RH error
*Interface: Digital
*Interface: Digital
*Size: 30*20mm
*Weight: 4g


<br>
'''Connection Diagram'''
<br>[[File:0034.jpg|700px|frameless|thumb]]<br>


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 30-2.png|500px|frameless|thumb]]<br>
'''Sample Code''' <br>
Download the [https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTlib DHT11Lib].Or to see [http://playground.arduino.cc/Main/DHTLib the website] <br>


'''Sample Code:'''<br>
<span style=color:red> '''Note:''' before compiling the code, do remember to place the library into libraries directory of Arduino IDE. Otherwise, compiling will fail. </span><br>


<pre>
<pre>
*****************************************************************************
Please download the DHT11Lib firstly.Or,see the website
#include <dht11.h>
#include <dht11.h>
dht11 DHT;
dht11 DHT;
Line 1,592: Line 1,719:
                 Serial.print("OK,\t");  
                 Serial.print("OK,\t");  
                 break;
                 break;
    case DHTLIB_ERROR_CHECKSUM:  
 
case DHTLIB_ERROR_CHECKSUM:  
 
                 Serial.print("Checksum error,\t");  
                 Serial.print("Checksum error,\t");  
                 break;
                 break;
Line 1,609: Line 1,738:
   delay(1000);
   delay(1000);
}
}
*******************************************************************************
</pre>
</pre>


=== '''Project 31: Bluetooth Module '''===
<br>
<br>[[File:ks0068 31-1.png|500px|frameless|thumb]]<br>
'''Result''' <br>
Wire it up well and upload the above code to UNO board.
<br>[[File:Ks0349-40-2.png|800px|frameless|thumb]]<br>


'''Introduction:'''<br>
Then open the serial monitor and set the baud rate as 9600, finally you will see the current temperature and humidity value.  
This Bluetooth module can easily achieve serial wireless data transmission. Its operating frequency is among the most popular 2.4GHz ISM frequency band (i.e. Industrial, scientific and medical). It adopts Bluetooth 2.1+EDR standard. In Bluetooth 2.1, signal transmit time of different devices stands at a 0.5 seconds interval so that the workload of bluetooth chip can be reduced substantially and more sleeping time can be saved for bluetooth. This module is set with serial interface, which is easy-to-use and simplifying overall design/development cycle.<br>
<br>[[File:Ks0349-40-3.png|600px|frameless|thumb]]<br>


<br>


'''Specification:'''<br>
=== '''Project 31: Bluetooth Module '''===
*Bluetooth protocol: Bluetooth 2.1+ EDR standard
<br>[[File:KS0055 (7).png|500px|frameless|thumb]]<br>
*USB protocol: USB v1.1/2.0
*Operating frequency: 2.4GHz ISM frequency band
*Modulation mode: Gauss frequency Shift Keying
*Transmit power: ≤ 4dBm, second stage
*Sensitivity: ≤-84dBm at 0.1% Bit Error Rate
*Transmission speed: 2.1Mbps(Max)/160 kbps(Asynchronous); 1Mbps/1Mbps(Synchronous)
*Safety feature: Authentication and encryption
*Supported configuration: Bluetooth serial port (major and minor)
*Supply Voltage: +3.3 VDC 50mA
*Operating temperature: -20 to 55℃
*Size: 36.5*16mm
*Weight: 4g


<br>
'''Introduction'''<br>
This Bluetooth module can easily achieve serial wireless data transmission. Its operating frequency is among the most popular 2.4GHz ISM frequency band (i.e. Industrial, scientific and medical). <br>
It adopts Bluetooth 2.1+EDR standard. In Bluetooth 2.1, signal transmit time of different devices stands at a 0.5 seconds interval, so that the workload of Bluetooth chip can be reduced substantially and more sleeping time can be saved for Bluetooth. <br>
This module is set with serial interface, which is easy-to-use and simplifying overall design/development cycle.


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 31-2.png|500px|frameless|thumb]]<br>
'''Specification'''<br>
* Bluetooth protocol: Bluetooth 2.1+ EDR standard
* USB protocol: USB v1.1/2.0
* Operating frequency: 2.4GHz ISM frequency band
* Modulation mode: Gauss frequency Shift Keying
* Transmit power: ≤ 4dBm, second stage
* Sensitivity: -84dBm at 0.1% Bit Error Rate
* Transmission speed: 2.1Mbps(Max)/160 kbps (Asynchronous); 1Mbps/1Mbps (Synchronous)
* Safety feature: Authentication and encryption
* Supported configuration: Bluetooth serial port (major and minor)
* Supply Voltage: 5 V DC 50mA
* Operating temperature: -20 to 55℃


'''Sample Code:'''<br>
<br>
'''Connection Diagram'''  
<br>[[File:KS0055-1.png|700px|frameless|thumb]]<br>


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
int val;  
int val;  
int ledpin=13;  
int ledpin=13;  
Line 1,659: Line 1,797:
}
}
}
}
*******************************************************************************
</pre>
</pre>


<br>


=== '''Project 32: TEMT6000 Ambient Light '''===


=== '''Project 32: TEMT6000 ambient light sensor '''===
<br>[[File:KS0098.jpg|450px|frameless|thumb]]<br>
<br>[[File:ks0068 32-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
'''Introduction:'''<br>
At some point you are going to want to sense ambient brightness with better precision than your trusty photoresistor without adding complexity to your project. When that day comes, go get yourself a TEMT6000 ambient light sensor.<br>
At some point you are going to sense ambient brightness with better precision than your trusty photoresistor without adding complexity to your project. When that day comes, go get yourself a TEMT6000 ambient light sensor.<br>
The TEMT6000 is supposed to be adapted to the sensitivity of the human eye, but I found it preformed sub-par in low light conditions. It does however work very well reacting to very small changes in a large range of brightnesses. Because it is meant to mimic the human eye, it does not react well to IR or UV light, so just make sure to note that when considering using it in your project.<br>
The TEMT6000 is supposed to be adapted to the sensitivity of the human eye, but found it preformed sub-par in low light conditions. <br>
It does however work very well reacting to very small changes in a large range of brightness. Because it is meant to mimic the human eye, it does not react well to IR or UV light, so just make sure to note that when using it in your project.<br>


Hooking It Up<br>
<br>
This is an incredibly simple part, just connect power and ground, and the signal pin to your favorite analog input and you are done, the sensor will output analog voltage, that ramps up when it gets brighter . You can power this off of 3.3v if you would like, the output value will just be lower.<br>
'''Specification'''<br>
 
* Supply Voltage: +5VDC 50mA
Code<br>
* Size: 36.5*16mm
You can not get more simple than this – This just reports the reading from the sensor to the serial terminal: 0-1023 with 1023 being very bright, and 0 being very dark.<br>
* Weight: 4g
 
 
 
<br>
'''Specification:'''<br>
'''Connection Diagram''' <br>
*Supply Voltage: +5VDC 50mA
This is an incredibly simple part, just connect power and ground, and the signal pin to your favorite analog input and you are done, the sensor will output analog voltage, that ramps up when it gets brighter. <br>
*Size: 36.5*16mm
You can power this off of 3.3v as you like, the output value will just be lower.<br>
*Weight: 4g
<br>[[File:Ks0098.png|700px|frameless|thumb]]<br>


 
<br>
'''Connection Diagram:'''<br>
'''Sample Code'''<br>
<br>[[File:ks0068 32-2.png|500px|frameless|thumb]]<br>
You can not get more simpler than this – This just reports the reading from the sensor to the serial terminal: 0-1023 with 1023 being very bright, and 0 being very dark.<br>
 
'''Sample Code:'''<br>


<pre>
<pre>
*****************************************************************************
int temt6000Pin = 0;
int temt6000Pin = 0;
void setup() {
void setup() {
  Serial.begin(9600);
Serial.begin(9600);
}
}
void loop() {
void loop() {
  int value = analogRead(temt6000Pin);
int value = analogRead(temt6000Pin);
  Serial.println(value);
Serial.println(value);
 
delay(100); //only here to slow down the output so it is easier to read
  delay(100); //only here to slow down the output so it is easier to read
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result''' <br>
Wiring well and uploading the code above, open the serial monitor of Arduino software.
<br>[[File:KS0349 31-3.png|800px|frameless|thumb]]<br>
Then cover the sensor with your hand or a paper, the light becomes weak, finally you will see the value showed on monitor decrease.
<br>[[File:KS0349 31-4.png|800px|frameless|thumb]]<br>


=== '''Project 33: Keyestudio SR01 Ultrasonic Sensor  '''===
<br>
<br>[[File:ks0068 33-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
The Keyestudio SR01 Ultrasonic Sensor is a very affordable proximity/distance sensor that has been used mainly for object avoidance in various robotics projects. It essentially gives your Arduino eyes / spacial awareness and can prevent your robot from crashing or falling off a table. It has also been used in turret applications, water level sensing, and even as a parking sensor. This simple project will use the Keyestudio SR01 Ultrasonic Sensor with an Arduino and a Processing sketch to provide a neat little interactive display on your computer screen.<br>


=== '''Project 33: SR01 Ultrasonic Sensor  '''===


'''Specification:'''<br>
'''Introduction'''<br>
*Working Voltage: DC 5V
The Keyestudio SR01 Ultrasonic Sensor is a very affordable proximity/distance sensor that has been used mainly for object avoidance in various robotics projects. <br>
*Working Current: 15mA
It essentially gives your Arduino eyes/spacial awareness and can prevent your robot from crashing or falling off a table. It has also been used in turret applications, water level sensing, and even as a parking sensor. <br>
*Working Frequency: 40Hz
This simple project will use the Keyestudio SR01 Ultrasonic Sensor with an Arduino and a Processing sketch to provide a neat little interactive display on your computer screen.<br>
*Max Range: 5m
<br>[[File:2061.png|500px|frameless|thumb]]<br>
*Min Range: 2cm
*Measuring Angle: 15 degree
*Trigger Input Signal: 10µS TTL pulse
*Echo Output Signal Input TTL lever signal and the range in proportion
*Size: 49*22mm
*Weight: 9g


<br>
'''Specification'''<br>
* Working Voltage: DC 5V <br> 
* Working Current: 15mA <br> 
* Working Frequency: 40Hz <br> 
* Max Range: 5m <br> 
* Min Range: 2cm <br> 
* Measuring Angle: 15 degree <br> 
* Trigger Input Signal: 10µS TTL pulse <br> 
* Echo Output Signal Input TTL lever signal and the range in proportion <br>


'''Connection Diagram:'''<br>
<br>
<br>[[File:ks0068 33-2.png|500px|frameless|thumb]]<br>
'''Connection Diagram'''
<br>[[File:2062.png|800px|frameless|thumb]]<br>
<br>
{| class="wikitable" border="1"
|-
! SR01 Ultrasonic Sensor
! UNO
|-
| VCC
| 5V
|-
| GND
| GND
|-
| Echo
|Digital Pin 7
|-
| Trig
|Digital Pin 8
|-
|}


'''Sample Code:'''<br>
<br>
'''Sample Code'''<br>
* VCC to arduino 5v <br>
* GND to arduino GND<br>
* Echo to Arduino pin 7 <br>
* Trig to Arduino pin 8<br>


<pre>
<pre>
*****************************************************************************
VCC to arduino 5v
GND to arduino GND
Echo to Arduino pin 7
Trig to Arduino pin 8
#define echoPin 7 // Echo Pin
#define echoPin 7 // Echo Pin
#define trigPin 8 // Trigger Pin
#define trigPin 8 // Trigger Pin
Line 1,758: Line 1,918:
  digitalWrite(trigPin, LOW);  
  digitalWrite(trigPin, LOW);  
  delayMicroseconds(2);  
  delayMicroseconds(2);  
  digitalWrite(trigPin, HIGH);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);  
  delayMicroseconds(10);  
  digitalWrite(trigPin, LOW);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  duration = pulseIn(echoPin, HIGH);
   
   
Line 1,782: Line 1,944:
  delay(50);
  delay(50);
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result'''
<br>[[File:Ks0206-1.png|600px|frameless|thumb]]<br>
After upload the code to the board, open the serial monitor of Arduino IDE, you can see the distance value measured by ultrasonic sensor.
<br>[[File:Ks0206-2.png|600px|frameless|thumb]]<br>
<br>


=== '''Project 34: Joystick Module '''===  
=== '''Project 34: Joystick Module '''===  
<br>[[File:ks0068 34-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
'''Introduction'''<br>
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. <br>
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. <br>
It also has a switch that is connected to a digital pin. This joystick module can be easily connected to Arduino by IO Shield.  
<br>[[File:Ks0008_joystick.png|600px|frameless|thumb]]<br>


 
<br>
'''Specification:'''<br>
'''Specification'''<br>
*Supply Voltage: 3.3V to 5V
*Supply Voltage: 3.3V to 5V
*Interface: Analog x2, Digital x1
*Interface: Analog x2, Digital x1
*Size: 40*28mm
*Weight: 12g
'''Connection Diagram:'''<br>
<br>[[File:ks0068 34-2.png|500px|frameless|thumb]]<br>


'''Sample Code:'''<br>
<br>
'''Connection Diagram'''  
<br>[[File:Ks0008-1.png|700px|frameless|thumb]]<br>  


<br>
'''Sample Code'''
<pre>
<pre>
*****************************************************************************
int JoyStick_X = 0; //x
int JoyStick_X = 0; //x
int JoyStick_Y = 1; //y
int JoyStick_Y = 1; //y
Line 1,819: Line 1,985:
   int x,y,z;
   int x,y,z;
   x=analogRead(JoyStick_X);
   x=analogRead(JoyStick_X);
   y=analogRead(JoyStick_Y);
   y=analogRead(JoyStick_Y);
   z=digitalRead(JoyStick_Z);
   z=digitalRead(JoyStick_Z);
Line 1,829: Line 1,994:
   delay(100);
   delay(100);
}
}
*******************************************************************************
</pre>
</pre>


<br>
'''Result'''
<br>[[File:36.png|600px|frameless|thumb]]<br>
Wiring well and uploading the code, open the serial monitor and set the baud rate to 9600, push the joystick, you will see the value shown below.
<br>[[File:Joystick 1.jpg|600px|frameless|thumb]]<br>


<br>


=== '''Project 35: DS3231 Clock Module '''===  
=== '''Project 35: DS3231 Clock Module '''===  
<br>[[File:ks0068 35-1.png|500px|frameless|thumb]]<br>


'''Introduction:'''<br>
'''Introduction'''<br>
DS3231 is equipped with integrated TCXO and crystal, which makes it a cost-effective I2C real time clock with high precision. The device carries a battery input, so if you disconnect the main power supply, it can still maintain accurate timing. The integrated oscillator ensures the long-term accuracy of the device and reduces the number of components. DS3231 provides both commercial and industrial temperature range and supports 16 pins small-outline package (300mil). The module itself can adapt to the system of 3.3V and 5V without level switch, which is quite convenient! <br>
DS3231 is equipped with integrated TCXO and crystal, which make it a cost-effective I2C real time clock with high precision. <br>
The device carries a battery input, so if you disconnect the main power supply, it can still maintain accurate timing.<br>
The integrated oscillator ensures the long-term accuracy of the device and reduces the number of components. <br>
DS3231 provides both commercial and industrial temperature range and supports 16 pins small-outline package (300mil). <br>
The module itself can adapt to the system of 3.3V and 5V without level switch, which is quite convenient! <br>
<br>[[File:Ks0039-1.png|400px|frameless|thumb]]<br>


 
<br>
'''Specification:'''<br>
'''Specification''' <br>
*Temperature range: -40 to +85; Timing accuracy : ± 5ppm (±0.432 seconds / day)
*Temperature range: -40 to +85; Timing accuracy: ± 5ppm (±0.432 seconds/day)
*Provide battery backup for continuous timing
*Provide battery backup for continuous timing
*Low power consumption
*Low power consumption
Line 1,855: Line 2,029:
*Working temperature: -40 ~ C to +85 ~ C  
*Working temperature: -40 ~ C to +85 ~ C  
*16 pins Small Outline Package (300mil)
*16 pins Small Outline Package (300mil)
*Certified by American Association of Underwriters Laboratories (UL)
*Size: 30*20mm
*Weight: 4g


<br>
'''Connection Diagram''' <br>
This module adopts the IIC test method, so we only need to connect SDA to Arduino A4; SCL to A5; positive pin to VCC; negative pin to GND.
<br>[[File:Ks0039-2.png|700px|frameless|thumb]]<br>


'''Connection Diagram:'''<br>
<br>
This module adopts the IIC test method, so we only need to connect ‘SDA’ to Arduino A4, ‘SCL’ to A5, ‘+’ to VCC and ‘-’ to GND as follows:<br>
'''Sample Code''' <br>
<br>[[File:ks0068 35-2.png|500px|frameless|thumb]]<br>
<span style=color:red> Before compiling the code, you’d better put [https://github.com/rodan/ds3231 DS3231 library] under file into Arduino catalogue. <br>
 
'''Sample Code:'''<br>


<pre>
<pre>
*****************************************************************************
#include <Wire.h>
#include <Wire.h>
#include "DS3231.h"
#include "DS3231.h"
Line 1,875: Line 2,047:
//writing any non-existent time-data may interfere with normal operation of the RTC.
//writing any non-existent time-data may interfere with normal operation of the RTC.
//Take care of week-day also.
//Take care of week-day also.
DateTime dt(2011, 11, 10, 15, 18, 0, 5);//open the series port and you can check time here or make a change to the time as needed.
DateTime dt(2011, 11, 10, 15, 18, 0, 5);//open the serial port and you can check time here or make a change to the time as needed.
void setup ()  
void setup ()  
{  Serial.begin(57600);//set baud rate to 57600
{  Serial.begin(57600);//set baud rate to 57600
Line 1,890: Line 2,062:
     Serial.print('/');
     Serial.print('/');
     Serial.print(now.date(), DEC);
     Serial.print(now.date(), DEC);
     Serial.print(' ');
     Serial.print(' ');
     Serial.print(now.hour(), DEC);
     Serial.print(now.hour(), DEC);
Line 1,901: Line 2,074:
     delay(1000);
     delay(1000);
}
}
*******************************************************************************
</pre>
</pre>


'''results:'''<br>
<br>
Before compiling the code, you’d better put DS3231 library  under file into Arduino catalogue,. When the above steps are done, you can upload the code to arduino and open the series monitor and get following results: <br>
<span style=color:red> Before compiling the code, you’d better put [https://github.com/rodan/ds3231 DS3231 library]  under file into Arduino catalogue. </span> <br>
When the above steps are done, you can upload the code to arduino and open the serial monitor and get the following results:  
<br>[[File:ks0068 35-3.png|500px|frameless|thumb]]<br>
<br>[[File:ks0068 35-3.png|500px|frameless|thumb]]<br>
<br>


=== '''Project 36: 5V Relay Module '''===  
=== '''Project 36: 5V Relay Module '''===  
<br>[[File:ks0068 36-1.png|500px|frameless|thumb]]<br>
'''Introduction:'''<br>
This single relay module can be used in interactive projects. This module uses SONGLE 5v high-quality relay. It can also be used to control lighting, electrical and other equipment. The modular design makes it easy to expand with the Arduino board (not included). The Relay output is by a light-emitting diode. It can be controlled through digital IO port, such as solenoid valves, lamps, motors and other high current or high voltage devices. <br>


'''Introducton'''<br>
This single relay module can be used in interactive projects. It is active HIGH level. This module uses SONGLE 5v high-quality relay. <br>
It can also be used to control lighting, electrical and other equipment. <br>
The modular design makes it easy to expand with the Arduino board (not included). The relay output is by a light-emitting diode. It can be controlled through digital IO port, such as solenoid valves, lamps, motors and other high current or high voltage devices.
<br>[[File:Ks0011.png|500px|frameless|thumb]]<br>


'''Specification:'''<br>
<br>
'''Specification'''<br>
*Type: Digital
*Type: Digital
*Rated current: 10A (NO) 5A (NC)
*Rated current: 10A (NO) 5A (NC)
Line 1,924: Line 2,101:
*Maximum switching power: AC1200VA DC240W (NO) AC625VA DC120W (NC)
*Maximum switching power: AC1200VA DC240W (NO) AC625VA DC120W (NC)
*Contact action time: 10ms
*Contact action time: 10ms
*Size: 40*28mm
*Weight: 15g


<br>
'''Connection Diagram''' <br>
Firstly you need to prepare the following parts by yourself before testing. <br>
* Arduino Board*1
* Single relay module*1
* LED module *1
* USB Cable*1
* Jumper Wire*8


'''Connection Diagram:'''<br>
<br>[[File:Ks0011-1.png|500px|frameless|thumb]]<br>
This module adopts the IIC test method, so we only need to connect ‘SDA’ to Arduino A4, ‘SCL’ to A5, ‘+’ to VCC and ‘-’ to GND as follows:<br>
<br>[[File:ks0068 36-2.png|500px|frameless|thumb]]<br>
 
'''Sample Code:'''<br>


<br>
'''Sample Code''' <br>
Copy and paste the code below to Arduino software.
<pre>
<pre>
*****************************************************************************
int Relay = 8;
int Relay = 8;
   void setup()
   void setup()
{
{
   pinMode(13, OUTPUT);        //Set Pin13 as output
   pinMode(13, OUTPUT);        //Set Pin13 as output
   digitalWrite(13, HIGH);    //Set Pin13 High
   digitalWrite(13, HIGH);    //Set Pin13 High
Line 1,951: Line 2,131:
           delay(2000);
           delay(2000);
}
}
*******************************************************************************
</pre>
</pre>
<br>
'''Test Result'''  <br>
This relay module is active HIGH level. <br>
Wire it up well, powered up, then upload the above code to the board.<br>
You will see the relay is turned on(ON connected, NC disconnected)for two seconds, then turned off for two seconds(NC closed,ON disconnected), repeatedly and circularly.<br>
When the relay is turned on, external LED is on. If relay is turned off, external LED is off.
<br>[[File:Ks0011-2.png|600px|frameless|thumb]]<br>
<br>


=== '''Project 37: Vapor Sensor '''===  
=== '''Project 37: Vapor Sensor '''===  
<br>[[File:Project 37-1.png|500px|frameless|thumb]]<br>
<br>[[File:2031.png|500px|frameless|thumb]]<br>  


'''Introduction:'''<br>
'''Introduction:'''<br>
Vapor Sensor is an analog sensor and can make a simple rainwater detector and liquid level switch. When humidity on the face of this sensor rises, output voltage will increase. <br>
Steam sensor is an analog sensor and can be made as a simple rainwater detector and liquid level switch. When humidity on the face of this sensor rises, output voltage will increase.
Caution: connection parts is non-waterproof, so please don’t put them into water. <br>
<span style=color:red> '''Caution:''' connection parts is non-waterproof, so please don’t put them into water. <br>  
 
 
'''Specification:'''<br>
*Working Voltage: 3.3V or 5V
*Working Current: <20mA
*Range of Working Temperature: -10℃~+70℃
*Interface Type: Analog Signal Output
*Size: 36mm x 20mm
*Weight:
*Pin Definition:
*S:Signal Output
*+:Power Supply(VCC)
*-:Ground(GND


<br>
'''Performance Parameters'''<br>
* 1.Working Voltage: 3.3V or 5V<br>
* 2.Working Current: <20mA <br>
* 3.Range of Working Temperature: -10℃~+70℃ <br>
* 4.Interface Type: Analog Signal Output <br>


'''Connection Diagram:'''<br>
<br>
This module adopts the IIC test method, so we only need to connect ‘SDA’ to Arduino A4, ‘SCL’ to A5, ‘+’ to VCC and ‘-’ to GND as follows:<br>
'''Pin Definition:''' <br>
<br>[[File:Project 37-2.png|500px|frameless|thumb]]<br>
* '''S:'''Signal Output <br>
* '''+:'''Power Supply(VCC) <br>
* '''-:'''Ground(GND) <br>


'''Sample Code:'''<br>
<br>
'''Connection Diagram'''
<br>[[File:2032.png|500px|frameless|thumb]]<br>  


<br>
'''Test Code'''
<pre>
<pre>
*****************************************************************************
void setup()
void setup()
{
{
Serial.begin(9600); //open serial port, and set baud rate at 9600bps
Serial.begin(9600); //open serial port, and set baud rate at 9600bps
Line 1,995: Line 2,182:
delay(100);
delay(100);
}
}
*******************************************************************************
</pre>
</pre>


==Resources ==
<br>
'''Result''' <br>
When detecting different degrees of humidity, the sensor will get the feedback of different current value. Shown as the following picture. <br>
When the sensor detects the steam of boiled water, the moisture value is displayed on serial monitor of Arduino software.
<br>[[File:203.jpg|600px|frameless|thumb]]<br>


'''Video'''


http://www.keyestudio.com/wp/ks0068/
<br>


'''PDF'''
==Resources ==


https://drive.google.com/open?id=1plI4NnvKWNMBVUw_4zo2HPhSdQCyoSpO
* '''Video:''' <br>
http://video.keyestudio.com/KS0068/


'''APP'''
* '''Libraries:''' <br>
https://fs.keyestudio.com/KS0068


https://drive.google.com/open?id=1x7AlEz9n6bTetK8MVZzqY5IcGEjrNMgk


'''Libraries'''
<br>


https://drive.google.com/open?id=1u4pQEnXRDpiR4uqJIhU-h1ELPPZnA8GZ
==Buy from ==


==Buy from ==
*[https://www.keyestudio.com/new-packingkeyestudio37-in-1-sensor-kit-for-arduino-programming-education-37pcs-sensors37-projectspdfvideo-p0138.html  '''Official Website''']
'''Official Website'''


http://www.keyestudio.com/ks0068.html
*[https://www.amazon.ca/keyestudio-Tutorial-Programming-Learning-Education/dp/B016KIXSMM/   '''Available on Amazon''']


'''Available on Amazon:'''
*[https://www.aliexpress.com/store/product/New-Keyestudio-36-in-1-sensor-kit-for-Arduino-starters-with-36-Project-PDF/1452162_32612883001.html?spm=2114.12010612.8148356.3.29e042cb8BURUc      '''Available on Aliexpress''']
[https://www.amazon.ca/keyestudio-Tutorial-Programming-Learning-Education/dp/B016KIXSMM/]






[[Category: Starter Kit]]
[[Category: Starter Kit]]

Latest revision as of 08:33, 7 January 2021

kesestudio 37 in 1 Sensor Kit for Arduino Starters

thumb

  • Sensor kit for Arduino
  • Based on open-source hardware
  • 37 kinds of sensors packed in one box
  • To make interesting projects


Summary

This is keyestudio sensor learning kit. We bring together 37 basic sensors and modules, aiming for the convenient learning for starters. Inside this box, there are digital and analog sensors and also some special modules such as ultrasonic, Bluetooth, acceleration module,etc.
For each module, there is clear connection diagram and sample code. So even if you are totally new at this, you can get started easily.The sample codes for this sensor kit are based on ARDUINO because it's open source and easy to use. If you are good at this, you can also apply this kit to other MCU development platforms, such as 51, STM32, Raspberries Pi. The working principle is pretty much the same.
Now, let us embrace this fascinating world of ARDUINO and learn together!
thumb

Project Details


Project 1: White LED Light


Introduction
This is a white LED module. The main function is to control a plugin LED on and off. When connecting to ARDUINO, after programming, it will emit white light color.
The pin pitch of 3Pin is 2.54mm. This LED module has 3 Pins; - pin is connected to ground, + pin is connected to VCC(3.3-5V), S pin is for signal control; you can set the High or Low level to control the LED on and off.
You can combine with other sensors to do various interactive experiments. You can also choose other LED modules to emit different light color like blue, green, yellow and red.

thumb


Features

  • Control interface: Digital
  • Working voltage: DC 3.3-5V
  • Pin pitch: 2.54mm
  • LED color: white
  • Easy to use
  • Useful for light projects


Connect It Up
Connect the LED module to control board using three jumper wires. Then connect the control board to your PC with a USB cable.

thumb


Upload the Code
Copy and paste below code to Arduino IDE and upload.

int led = 7; 
void setup()
{
  pinMode(led, OUTPUT);     //Set Pin7 as output
}
void loop()
{    digitalWrite(led, HIGH);   //Turn off led
          delay(1000);
          digitalWrite(led, LOW);    //Turn on led
          delay(1000);
}


Test Result
The LED will flash on for one second, then off for one second, repeatedly and alternately.
If it doesn’t, make sure you have assembled the circuit correctly and verified and uploaded the code to your board.

thumb


Project 2: Red LED Light


Introduction
This is a red LED module. The main function is to control a plugin LED on and off. When connecting to ARDUINO, after programming, it will emit red light color.
The pin pitch of 3Pin is 2.54mm. This LED module has 3 Pins; - pin is connected to ground, + pin is connected to VCC(3.3-5V), S pin is for signal control; you can set the High or Low level to control the LED on and off.
You can combine with other sensors to do various interactive experiments.
You can also choose other LED modules to emit different light color like blue, green, yellow and white.

thumb


Features

  • Control interface: Digital
  • Working voltage: DC 3.3-5V
  • Pin pitch: 2.54mm
  • LED color: red
  • Easy to use
  • Useful for light projects


Technical Details

  • Dimensions: 34mm*20mm*11.5mm
  • Weight: 2.7g


Connect It Up
Connect the red LED module to control board using three jumper wires. Then connect the control board to your PC with a USB cable.

thumb


Upload the Code
Copy and paste below code to Arduino IDE and upload.

int led = 7; 
void setup()
{
  pinMode(led, OUTPUT);     //Set Pin7 as output
}
void loop()
{    digitalWrite(led, HIGH);   //Turn off led
          delay(1000);
          digitalWrite(led, LOW);    //Turn on led
          delay(1000);
}


Test Result
The LED will flash on for one second, then off for one second, repeatedly and alternately.
If it doesn’t, make sure you have assembled the circuit correctly and verified and uploaded the code to your board.

thumb


Project 3: 3W LED Module


Introduction
This LED module is of high brightness because the lamp beads it carries is 3W. We can apply this module to Arduino projects.
For example, intelligent robots can use this module for illumination purpose.
Please note that the LED light can't be exposed directly to human eyes for safety concerns.
thumb


Specification

  • Color temperature: 6000~7000K
  • Luminous flux: 180~210lm
  • Current: 700~750mA
  • IO Type: Digital
  • Supply Voltage: 3.3V to 5V
  • Power: 3W
  • Light angle: 140 degree
  • Working temperature: -50~80℃
  • Storage temperature: -50~100℃
  • High power LED module, controlled by IO port microcontroller
  • Great for Robot and search & rescue platform application


Connection Diagram
thumb


Sample Code

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}


Result
Done wiring and powered up,upload well the code, both D13 led and the led on the module blink for one second then off, circularly.
thumb



Project 4: RGB LED

Introduction
This is a full-color LED module, which contains 3 basic colors-red, green and blue. They can be seen as separate LED lights.
After programming, you can turn them on and off by sequence or can also use PWM analog output to mix three colors to generate different colors.
thumb


Specification

  • Color: red, green and blue
  • Brightness: High
  • Voltage: 5V
  • Input: digital level


Connection Diagram
thumb


Sample Code

int redpin = 11; //select the pin for the red LED
int bluepin =10; // select the pin for the blue LED
int greenpin =9;// select the pin for the green LED
int val;
void setup() {
  pinMode(redpin, OUTPUT);
  pinMode(bluepin, OUTPUT);
  pinMode(greenpin, OUTPUT);
  }
void loop() 
{for(val=255; val>0; val--)
  {analogWrite(11, val);
   analogWrite(10, 255-val);
   analogWrite(9, 128-val);
   delay(1); 
  }
for(val=0; val<255; val++)
  {analogWrite(11, val);
   analogWrite(10, 255-val);
   analogWrite(9, 128-val);
   delay(1);  
  }
}


Result
Done uploading the code, you should see the RGB LED flashing with different colors.
thumb


Project 5: Analog Temperature


Introduction
This module is based on the working principle of a thermistor (resistance varies with temperature change in the environment).
It can sense temperature change in its surrounding and send the data to the analog IO in the Arduino board.
All we need to do is to convert the sensor output data into degrees Celsius temperature via simple programming, finally to display it.
It's both convenient and effective, thus it is widely applied in gardening, home alarm system and other devices.
thumb


Specification

  • Interface Type: analog
  • Working Voltage: 5V
  • Temperature Range: -55℃~315℃


Connection Diagram

thumb


Sample Code
Copy and paste the below code to Arduino software.

void setup() 
{Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() 
{int sensorValue = analogRead(A0);
Serial.println(sensorValue);
  delay(1); }


The above code is only for analog value.
You can see that the analog value is changing according to the temperature change in the environment. But it’s not very obvious.
Let’s solve this by using the following equation. Then upload the code below to the Arduino board. The value read from the serial port is similar to normal temperature.
e.g. The temperature right now is 30°C.

#include <math.h>
void setup()
{
   Serial.begin(9600);
}
void loop()
{
  double val=analogRead(0);
  double fenya=(val/1023)*5;
  double r=(5-fenya)/fenya*4700;
  Serial.println( 1/(  log(r/10000) /3950 + 1/(25+273.15))-273.15);
  delay(1000);
}


Result
thumb
Done wiring and powered up, upload well the code, then open the serial monitor, you will see the current temperature value. Shown below.
thumb


Project 6: Photocell Sensor


thumb

Introduction
Photocell is commonly seen in our daily life and is mainly used in intelligent switch, also in common electronic design.
To make it more easier and effective, we supply corresponding modules. Photocell is a semiconductor. It has features of high sensitivity, quick response, spectral characteristic, and R-value consistence, maintaining high stability and reliability in environment extremes such as high temperature, high humidity.
It’s widely used in automatic control switch fields like cameras, garden solar lights, lawn lamps, money detectors, quartz clocks, music cups, gift boxes, mini night lights, sound and light control switches, etc.


Specification

  • Interface Type: analog
  • Working Voltage: 5V


Connection Diagram
thumb


Sample Code

int sensorPin =A0 ; 
int value = 0; 
void setup() 
{
 Serial.begin(9600); } 
void loop() 
{
 value = analogRead(sensorPin); 
 
Serial.println(value, DEC); 
 
delay(50); 
}


Result
thumb
Done wiring and powered up, upload well the code, then open the serial monitor, if cover the photocell on the sensor with your hand, you will see the analog value decrease. Shown as below.
thumb


Project 7: Analog Sound


Introduction
The keyestudio microphone sensor is typically used in detecting the loudness in ambient environment. The Arduino can collect its output signal by analog input interface.
The S pin is analog output, that is voltage signal real-time output of microphone. The sensor comes with a potentiometer, so that you can turn it to adjust the signal gain.
It also has a fixed hole so that you can mount the sensor on any other devices. You can use it to make some interactive works, such as a voice operated switch.
thumb


Specification

  • Operating voltage: 3.3V-5V(DC)
  • Operating current: <10mA
  • Interface:3PIN
  • Output signal: Analog


Connection Diagram

thumb


Sample Code

int sensorPin =A0 ;  // define analog port A0
int value = 0;    //set value to 0
void setup() 
{
 Serial.begin(9600); //set the baud rate to 9600
} 
void loop() 
{
value = analogRead(sensorPin);  //set the value as the value read from A0
Serial.println(value, DEC);  //print the value and line wrap
delay(200);  //delay 0.2S
} 


Test Result
Connect it up and upload the code successfully, then open the serial monitor on the right upper corner of Arduino IDE.
The analog value will pop up on the monitor window. The greater the sound, the greater the analog value is.
thumb


Project 8: Analog Rotation Sensor


thumb


Introduction
This analog Rotation Sensor is arduino compatible. It is based on a potentiometer. Its voltage can be subdivided into 1024, easy to be connected to Arduino with our sensor shield. Combined with other sensors, we can make interesting projects by reading the analog value from the IO port.


Specification

  • Supply Voltage: 3.3V to 5V
  • Interface: Analog


Connection Diagram
thumb


Sample Code

void setup()
{
  Serial.begin(9600); //Set serial baud rate to 9600 bps
}
void loop()
{
int val;
val=analogRead(0);//Read rotation sensor value from analog 0
Serial.println(val,DEC);//Print the value to serial port
delay(100);
}


Result
thumb
Done wiring and powered up, upload well the above code, then open the serial monitor and set the baud rate as 9600, finally you will see the analog value. If rotate the knob on the rotation sensor, the value will be changed within 0-1023. Shown below.
thumb


Project 9: Passive Buzzer

KS0019 (4).jpg

Introduction
We can use Arduino to make many interactive works of which the most commonly used is acoustic-optic display.
The circuit in this experiment can produce sound. Normally, the experiment is done with a buzzer or a speaker while buzzer is simpler and easier to use.
The buzzer we introduced here is a passive buzzer. It cannot be actuated by itself, but by external pulse frequencies. Different frequencies produce different sounds.
We can use Arduino to code the melody of a song, which is quite fun and simple.


Specification

  • Working voltage: 3.3-5v
  • Interface type: digital


Connection Diagram
thumb


Sample Code

int buzzer=3;//set digital IO pin of the buzzer
void setup() 
{ 
pinMode(buzzer,OUTPUT);// set digital IO pin pattern, OUTPUT to be output 
} 
void loop() 
{ unsigned char i,j;//define variable
while(1) 
{ for(i=0;i<80;i++)// output a frequency sound
{ digitalWrite(buzzer,HIGH);// sound
delay(1);//delay1ms 
digitalWrite(buzzer,LOW);//not sound
delay(1);//ms delay 
} 
for(i=0;i<100;i++)// output a frequency sound
{ 
digitalWrite(buzzer,HIGH);// sound
digitalWrite(buzzer,LOW);//not sound
delay(2);//2ms delay 
}
} 
} 


Test Result
After downloading the program, buzzer experiment is complete. You should hear the buzzer ringing.
thumb



Project 10: Digital Buzzer


Introduction
Here is the simplest sound making module. You can use high/low level to drive it. Changing the frequency it buzzes can produce different sound. This module is widely used on your daily appliance, like PC, refrigerator, phones etc. And you can also create many interesting interactive project with this small but useful module. Just try it!! You will find the electronic sound it creates so fascinating.
thumb


Specification

  • Working Voltage: 3.3-5v
  • Interface Type: digital


Connection Diagram
thumb


Sample Code

int buzzPin =  3;    //Connect Buzzer on Digital Pin3
 void setup()  
 {        
  pinMode(buzzPin, OUTPUT);     
}
 void loop()                     
{
  digitalWrite(buzzPin, HIGH);
  delay(1);
  digitalWrite(buzzPin, LOW); 
  delay(1);        
}


Test Result
After uploading the code, you can hear the buzzer beep continually.
thumb


Project 11: Digital Push Button


Introduction
This is a basic button application module. Momentary Pushbutton Switch usually stays open. When it is pressed down, circuit connected; when it is released, it will bounce back to the status of disconnection. The module has three pins for easy connection. You can simply plug it into an IO shield to have your first try of Arduino.
thumb


Details

  • Interface: Digital
  • Supply Voltage: 3.3V to 5V
  • Easy to plug and operate
  • Large button keypad and high-quality button cap
  • Standard assembling structure
  • Easily recognizable pins
  • Icons illustrate sensor function clearly
  • Achieve interactive works


Connection Diagram
thumb


Sample Code

/* # When you push the digital button, the Led 13 on the board will turn on. Otherwise,the led turns off.
*/
int ledPin = 13;                // choose the pin for the LED
int inputPin = 3;               // Connect sensor to input pin 3 
void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare pushbutton as input
}
void loop(){
  int val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    digitalWrite(ledPin, LOW);  // turn LED OFF
  } else {
    digitalWrite(ledPin, HIGH); // turn LED ON
  }
}


Result
When you push the digital button, the Led 13 on UNO board will be on. When release the button,the led is off. Shown as below.
thumb


Project 12: Digital Tilt Sensor

Introduction
Tilt sensor is a digital tilt switch. It can be used as a simple tilt sensor. Tilt sensors (tilt ball switch) allow you to detect orientation or inclination. They are small, inexpensive, low-power and easy-to-use. Simply connect the sensor to our IO/Sensor shield, so you can make amazing interactive projects. thumb
Specification

  • Supply Voltage: 3.3V to 5V
  • Interface: Digital


Connection Diagram
thumb


Sample Code

int ledPin = 13;                // Connect LED to pin 13
int switcher = 3;                 // Connect Tilt sensor to Pin3
 
void setup()
{
  pinMode(ledPin, OUTPUT);      // Set digital pin 13 to output mode
  pinMode(switcher, INPUT);       // Set digital pin 3 to input mode
}
void loop()
{
     
   if(digitalRead(switcher)==HIGH) //Read sensor value
     { 
        digitalWrite(ledPin, HIGH);   // Turn on LED when the sensor is tilted
     }
   else
     {
        digitalWrite(ledPin, LOW);    // Turn off LED when the sensor is not triggered
     }
}


Result
Upload the code to the board. Then tilt the sensor, you will see the led on the sensor is turned on. Shown as below.
thumb


Project 13: Photo Interrupter


thumb

Introduction
Upright part of this sensor is an infrared emitter and on the other side, it’s a shielded infrared detector. By emitting a beam of infrared light from one end to other end, the sensor can detect an object when it passes through the beam. It is used for many applications including optical limit switches, pellet dispensing, general object detection, etc.


Specification

  • Supply Voltage: 3.3V to 5V
  • Interface: Digital


Connection Diagram
thumb


Sample Code

// photo interrupter module
 
int Led = 13 ;// define LED Interface
int buttonpin = 3; // define the photo interrupter sensor interface
int val ;// define numeric variables val
void setup ()
{
  pinMode (Led, OUTPUT) ;// define LED as output interface
  pinMode (buttonpin, INPUT) ;// define the photo interrupter sensor output interface   
}
void loop ()
{
  val = digitalRead (buttonpin) ;// digital interface will be assigned a value of 3 to read val
  if (val == HIGH) // When the light sensor detects a signal is interrupted, LED flashes
  {
    digitalWrite (Led, HIGH);
  }
  else
  {
    digitalWrite (Led, LOW);
  }
}


Project 14: Capacitive Touch


thumb

Introduction
Are you tired of clicking mechanic button? Well, try our capacitive touch sensor. You can find touch sensors mostly used on electronic device. So upgrade your Arduino project with our new version touch sensor and make it cool!!
This little sensor can "feel" people and metal touch and feedback a high/low voltage level. Even isolated by some cloth and paper, it can still feel the touch. Its sensitivity decreases as isolation layer gets thicker.


Specification

  • Supply Voltage: 3.3V to 5V
  • Interface: Digital


Connection Diagram
thumb


Sample Code

int ledPin = 13;                // Connect LED on pin 13, or use the onboard one
int KEY = 2;                 // Connect Touch sensor on Digital Pin 2
 
void setup(){
  pinMode(ledPin, OUTPUT);      // Set ledPin to output mode
  pinMode(KEY, INPUT);       //Set touch sensor pin to input mode
}
 
void loop(){
   if(digitalRead(KEY)==HIGH) {      //Read Touch sensor signal
        digitalWrite(ledPin, HIGH);   // if Touch sensor is HIGH, then turn on
     }
   else{
        digitalWrite(ledPin, LOW);    // if Touch sensor is LOW, then turn off the led
     }
}


Result
Done wiring and powered up, upload well the code, then touch the sensor with your finger, both D2 led on the sensor and D13 indicator on UNO board are on. Otherwise, those two indicators are turned off.
thumb


Project 15: Knock Module

This is a knock sensor module. When you knock it, it can send a momentary signal. You can combine it with Arduino to make some interesting experiment, e.g. electronic drum.

  • Working voltage: 5V


thumb


Connection Diagram
thumb


Sample Code

int Led=13;//define LED interface
int Shock=3;//define knock sensor interface
int val;//define digital variable val
void setup()
{
pinMode(Led,OUTPUT);//define LED to be output interface
pinMode(Shock,INPUT);//define knock sensor to be output interface
}
void loop()
{
val=digitalRead(Shock);//read the value of interface3 and evaluate it to val
if(val==HIGH)//when the knock sensor detect a signal, LED will be flashing
{
digitalWrite(Led,LOW);
}
else
{
digitalWrite(Led,HIGH);
}
}


Result
Upload the code to the board. When the sensor detects a knock signal, both the led on the sensor and led 13 on the UNO board are turned on.


Extension
You can extend to connect an external LED; when knock the sensor, the external LED will turn on. For example:

thumb



Project 16: Hall Magnetic Sensor

Introduction
This is a Magnetic Induction Sensor. It senses the magnetic materials within a detection range up to 3cm. The detection range and the strength of the magnetic field are proportional.The output is digital on/off. This sensor uses the SFE Reed Switch - Magnetic Field Sensor.

thumb


Specification

  • Sensing magnetic materials
  • Detection range: up to 3cm
  • Output: digital on/off
  • Detection range and magnetic field strength are proportional


Connection Diagram
thumb


Sample Code

int ledPin = 13;                // choose the pin for the LED
int inputPin = 3;               // Connect sensor to input pin 3 
int val = 0;                    // variable for reading the pin status
 
void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare push button as input
}
 
void loop(){
  val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    digitalWrite(ledPin, LOW);  // turn LED OFF
  } else {
    digitalWrite(ledPin, HIGH); // turn LED ON
  }
}


Result
Wire it up and upload well the code to board, you will see that D13 indicator on UNO board is off, and led on the module is also off. But if put a magnetic ball close to the hall module, you will see the D13 indicator on UNO board is turned on, and led on the module is also turned on.
thumb



Project 17: Line Tracking Sensor

Introduction
This Line Tracking Sensor can detect white lines in black and black lines in white. The single line-tracking signal provides a stable output signal TTL for a more accurate and more stable line.
Multi-channel option can be easily achieved by installing required line-tracking robot sensors.
thumb


Specification

  • Power supply: +5V
  • Operating current: <10mA
  • Operating temperature range: 0°C ~ + 50°C
  • Output interface: 3-PIN (1 - signal ; 2 - power ; 3 - power supply negative)
  • Output Level: TTL level


Connection Diagram
thumb


Sample Code

///Arduino Sample Code
void setup()
{
  Serial.begin(9600);
}
void loop()
{
  Serial.println(digitalRead(3)); // print the data from the sensor
  delay(500);
}


Result
Done uploading the code to board, open the serial monitor and set the baud rate as 9600, then you can see the data from the sensor. Shown below.
thumb



Project 18: Infrared Obstacle Avoidance


thumb

Introduction
Infrared obstacle avoidance sensor is equipped with distance adjustment function and is especially designed for wheeled robots.
This sensor has strong adaptability to ambient light and is of high precision. It has a pair of infrared transmitting and receiving tube. When infrared ray launched by the transmitting tube encounters an obstacle (its reflector), the infrared ray is reflected to the receiving tube, and the indicator will light up; the signal output interface outputs digital signal.

We can adjust the detection distance through the potentiometer knob (effective distance: 2~40cm, working Voltage: 3.3V-5V ).
Thanks to a wide voltage range, this sensor can work steadily even under fluctuating power supply voltage and is suitable for the use of various micro-controllers,Arduino controllers and BS2 controllers. A robot mounted with the sensor can sense changes in the environment.


Specification

  • Working voltage: DC 3.3V-5V
  • Working current: ≥20mA
  • Working temperature: -10℃ to+50℃
  • Detection distance: 2-40cm
  • IO Interface: 4 PIN (-/+/S/EN)
  • Output signal: TTL voltage
  • Accommodation mode: Multi-circle resistance regulation
  • Effective Angle: 35°


Connection Diagram
thumb


Sample Code

const int sensorPin = 3;     // the number of the sensor pin
const int ledPin =  13;      // the number of the LED pin
int sensorState = 0;         // variable for reading the sensor status
void setup() {
  pinMode(ledPin, OUTPUT);      
  pinMode(sensorPin, INPUT); }
void loop(){
  // read the state of the sensor value:
  sensorState = digitalRead(sensorPin);
  // if it is, the sensorState is HIGH:
  if (sensorState == HIGH) {     
     digitalWrite(ledPin, HIGH);  
  } 
  else {
       digitalWrite(ledPin, LOW); 
  }
}


Result
Done uploading the code to board, you can see the led on both UNO board and obstacle detector sensor is turned on.
If we put a foam block in front of the sensor, this time when sensor detects the obstacle, sled on the sensor will be turned on.
thumb


Project 19: PIR Motion Sensor


thumb

Introduction:
Pyroelectric infrared motion sensor can detect infrared signals from a moving person or moving animal, and output switching signals. It can be applied to a variety of occasions to detect the movement of human body. Conventional pyroelectric infrared sensors require body pyroelectric infrared detector, professional chip, complex peripheral circuit, so the size is bigger, with complex circuit, and lower reliability. Now we launch this new pyroelectric infrared motion sensor, specially designed for Arduino. It uses an integrated digital body pyroelectric infrared sensor, has smaller size, higher reliability, lower power consumption and simpler peripheral circuit.


Specification:

  • Input Voltage: 3.3 ~ 5V, 6V Maximum
  • Working Current: 15uA
  • Working Temperature: -20 ~ 85 ℃
  • Output Voltage: High 3V, low 0V
  • Output Delay Time (High Level): About 2.3 to 3 Seconds
  • Detection angle: 100 °
  • Detection distance: 7 meters
  • Output Indicator LED (When output HIGH, it will be ON)
  • Pin limit current: 100mA


Connection Diagram:
Connect the S pin of module to Digital 3 of UNO board, connect the negative pin to GND port, positive pin to 5V port.
Ks0052.jpg


Sample Code:

byte sensorPin = 3;
byte indicator = 13;
void setup()
{
  pinMode(sensorPin,INPUT);
  pinMode(indicator,OUTPUT);
  Serial.begin(9600);
}


void loop()
{
  byte state = digitalRead(sensorPin);
  digitalWrite(indicator,state);
  if(state == 1)Serial.println("Somebody is in this area!");
  else if(state == 0)Serial.println("No one!");
  delay(500);
}


Result
Done wiring and powered up, upload well the code, if the sensor detects someone moving nearby, D13 indicator on UNO board will light up, and "Somebody is in this area!" is displayed on the serial monitor.
If no movement, D13 indicator on UNO board not lights, and "No one!" is displayed on the serial monitor.
KS0335-4.jpg


Project 20: Flame Sensor


thumb

Introduction
This flame sensor can be used to detect fire or other lights with wavelength stands at 760nm ~ 1100nm.
In the fire-fighting robot game, the flame plays an important role in the probe, which can be used as the robot's eyes to find fire source.


Specification

  • Supply Voltage: 3.3V to 5V
  • Detection Range: 20cm (4.8V) ~ 100cm (1V)
  • Rang of Spectral Bandwidth: 760nm to 1100nm
  • Operating Temperature: -25℃ to 85℃
  • Interface: Digital


Connection Diagram
Connect the D0 pin to digital 2, GND pin to GND port, VCC pin to 5V port.
thumb


Sample Code

const int flamePin = 2;     // the number of the flame pin
const int ledPin =  13;      // the number of the LED pin
// variables will change:
int State = 0;         // variable for reading status
void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(flamePin, INPUT);     
}
void loop(){
  // read the state of the value:
State = digitalRead(flamePin);
  if (State == HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
  } 
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW); 
}


Result
Done wiring and powered up, upload well the code to the board. Then if you put a lighter close to the sensor, when the sensor detects the flame, another led on the sensor is turned on.
thumb



Project 21: Vibration Sensor


thumb

Introduction
What's the simplest way to check vibration with Arduino? Well, use a vibration sensor from keyestudio. You can directly plug it on our sensor Shield V5, vibrate this sensor, and Arduino can receive a digital signal, making it easy to make computation and programs in Arduino.
Despite its simplicity, you can make full use of it with creative thinking, step counting, and crash warning light etc.


Specification:

  • IO Type: Digital
  • Supply Voltage: 3.3V to 5V


Connection Diagram:

thumb


Sample Code:

#define SensorLED     13
#define SensorINPUT   3  //Connect the sensor to digital Pin 3 which is Interrupts 1.
 unsigned char state = 0;
 void setup() 
{ 
  pinMode(SensorLED, OUTPUT); 
  pinMode(SensorINPUT, INPUT);
  attachInterrupt(1, blink, FALLING);// Trigger the blink function when the falling edge is detected
  }
void loop()
{  if(state!=0)
      {

        state = 0;
        digitalWrite(SensorLED,HIGH);
        delay(500);
      }  
      else
        digitalWrite(SensorLED,LOW);
} 
void blink()//Interrupts function
{  state++;
}


Project 22: Analog Gas Sensor


thumb

Introduction
This analog gas sensor - MQ2 is used in gas leakage detecting equipment in consumer electronics and industrial markets. This sensor is suitable for detecting LPG, I-butane, propane, methane, alcohol, Hydrogen and smoke. It has high sensitivity and quick response. In addition, the sensitivity can be adjusted by the potentiometer.


Specification

  • Power supply: 5V
  • Interface type: Analog
  • Wide detecting scope
  • Quick response and High sensitivity
  • Simple drive circuit
  • Stable and long lifespan


Connection Diagram

thumb


Sample Code

///Arduino Sample Code
void setup()
{
  Serial.begin(9600); //Set serial baud rate to 9600 bps
}
void loop()
{
int val;
val=analogRead(0);//Read Gas value from analog 0
Serial.println(val,DEC);//Print the value to serial port
delay(100);
}


Result
Done wiring and powered up, upload well the code, then open the serial monitor and set the baud rate as 9600, you will see the analog value.
When detecting the gas, the value will make a change.
thumb


Project 23: Analog Alcohol Sensor


thumb

Introduction
This analog gas sensor - MQ3 is suitable for detecting alcohol. It can be used in a breath analyzer.
It has good selectivity because it has higher sensitivity to alcohol and lower sensitivity to Benzine.
The sensitivity can be adjusted by rotating the potentiometer.


Specification

  • Power Supply: 5V
  • Interface Type: Analog
  • Quick response and High sensitivity
  • Simple drive circuit
  • Stable and long service life


Connection Diagram
thumb


Sample Code

///Arduino Sample Code
void setup()
{
  Serial.begin(9600); //Set serial baud rate to 9600 bps
}
void loop()
{
int val;
val=analogRead(0);//Read Gas value from analog 0
Serial.println(val,DEC);//Print the value to serial port
delay(100);
}


Result
thumb
Done wiring and powered up, upload well the code, then open the serial monitor and set the baud rate as 9600, you will see the analog value.
When detecting the alcohol gas, the value will make a change.
thumb



Project 24: Digital IR Transmitter

Introduction
IR Transmitter Module is designed for IR communication which is widely used for operating the television device from a short line-of-sight distance. The remote control is usually contracted to remote.
Since infrared (IR) remote controls use light, they require line of sight to operate the destination device. The signal can, however, be reflected by mirrors, just like any other light sources.
If operation is required where no line of sight is possible, for instance when controlling equipment in another room or installed in a cabinet, many brands of IR extenders are available for this on the market. Most of these have an IR receiver, picking up the IR signal and relaying it via radio waves to the remote part, which has an IR transmitter mimicking the original IR control.
Infrared receivers also tend to have a more or less limited operating angle, which mainly depends on the optical characteristics of the phototransistor. However, it’s easy to increase the operating angle using a matte transparent object in front of the receiver.
thumb


Specification

  • Power Supply: 3-5V
  • Infrared Center Frequency: 850nm-940nm
  • Infrared Emission Angle: about 20degree
  • Infrared Emission Distance: about 1.3m (5V 38Khz)
  • Mounting Hole: inner diameter is 3.2mm, spacing is 15mm


Connection Diagram
thumb


Sample Code 1:

int led = 3;
void setup() {                
   pinMode(led, OUTPUT);     
}
void loop() {
  digitalWrite(led, HIGH);  
  delay(1000);               
  digitalWrite(led, LOW);   
  delay(1000); 
}


In the darkness of the environment, you are going to see blinking blue light on phone's screen when using camera to shoot the infrared LED.
Upload well the above code to the board, the led on the sensor will blink red light.
In the following, let’s move on to an interactive example between IR receiver and IR transmitter module.



Infrared Remote/Communication:

Hardware List

  • UNO R3 x2
  • Digital IR Receiver x1
  • IR Transmitter Module x1

Get Arduino library Arduino-IRremote and install it.


Note: here if you have no two main boards, you can replace it with the breadboard for connection, may be more easier and convenient.


Connection Diagram
For IR Transmitter:
Notice: Arduino-IRremote only supports D3 as transmitter.

thumb


For IR Receiver:
connect it to D11 port.
thumb


Upload code 2 to the UNO connected with IR Transmitter:

 #include <IRremote.h>
  IRsend irsend;
 void setup()
 {}
 void loop() {
  irsend.sendRC5(0x0, 8); //send 0x0 code (8 bits)
     delay(200);
  irsend.sendRC5(0x1, 8); 
     delay(200); }



Upload code 3 to the UNO connected with IR Receiver:

#include <IRremote.h>
 const int RECV_PIN = 11;
 const int LED_PIN = 13;
 IRrecv irrecv(RECV_PIN);
 decode_results results;
 void setup()
 {Serial.begin(9600);
   irrecv.enableIRIn(); // Start the receiver
 }
  void loop() 
 {if (irrecv.decode(&results)) 
   { if ( results.bits > 0 )
     {
       int state;
       if ( 0x1 == results.value )	
       {		
         state = HIGH;
       }
       else
       {
       	state = LOW;
       }
 		digitalWrite( LED_PIN, state );			
     }
  irrecv.resume();        // prepare to receive the next value
   }}



Test Result
When IR Receiver module receives the infrared signal from IR Transmitter, D1 led on the IR Receiver module will blink.Shown as below figure.
thumb



Project 25: Digital IR Receiver

Introduction
IR is widely used in remote control. With this IR receiver, Arduino project is able to receive command from any IR remoter controllers if you have right decoder. Well, it will be also easy to make your own IR controller using IR transmitter.
thumb


Specification

  • Power Supply: 5V
  • Interface: Digital
  • Modulation Frequency: 38Khz


Connection Diagram
The following image shows a suggested connection method. You may use any Digital I/O pin that is not in use by another device.
thumb

NOTE: In the sample code below Digital pin 11 is in use, you may either change your wiring or change the sample code to match.


Sample Code
Note: before compiling the code, do remember to place the library into libraries directory of Arduino IDE. Otherwise, compiling will fail.

#include <IRremote.h>
 int RECV_PIN = 11;
 IRrecv irrecv(RECV_PIN);
 decode_results results;
 void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}
 void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
}


IR Remote Library includes some sample codes for sending and receiving:
IR Remote Library


Result
Done wiring and uploading the code, then control the IR receiver module by an infrared remote control, D1 led will flash. Shown as below.
thumb



Project 26: Rotary Encoder

Introduction
The rotary encoder can count the pulse outputting times during the process of rotation in positive and reverse direction by rotating.
This rotating counting is unlimited, not like potential counting. It can be restored to initial state to count from 0.
thumb


Specification

  • Power Supply: 5V
  • Interface: Digital


Connection Diagram
thumb


Sample Code

const int interruptA = 0;       
const int interruptB = 1;       
int CLK = 2;     // PIN2
int DAT = 3;     // PIN3
int BUTTON = 4;  // PIN4
int LED1 = 5;    // PIN5
int LED2 = 6;    // PIN6
int COUNT = 0;

void setup() 
 {
  attachInterrupt(interruptA, RoteStateChanged, FALLING);
 // attachInterrupt(interruptB, buttonState, FALLING);
  pinMode(CLK, INPUT); 
  digitalWrite(2, HIGH);  // Pull High Restance  
  pinMode(DAT, INPUT); 
  digitalWrite(3, HIGH);  // Pull High Restance 
 
pinMode(BUTTON, INPUT); 
  digitalWrite(4, HIGH);  // Pull High Restance
  pinMode(LED1, OUTPUT); 
  pinMode(LED2, OUTPUT); 
   Serial.begin(9600);
 }


void loop() 
{
  if  (!(digitalRead(BUTTON))) 
    {
     COUNT = 0;  
     Serial.println("STOP COUNT = 0");
     digitalWrite(LED1, LOW);
     digitalWrite(LED2, LOW);
     delay (2000);
    }
     Serial.println(COUNT);  
}

//-------------------------------------------
void RoteStateChanged() //When CLK  FALLING READ DAT
{
 if  (digitalRead(DAT)) // When DAT = HIGH IS FORWARD
   {
    COUNT++;
    digitalWrite(LED1, HIGH);
    digitalWrite(LED2, LOW);
    delay(20);
   }
 else                   // When DAT = LOW IS BackRote
   {
    COUNT--;
    digitalWrite(LED2, HIGH);
    digitalWrite(LED1, LOW);
    delay(20);
   }
}


Result
Wiring well and uploading the above code, you can rotate the encoder module to randomly control two LED modules on and off.
When you rotate the encoder module, one LED module is turned on first but another one is off. If you continue to rotate the encoder module, one LED module becomes off while another one is turned on, repeatedly.
thumb



Project 27: LM35 Linear Temperature

Introduction
LM35 Linear Temperature Sensor is based on semiconductor LM35 temperature sensor. It can be used to detect ambient air temperature.
This sensor offers a functional range among 0 degree Celsius to 100 degree Celsius. Sensitivity is 10mV per degree Celsius. The output voltage is proportional to the temperature.
This sensor is commonly used as a temperature measurement sensor. It includes thermocouples, platinum resistance, and thermal resistance and temperature semiconductor chips.
The chip is commonly used in high temperature measurement thermocouples. Platinum resistance temperature sensor is used in the measurement of 800 degrees Celsius, while the thermal resistance and semiconductor temperature sensor is suitable for measuring the temperature of 100-200 degrees or below, in which the application of a simple semiconductor temperature sensor is good in linearity and high in sensitivity. The LM35 linear temperature sensor and sensor-specific Arduino shield can be easily combined.
thumb


Specification

  • Based on the semiconductor LM35 temperature sensor
  • Can be used to detect ambient air temperature
  • Sensitivity: 10mV per degree Celcius
  • Functional Range: 0 degree Celsius to 100 degree Celsius


Connection Diagram
thumb


Sample Code

void setup()
{
    Serial.begin(9600);//Set Baud Rate to 9600 bps
}
 void loop()
{  int val;
    int dat;
    val=analogRead(0);//Connect LM35 on Analog 0
    dat=(500 * val) /1024;;
    Serial.print("Temp:"); //Display the temperature on Serial monitor
    Serial.print(dat);
    Serial.println("C");
    delay(500);
}


Result

thumb
Wire it up as the above diagram and upload well the code to the board, then open the serial monitor and set the baud rate as 9600, finally you will see the current temperature value shown below. The value may be slight difference due to different place and weather.
thumb



Project 28: 18B20 Temperature Sensor


thumb

Introduction:
DS18B20 is a digital temperature sensor. It can be used to quantify environmental temperature testing.
The temperature range is -55 ~ +125 ℃, inherent temperature resolution 0.5 ℃. It also support multi-point mesh networking.
The DS18B20 can be deployed to achieve multi-point temperature measurement. It has a 9-12 bit serial output.


Specification:

  • Supply Voltage: 3.3V to 5V
  • Temperature range: -55 °C ~ +125 °C
  • Interface: Digital


Connection Diagram:

thumb


Sample Code:
OneWire Library Download: http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip

#include <OneWire.h>
 int DS18S20_Pin = 2; //DS18S20 Signal pin on digital pin 2
 //Temperature chip i/o
OneWire ds(DS18S20_Pin);  // on digital pin 2
 void setup(void) {
  Serial.begin(9600);
}
 void loop(void) {
  float temperature = getTemp();
  Serial.println(temperature);
   
  delay(100); //to slow down the output so it is easier to read 
}
float getTemp(){
  //returns the temperature from one DS18S20 in DEG Celsius
 
  byte data[12];
  byte addr[8];
 
  if ( !ds.search(addr)) {
      //no more sensors on chain, reset search
      ds.reset_search();
      return -1000;
  }
 
  if ( OneWire::crc8( addr, 7) != addr[7]) {
      Serial.println("CRC is not valid!");
      return -1000;
  }
 
  if ( addr[0] != 0x10 && addr[0] != 0x28) {
      Serial.print("Device is not recognized");
      return -1000;
  }
 
  ds.reset();
  ds.select(addr);
  ds.write(0x44,1); // start conversion, with parasite power on at the end
 
  byte present = ds.reset();
  ds.select(addr);    
  ds.write(0xBE); // Read Scratchpad
 
  for (int i = 0; i < 9; i++) { // we need 9 bytes
    data[i] = ds.read();
  }
  ds.reset_search();
   
  byte MSB = data[1];
  byte LSB = data[0];
 
  float tempRead = ((MSB << 8) | LSB); //using two's compliment
  float TemperatureSum = tempRead / 16;  
  return TemperatureSum;
}

Done uploading the code to the board, open the serial monitor, and you can see the measured temperature data.


Project 29: ADXL345 Three Axis Acceleration

Introduction:
The ADXL345 is a small, thin, low power, 3-axis MEMS accelerometer with high resolution (13-bit) measurement at up to +-16 g. Digital output data is formatted as 16-bit twos complement and is accessible through either a SPI (3- or 4-wire) or I2C digital interface.
The ADXL345 is well suited to measure the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion or shock. Its high resolution (4 mg/LSB) enables measurement of inclination changes less than 1.0 degrees.
thumb


Specification

  • 2.0-3.6VDC Supply Voltage
  • Ultra Low Power: 40uA in measurement mode, 0.1uA in standby@ 2.5V
  • Tap/Double Tap Detection
  • Free-Fall Detection
  • SPI and I2C Interface


Connection Diagram
thumb


Sample Code
The circuit connection is follows:

  • VCC: 5V
  • GND: ground
  • SCL: UNO A5
  • SDA: UNO A4
#include <Wire.h>
// Registers for ADXL345
#define ADXL345_ADDRESS (0xA6 >> 1)  // address for device is 8 bit but shift to the
                                     // right by 1 bit to make it 7 bit because the
                                     // wire library only takes in 7 bit addresses
#define ADXL345_REGISTER_XLSB (0x32)

int accelerometer_data[3];
// void because this only tells the cip to send data to its output register
// writes data to the slave's buffer
void i2c_write(int address, byte reg, byte data) {

  // Send output register address
  Wire.beginTransmission(address);
  // Connect to device
  Wire.write(reg);
  // Send data
  Wire.write(data); //low byte
  Wire.endTransmission();
}

// void because using pointers
// microcontroller reads data from the sensor's input register
void i2c_read(int address, byte reg, int count, byte* data) {
  // Used to read the number of data received
  int i = 0;
  // Send input register address
  Wire.beginTransmission(address);
  // Connect to device
  Wire.write(reg);
  Wire.endTransmission();

  // Connect to device
  Wire.beginTransmission(address);
  // Request data from slave
  // Count stands for number of bytes to request
  Wire.requestFrom(address, count);
  while(Wire.available()) // slave may send less than requested
  {
    char c = Wire.read(); // receive a byte as character
    data[i] = c;
    i++;
  }
  Wire.endTransmission();
}

void init_adxl345() {
  byte data = 0;

  i2c_write(ADXL345_ADDRESS, 0x31, 0x0B);   // 13-bit mode  +_ 16g
  i2c_write(ADXL345_ADDRESS, 0x2D, 0x08);   // Power register


  i2c_write(ADXL345_ADDRESS, 0x1E, 0x00);   // x
  i2c_write(ADXL345_ADDRESS, 0x1F, 0x00);   // Y
  i2c_write(ADXL345_ADDRESS, 0x20, 0x05);   // Z
 
  // Check to see if it worked!
  i2c_read(ADXL345_ADDRESS, 0X00, 1, &data);
  if(data==0xE5)
    Serial.println("it work Success");
  else
    Serial.println("it work Fail");
}

void read_adxl345() {
  byte bytes[6];
  memset(bytes,0,6);

  // Read 6 bytes from the ADXL345
  i2c_read(ADXL345_ADDRESS, ADXL345_REGISTER_XLSB, 6, bytes);
  // Unpack data
  for (int i=0;i<3;++i) {
    accelerometer_data[i] = (int)bytes[2*i] + (((int)bytes[2*i + 1]) << 8);
  }
}
// initialise and start everything
void setup() {
  Wire.begin();
  Serial.begin(9600);
  for(int i=0; i<3; ++i) {
    accelerometer_data[i]  = 0;
  }
  init_adxl345();
}


void loop() {
  read_adxl345();
  Serial.print("ACCEL: ");
  Serial.print(float(accelerometer_data[0])*3.9/1000);//3.9mg/LSB scale factor in 13-bit mode
  Serial.print("\t");
  Serial.print(float(accelerometer_data[1])*3.9/1000);

  Serial.print("\t");
  Serial.print(float(accelerometer_data[2])*3.9/1000);
  Serial.print("\n");
  delay(100);
}


Result
thumb
Wiring as the above diagram and power on, then upload the code and open the serial monitor, it will display the triaxial acceleration of sensor and its status, as the graph shown below.
thumb


Project 30: DHT11 Temperature and Humidity Sensor

Introduction
This DHT11 Temperature and Humidity Sensor is a composite sensor which contains a calibrated digital signal output of the temperature and humidity.
Its technology ensures high reliability and excellent long-term stability. A high-performance 8-bit microcontroller is connected.
This sensor includes a resistive element and a sense of wet NTC temperature measuring devices. It has excellent quality, fast response, anti-interference ability and high cost performance advantages.
Each DHT11 sensor features extremely accurate calibration data of humidity calibration chamber. The calibration coefficients stored in the OTP program memory, internal sensors detect signals in the process, and we should call these calibration coefficients.
The single-wire serial interface system is integrated to make it quick and easy. Qualities of small size, low power, and 20-meter signal transmission distance make it a wide applied application or even the most demanding one. Convenient connection, special packages can be provided according to users’ need.
thumb


Specification

  • Supply Voltage: +5 V
  • Temperature Range: 0-50 °C error of ± 2 °C
  • Humidity: 20-90% RH ± 5% RH error
  • Interface: Digital


Connection Diagram
thumb


Sample Code
Download the DHT11Lib.Or to see the website

Note: before compiling the code, do remember to place the library into libraries directory of Arduino IDE. Otherwise, compiling will fail.

#include <dht11.h>
dht11 DHT;
#define DHT11_PIN 4
  
void setup(){
  Serial.begin(9600);
  Serial.println("DHT TEST PROGRAM ");
  Serial.print("LIBRARY VERSION: ");
  Serial.println(DHT11LIB_VERSION);
  Serial.println();
  Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
}
  
void loop(){
  int chk;
  Serial.print("DHT11, \t");
  chk = DHT.read(DHT11_PIN);    // READ DATA
  switch (chk){
    case DHTLIB_OK:  
                Serial.print("OK,\t"); 
                break;

case DHTLIB_ERROR_CHECKSUM: 

                Serial.print("Checksum error,\t"); 
                break;
    case DHTLIB_ERROR_TIMEOUT: 
                Serial.print("Time out error,\t"); 
                break;
    default: 
                Serial.print("Unknown error,\t"); 
                break;
  }
 // DISPLAT DATA
  Serial.print(DHT.humidity,1);
  Serial.print(",\t");
  Serial.println(DHT.temperature,1);
  
  delay(1000);
}


Result
Wire it up well and upload the above code to UNO board.
thumb

Then open the serial monitor and set the baud rate as 9600, finally you will see the current temperature and humidity value.
thumb


Project 31: Bluetooth Module


thumb


Introduction
This Bluetooth module can easily achieve serial wireless data transmission. Its operating frequency is among the most popular 2.4GHz ISM frequency band (i.e. Industrial, scientific and medical).
It adopts Bluetooth 2.1+EDR standard. In Bluetooth 2.1, signal transmit time of different devices stands at a 0.5 seconds interval, so that the workload of Bluetooth chip can be reduced substantially and more sleeping time can be saved for Bluetooth.
This module is set with serial interface, which is easy-to-use and simplifying overall design/development cycle.


Specification

  • Bluetooth protocol: Bluetooth 2.1+ EDR standard
  • USB protocol: USB v1.1/2.0
  • Operating frequency: 2.4GHz ISM frequency band
  • Modulation mode: Gauss frequency Shift Keying
  • Transmit power: ≤ 4dBm, second stage
  • Sensitivity: ≤-84dBm at 0.1% Bit Error Rate
  • Transmission speed: 2.1Mbps(Max)/160 kbps (Asynchronous); 1Mbps/1Mbps (Synchronous)
  • Safety feature: Authentication and encryption
  • Supported configuration: Bluetooth serial port (major and minor)
  • Supply Voltage: 5 V DC 50mA
  • Operating temperature: -20 to 55℃


Connection Diagram
thumb


Sample Code

int val; 
int ledpin=13; 
void setup() 
{ 
Serial.begin(9600);
 pinMode(ledpin,OUTPUT); 
} void loop()
{ val=Serial.read(); 
if(val=='a')
 { 
digitalWrite(ledpin,HIGH); 
delay(250); 
digitalWrite(ledpin,LOW); 
delay(250);
 Serial.println("keyestudio");
}
}


Project 32: TEMT6000 Ambient Light


thumb

Introduction:
At some point you are going to sense ambient brightness with better precision than your trusty photoresistor without adding complexity to your project. When that day comes, go get yourself a TEMT6000 ambient light sensor.
The TEMT6000 is supposed to be adapted to the sensitivity of the human eye, but found it preformed sub-par in low light conditions.
It does however work very well reacting to very small changes in a large range of brightness. Because it is meant to mimic the human eye, it does not react well to IR or UV light, so just make sure to note that when using it in your project.


Specification

  • Supply Voltage: +5VDC 50mA
  • Size: 36.5*16mm
  • Weight: 4g


Connection Diagram
This is an incredibly simple part, just connect power and ground, and the signal pin to your favorite analog input and you are done, the sensor will output analog voltage, that ramps up when it gets brighter.
You can power this off of 3.3v as you like, the output value will just be lower.

thumb


Sample Code
You can not get more simpler than this – This just reports the reading from the sensor to the serial terminal: 0-1023 with 1023 being very bright, and 0 being very dark.

int temt6000Pin = 0;
void setup() {
 Serial.begin(9600);
}
void loop() {
 int value = analogRead(temt6000Pin);
 Serial.println(value);
 delay(100); //only here to slow down the output so it is easier to read
}


Result
Wiring well and uploading the code above, open the serial monitor of Arduino software.
thumb
Then cover the sensor with your hand or a paper, the light becomes weak, finally you will see the value showed on monitor decrease.
thumb



Project 33: SR01 Ultrasonic Sensor

Introduction
The Keyestudio SR01 Ultrasonic Sensor is a very affordable proximity/distance sensor that has been used mainly for object avoidance in various robotics projects.
It essentially gives your Arduino eyes/spacial awareness and can prevent your robot from crashing or falling off a table. It has also been used in turret applications, water level sensing, and even as a parking sensor.
This simple project will use the Keyestudio SR01 Ultrasonic Sensor with an Arduino and a Processing sketch to provide a neat little interactive display on your computer screen.

thumb


Specification

  • Working Voltage: DC 5V
  • Working Current: 15mA
  • Working Frequency: 40Hz
  • Max Range: 5m
  • Min Range: 2cm
  • Measuring Angle: 15 degree
  • Trigger Input Signal: 10µS TTL pulse
  • Echo Output Signal Input TTL lever signal and the range in proportion


Connection Diagram
thumb

SR01 Ultrasonic Sensor UNO
VCC 5V
GND GND
Echo Digital Pin 7
Trig Digital Pin 8


Sample Code

  • VCC to arduino 5v
  • GND to arduino GND
  • Echo to Arduino pin 7
  • Trig to Arduino pin 8
#define echoPin 7 // Echo Pin
#define trigPin 8 // Trigger Pin
#define LEDPin 13 // Onboard LED

int maximumRange = 200; // Maximum range needed
int minimumRange = 0; // Minimum range needed
long duration, distance; // Duration used to calculate distance

void setup() {
 Serial.begin (9600);
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);
 pinMode(LEDPin, OUTPUT); // Use LED indicator (if required)
}

void loop() {
/* The following trigPin/echoPin cycle is used to determine the
 distance of the nearest object by bouncing soundwaves off of it. */ 
 digitalWrite(trigPin, LOW); 
 delayMicroseconds(2); 

 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10); 
 digitalWrite(trigPin, LOW);

 duration = pulseIn(echoPin, HIGH);
 
 //Calculate the distance (in cm) based on the speed of sound.
 distance = duration/58.2;
 
 if (distance >= maximumRange || distance <= minimumRange){
 /* Send a negative number to computer and Turn LED ON 
 to indicate "out of range" */
 Serial.println("-1");
 digitalWrite(LEDPin, HIGH); 
 }
 else {
 /* Send the distance to the computer using Serial protocol, and
 turn LED OFF to indicate successful reading. */
 Serial.println(distance);
 digitalWrite(LEDPin, LOW); 
 }
 
 //Delay 50ms before next reading.
 delay(50);
}


Result
thumb
After upload the code to the board, open the serial monitor of Arduino IDE, you can see the distance value measured by ultrasonic sensor.
thumb


Project 34: Joystick Module

Introduction
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.
thumb


Specification

  • Supply Voltage: 3.3V to 5V
  • Interface: Analog x2, Digital x1


Connection Diagram
thumb


Sample Code

int JoyStick_X = 0; //x
int JoyStick_Y = 1; //y
int JoyStick_Z = 3; //key
  void setup() 
{
  pinMode(JoyStick_Z, INPUT); 
  Serial.begin(9600); // 9600 bps
}
void loop() 
{
  int x,y,z;
  x=analogRead(JoyStick_X);
  y=analogRead(JoyStick_Y);
  z=digitalRead(JoyStick_Z);
  Serial.print(x ,DEC);
  Serial.print(",");
  Serial.print(y ,DEC);
  Serial.print(",");
  Serial.println(z ,DEC);
  delay(100);
}


Result
thumb
Wiring well and uploading the code, open the serial monitor and set the baud rate to 9600, push the joystick, you will see the value shown below.
thumb


Project 35: DS3231 Clock Module

Introduction
DS3231 is equipped with integrated TCXO and crystal, which make it a cost-effective I2C real time clock with high precision.
The device carries a battery input, so if you disconnect the main power supply, it can still maintain accurate timing.
The integrated oscillator ensures the long-term accuracy of the device and reduces the number of components.
DS3231 provides both commercial and industrial temperature range and supports 16 pins small-outline package (300mil).
The module itself can adapt to the system of 3.3V and 5V without level switch, which is quite convenient!

thumb


Specification

  • Temperature range: -40 to +85; Timing accuracy: ± 5ppm (±0.432 seconds/day)
  • Provide battery backup for continuous timing
  • Low power consumption
  • Device package and function compatible with DS3231
  • Complete clock calendar function contains seconds and minutes, hour, week, date, month, and year timing and provides leap year compensation until 2100.
  • Two calendar clock
  • Output: 1Hz and 32.768kHz
  • Reset output and Input Debounce of Pushbutton
  • High speed (400kHz), I2C serial bus
  • Supply voltage: +3.3V to +5.5V
  • Digital temperature sensor with a precision of±3℃
  • Working temperature: -40 ~ C to +85 ~ C
  • 16 pins Small Outline Package (300mil)


Connection Diagram
This module adopts the IIC test method, so we only need to connect SDA to Arduino A4; SCL to A5; positive pin to VCC; negative pin to GND.
thumb


Sample Code
Before compiling the code, you’d better put DS3231 library under file into Arduino catalogue.

#include <Wire.h>
#include "DS3231.h"
DS3231 RTC; //Create the DS3231 object
char weekDay[][4] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
//year, month, date, hour, min, sec and week-day(starts from 0 and goes to 6)
//writing any non-existent time-data may interfere with normal operation of the RTC.
//Take care of week-day also.
DateTime dt(2011, 11, 10, 15, 18, 0, 5);//open the serial port and you can check time here or make a change to the time as needed.
void setup () 
{   Serial.begin(57600);//set baud rate to 57600
    Wire.begin();
    RTC.begin();
    RTC.adjust(dt); //Adjust date-time as defined 'dt' above 
}
void loop () 
{  
 DateTime now = RTC.now(); //get the current date-time
    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.date(), DEC);

    Serial.print(' ');
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();
    Serial.print(weekDay[now.dayOfWeek()]);
    Serial.println();
    delay(1000);
}


Before compiling the code, you’d better put DS3231 library  under file into Arduino catalogue.
When the above steps are done, you can upload the code to arduino and open the serial monitor and get the following results:
thumb


Project 36: 5V Relay Module

Introducton
This single relay module can be used in interactive projects. It is active HIGH level. This module uses SONGLE 5v high-quality relay.
It can also be used to control lighting, electrical and other equipment.
The modular design makes it easy to expand with the Arduino board (not included). The relay output is by a light-emitting diode. It can be controlled through digital IO port, such as solenoid valves, lamps, motors and other high current or high voltage devices.
thumb


Specification

  • Type: Digital
  • Rated current: 10A (NO) 5A (NC)
  • Maximum switching voltage: 150VAC 24VDC
  • Digital interface
  • Control signal: TTL level
  • Rated load: 8A 150VAC (NO) 10A 24VDC (NO), 5A 250VAC (NO/NC) 5A 24VDC (NO/NC)
  • Maximum switching power: AC1200VA DC240W (NO) AC625VA DC120W (NC)
  • Contact action time: 10ms


Connection Diagram
Firstly you need to prepare the following parts by yourself before testing.

  • Arduino Board*1
  • Single relay module*1
  • LED module *1
  • USB Cable*1
  • Jumper Wire*8


thumb


Sample Code
Copy and paste the code below to Arduino software.

int Relay = 8;
  void setup()
{
  pinMode(13, OUTPUT);         //Set Pin13 as output
  digitalWrite(13, HIGH);     //Set Pin13 High
  pinMode(Relay, OUTPUT);     //Set Pin3 as output
}
void loop()
{
          digitalWrite(Relay, HIGH);   //Turn off relay
          delay(2000);
          digitalWrite(Relay, LOW);    //Turn on relay
          delay(2000);
}


Test Result
This relay module is active HIGH level.
Wire it up well, powered up, then upload the above code to the board.
You will see the relay is turned on(ON connected, NC disconnected)for two seconds, then turned off for two seconds(NC closed,ON disconnected), repeatedly and circularly.
When the relay is turned on, external LED is on. If relay is turned off, external LED is off.
thumb


Project 37: Vapor Sensor


thumb

Introduction:
Steam sensor is an analog sensor and can be made as a simple rainwater detector and liquid level switch. When humidity on the face of this sensor rises, output voltage will increase. Caution: connection parts is non-waterproof, so please don’t put them into water.


Performance Parameters

  • 1.Working Voltage: 3.3V or 5V
  • 2.Working Current: <20mA
  • 3.Range of Working Temperature: -10℃~+70℃
  • 4.Interface Type: Analog Signal Output


Pin Definition:

  • S:Signal Output
  • +:Power Supply(VCC)
  • -:Ground(GND)


Connection Diagram
thumb


Test Code

void setup()
{
Serial.begin(9600); //open serial port, and set baud rate at 9600bps
}
void loop()
{
int val;
val=analogRead(0); //plug vapor sensor into analog port 0
Serial.print("Moisture is ");
Serial.println(val,DEC); //read analog value through serial port printed
delay(100);
}


Result
When detecting different degrees of humidity, the sensor will get the feedback of different current value. Shown as the following picture.
When the sensor detects the steam of boiled water, the moisture value is displayed on serial monitor of Arduino software.
thumb



Resources

  • Video:

http://video.keyestudio.com/KS0068/

  • Libraries:

https://fs.keyestudio.com/KS0068



Buy from