Keyestudio KS0077 User manual

keyestudio
www.keyestudio.com
1
Super Learning Kit for Arduino

keyestudio
www.keyestudio.com
2
Content
1. Introduction..................................................................................................................................... 3
2. Component List............................................................................................................................... 3
3. Project List...................................................................................................................................... 9
4. Project Details............................................................................................................................... 10
Project 1: Hello World...............................................................................................................10
Project 2: LED Blinking............................................................................................................13
Project 3: PWM.........................................................................................................................15
Project 4: Traffic Light..............................................................................................................20
Project 5: LED Chasing Effect..................................................................................................23
Project 6: Button-Controlled LED............................................................................................ 25
Project 7: Active Buzzer............................................................................................................28
Project 8: Passive Buzzer..........................................................................................................31
Project 9: RGB LED................................................................................................................. 34
Project 10: Photo Resistor.........................................................................................................37
Project 11: Flame Sensor...........................................................................................................40
Project 12: LM35 Temperature Sensor..................................................................................... 44
Project 13: Tilt Switch...............................................................................................................47
Project 14: IR Remote Control..................................................................................................49
Project 15: Analog Value Reading............................................................................................ 58
Project 17: 1-digit LED Segment Display................................................................................ 64
Project 18: 4-digit LED Segment Display................................................................................ 71
Project 19: 8*8 LED Matrix......................................................................................................79
Project 20: 1602 LCD............................................................................................................... 83
Project 21: 9g Servo Control.....................................................................................................92
Project 22: 5V Stepper Motor................................................................................................... 97
Project 23: PIR Motion Sensor............................................................................................... 100
Project 24: Analog Gas Sensor................................................................................................102
Project 25: ADXL345 Three Axis Acceleration Module....................................................... 104
Project 26: HC-SR04 Ultrasonic Sensor.................................................................................109
Project 27: Joystick Module....................................................................................................112
Project 28: 5V Relay Module .................................................................................................114
Project 29: DS3231 Clock Module......................................................................................... 116
Project 30: DHT11 Temperature and Humidity Sensor .........................................................120
Project 31: Soil Humidity Sensor........................................................................................... 123
Project 32: RC522 RFID Module........................................................................................... 125

keyestudio
www.keyestudio.com
3
1. Introduction
keyestudio super learning kit is suitable for Arduino enthusiasts. This kit includes 32 projects with
detailed tutorials, starting from the basics to more complex projects. Different from other kits, it
adds some functional modules, such as RFID, temperature and humidity module. There is
connection diagram and code for each project, making it easy for you to learn.
2. Component List
No.
Product Name
Quantity
Picture
1
LED - Blue
5
2
LED - Red
5
3
LED - Yellow
5
4
LED - RGB
1

keyestudio
www.keyestudio.com
4
5
220 Ω Resistor
8
6
10K Ω Resistor
5
7
1K Ω resistor
5
8
10K Ω Potentiometer
1
9
Buzzer (Active)
1
10
Buzzer (Passive)
1
11
Large Button Switch
4

keyestudio
www.keyestudio.com
5
12
Ball Tilt Sensor
2
13
Photo Resistor
3
14
Flame Sensor
1
15
LM35 Temp Sensor
1
16
IC 74HC595N 16-pin DIP
1
17
7-seg LED Segment
Display
1
18
7-seg LED Segment
Display
1
19
8*8 LED Matrix
1

keyestudio
www.keyestudio.com
6
20
2x16 LCD display
1
21
IR Receiver
1
22
IR Remote Control
1
23
Servo Motor
1
24
Stepper Driver
1
25
Stepper Motor
1
26
Joystick Module
1

keyestudio
www.keyestudio.com
7
27
Relay Module
1
28
PIR Motion Sensor
1
29
Analog Gas Sensor
1
30
ADXL345 Three Axis
Acceleration Module
1
31
HC-SR04 Ultrasonic Sensor
1
32
DS3231 Clock Module
1

keyestudio
www.keyestudio.com
8
33
DHT11 Temperature and
Humidity Sensor
1
34
Soil Humidity Sensor
1
35
RC522 RFID Module
1
36
RFID Card
1
37
Access Key
1
38
Pin Headers
40

keyestudio
www.keyestudio.com
9
39
830-hole Breadboard
1
40
Dupont Wire
10
41
Jumper Wire
30
42
6-cell AA Battery Case
1
43
USB Cable
1
3. Project List
Project 1: Hello World
Project 2: LED Blinking
Project 3: PWM
Project 4: Traffic Light
Project 5: LED Chasing Effect
Project 6: Button-controlled LED
Project 7: Active Buzzer

keyestudio
www.keyestudio.com
10
Project 8: Passive Buzzer
Project 9: RGB LED
Project 10: Photo Resistor
Project 11: Flame Sensor
Project 12: LM35 Temperature Sensor
Project 13: Tilt Switch
Project 14: IR Remote Control
Project 15: Analog Value Reading
Project 16: 74HC595
Project 17: 1-digit LED Segment Display
Project 18: 4-digit LED Segment Display
Project 19: 8*8 LED Matrix
Project 20: 1602 LCD
Project 21: 9g Servo Control
Project 22: Stepper Motor
Project 23: PIR Motion Sensor
Project 24: Analog Gas Sensor
Project 25: ADXL345 Three Axis Acceleration Module
Project 26: HC-SR04 Ultrasonic Sensor
Project 27: Joystick Module
Project 28: 5V Relay Module
Project 29: DS3231 Clock Module
Project 30: DHT11 Temperature and Humidity Sensor
Project 31: Soil Humidity Sensor
Project 32: RC522 RFID Module
4. Project Details
Project 1: Hello World
Introduction
As for starters, we will begin with something simple. In this project, you only need an Arduino
and a USB Cable to start the "Hello World!" experiment. It is not only a communication test of
your Arduino and PC, but also a primer project for you to have your first try in the Arduino world!
Hardware Required
Arduino Board *1
USB Cable *1

keyestudio
www.keyestudio.com
11
Sample Code
After installing driver for Arduino, let's open Arduino software and compile code that enables
Arduino to print "Hello World!" under your instruction. Of course, you can compile code for
Arduino to continuously echo "Hello World!" without instruction. A simple If () statement will do
the instruction trick. With the onboard LED connected to pin 13, you can instruct the LED to blink
first when Arduino gets an instruction and then to print "Hello World!”.
//////////////////////////////////////////////////////////
int val;//define variable val
int ledpin=13;// define digital interface 13
void setup()
{
Serial.begin(9600);// set the baud rate at 9600 to match the software set up. When connected to
a specific device, (e.g. bluetooth), the baud rate needs to be the same with it.
pinMode(ledpin,OUTPUT);// initialize digital pin 13 as output. When using I/O ports on an
Arduino, this kind of set up is always needed.
}
void loop()
{
val=Serial.read();// read the instruction or character from PC to Arduino, and assign them to
Val.
if(val=='R')// determine if the instruction or character received is “R”.
{ // if it’s “R”,
digitalWrite(ledpin,HIGH);// set the LED on digital pin 13 on.
delay(500);
digitalWrite(ledpin,LOW);// set the LED on digital pin 13 off. delay(500);
Serial.println("Hello World!");// display“Hello World!”string.
}
}
////////////////////////////////////////////////////////////////

keyestudio
www.keyestudio.com
12
Test Result
Click to open the serial monitor, input an “ R”, LED 13 will blink once, PC will receive the
information from Arduino: Hello World
After choosing the proper port, the experiment is easy for you!

keyestudio
www.keyestudio.com
13
Project 2: LED Blinking
Introduction
Blinking LED experiment is quite simple. In the "Hello World!" program, we have come across
LED. This time, we are going to connect an LED to one of the digital pins rather than using
LED13 soldered to the board. Apart from an Arduino and a USB cable, you will need extra parts
as below:
Hardware Required
Red M5 LED*1
220ΩResistor*1
Breadboard*1
Breadboard Jumper Wires
Circuit Connection
We follow below diagram from the experimental schematic link. Here we use digital pin 10. We
connect LED to a 220 ohm resistor to avoid high current damaging the LED.

keyestudio
www.keyestudio.com
14
Connection for UNO R3:
Connection for 2560 R3:

keyestudio
www.keyestudio.com
15
Sample Code
//////////////////////////////////////////////////////////
int ledPin = 10; // define digital pin 10.
void setup()
{
pinMode(ledPin, OUTPUT);// define pin with LED connected as output.
}
void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on.
delay(1000); // wait for a second.
digitalWrite(ledPin, LOW); // set the LED off.
delay(1000); // wait for a second
}
//////////////////////////////////////////////////////////
Result
After uploading this program, in the experiment, you will see the LED connected to pin 10 turning
on and off, with an interval of approximate one second.
In this way, blinking LED experiment is now completed. Thank you!
Project 3: PWM

keyestudio
www.keyestudio.com
16
Introduction
PWM, short for Pulse Width Modulation, is a technique used to encode analog signal level into
digital ones. A computer cannot output analog voltage but only digital voltage values such as 0V
or 5V. So we use a high resolution counter to encode a specific analog signal level by modulating
the duty cycle of PMW. The PWM signal is also digitalized because in any given moment, fully
on DC power supply is either 5V (ON), or 0V (OFF). The voltage or current is fed to the analog
load (the device that uses the power) by repeated pulse sequence being ON or OFF. Being on, the
current is fed to the load; being off, it's not. With adequate bandwidth, any analog value can be
encoded using PWM. The output voltage value is calculated via the on and off time.
Output voltage = (turn on time/pulse time) * maximum voltage value
PWM has many applications: lamp brightness regulating, motor speed regulating, sound making,
etc.
The following are the three basic parameters of PMW:
Width
Cycle
Level

keyestudio
www.keyestudio.com
17
1. The amplitude of pulse width (minimum / maximum)
2. The pulse period (The reciprocal of pulse frequency in one second)
3. The voltage level(such as:0V-5V)
There are 6 PMW interfaces on Arduino, namely digital pin 3, 5, 6, 9, 10, and 11. In previous
experiments, we have done "button-controlled LED", using digital signal to control digital pin,
also one about potentiometer. This time, we will use a potentiometer to control the brightness of
the LED.
Hardware Required
Potentiometer*1
Red M5 LED*1
220ΩResistor
Breadboard*1
Breadboard Jumper Wires
Circuit Connection
The input of potentiometer is analog, so we connect it to analog port, and LED to PWM port.
Different PWM signal can regulate the brightness of the LED.
Connection for UNO R3:

keyestudio
www.keyestudio.com
18
Connection for 2560 R3:
Sample Code
In the program compiling process, we will use the analogWrite (PWM interface, analog value)
function. In this experiment, we will read the analog value of the potentiometer and assign the
value to PWM port, so there will be corresponding change to the brightness of the LED. One final
part will display the analog value on the screen. You can consider this as the "analog value
reading" project adding the PWM analog value assigning part. Below is a Sample Code for your
reference.
//////////////////////////////////////////////////////////
int potpin=0;// initialize analog pin 0
int ledpin=11;//initialize digital pin 11(PWM output)
int val=0;// Temporarily store variables' value from the sensor
void setup()
{
pinMode(ledpin,OUTPUT);// define digital pin 11 as “output”
Serial.begin(9600);// set baud rate at 9600
// attention: for analog ports, they are automatically set up as “input”
}

keyestudio
www.keyestudio.com
19
void loop()
{
val=analogRead(potpin);// read the analog value from the sensor and assign it to val
Serial.println(val);// display value of val
analogWrite(ledpin,val/4);// turn on LED and set up brightness(maximum output of PWM is 255)
delay(10);// wait for 0.01 second
}
//////////////////////////////////////////////////////////
Test Result
After uploading the program, when rotating the potentiometer knob, you can see the value change,
and also obvious brightness change of the LED on the breadboard.

keyestudio
www.keyestudio.com
20
Project 4: Traffic Light
Introduction
In the previous program, we have done the LED blinking experiment with one LED. Now, it’s
time to up the stakes to do a bit more complicated experiment-traffic light. Actually, these two
experiments are similar. While in this traffic light experiment, we use three LEDs with different
colors rather than an LED.
Hardware Required
Arduino Board *1
USB Cable *1
Red M5 LED*1
Yellow M5 LED*1
Green M5 LED*1
220ΩResistor *3
Breadboard*1
Breadboard Jumper Wires
This manual suits for next models
2
Table of contents
Other Keyestudio Microcontroller manuals