You are on page 1of 52

Preface

About SunFounder
SunFounder is a technology company focused on Raspberry Pi and Arduino open source
community development. Committed to the promotion of open source culture, we strive to
bring the fun of electronics making to people all around the world and enable everyone to
be a maker. Our products include learning kits, development boards, robots, sensor modules
and development tools. In addition to high quality products, SunFounder also offers video
tutorials to help you build your own project. If you have interest in open source or making
something cool, welcome to join us! Visit www.sunfounder.com for more!

About Basic Kit


This kit is suitable for SunFounder Uno, SunFounder Mega 2560, SunFounder Duemilanove and
SunFounder Nano. All the code in this user guide is compatible with these boards.

Our SunFounder board is fully compatible with Arduino board.

With this kit, we will walk you through the know-how of using the SunFounder board in a
hands-on way. Starting with the basics of electronics, you'll learn through building several
creative projects. Including a selection of the most common and useful electronic
components, this kit will help you "control" the physical world.

In this book, we will show you circuits with both realistic illustrations and schematic diagrams.
You can go to our official website www.sunfounder.com to download related code by
clicking LEARN -> Get Tutorials ->Basic Kit for Arduino and watch related videos under VIDEO.

Free Support
If you have any TECHNICAL questions, add a topic under FORUM section on our website
and we'll reply as soon as possible.

For NON-TECH questions like order and shipment issues, please send an email to
service@sunfounder.com. You're also welcomed to share your projects on FORUM.

Reprint 4.0
Contents
Components List .................................................................................................................................. 1

Components Introduction .................................................................................................................. 5

Resistor ........................................................................................................................................... 5

Potentiometer ............................................................................................................................... 7

LED .................................................................................................................................................. 8

RGB LED ......................................................................................................................................... 9

Jumper Wires............................................................................................................................... 10

Breadboard................................................................................................................................. 11

Get Started ......................................................................................................................................... 13

Arduino ................................................................................................................................. 13

Description ........................................................................................................................... 13

SunFounder Arduino Board ............................................................................................... 13

Install Arduino IDE................................................................................................................ 15

Plug in the Board ................................................................................................................. 16

Lesson 1 Button .................................................................................................................................. 17

Lesson 2 Flowing LED Lights .............................................................................................................. 22

Lesson 3 Buzzer ................................................................................................................................... 24

Lesson 4 Controlling an LED by Potentiometer.............................................................................. 27

Lesson 5 Photoresistor........................................................................................................................ 30

Lesson 6 RGB LED ............................................................................................................................... 33

Lesson 7 Servo .................................................................................................................................... 36

Lesson 8 Tilt-Switch ............................................................................................................................. 39

Lesson 9 Thermistor ............................................................................................................................ 42

Lesson 10 Light Alarm ........................................................................................................................ 44

Lesson 11 Automatically Tracking Light Source ............................................................................ 47


Components List
No. Name Qty. Component

1 1
Breadboard

2 65
Jumper Wires

3 10
Red LED

4 10
Green LED

5 1
RGB LED

1
6 Ceramic Capacitor 10
(10nF)

7 Ceramic Capacitor 10
(100nF)

8 Electrolytic 5
Capacitor (100uF)

9 10
Resistor (220Ω)
(red, red, black, black, brown)

10 10
Resistor (1KΩ)
(brown, black, black, brown, brown)

11 10
Resistor (10KΩ)
(brown, black, black, red, brown)

12 1
Tilt Switch

2
13 1
Thermistor

14 1
Photocell

15 Diode Rectifier 1
(1N4007)

16 1
Active Buzzer

17 1
Passive Buzzer

18 5
Button

3
19 5
Switch

20 1
Servo

21 1
Potentiometer

22 1
NPN Transistor

Note:
After unpacking, please check that the number of components is correct and that all
components are in good condition.

4
Components Introduction
Resistor

Resistor is an electronic element that can limit the branch current. A fixed resistor is one whose
resistance cannot be changed, when that of a potentiometer or variable resistor can be
adjusted.

The resistors in this kit are fixed ones. It is essential in the circuit to protect the connected
components. Figure (a) below shows a 220Ω resistor. Ω is the unit of resistance and the larger
includes KΩ, MΩ, etc. Their relationship can be shown as follows: 1 MΩ=1000 KΩ,1 KΩ = 1000
Ω, which means 1 MΩ = 1000,000 Ω = 10^6 Ω. Figure (b) and (c) show two generally used
circuit symbols for resistor. Normally, the resistance is marked on it. So if you see these symbols
in a circuit, it stands for a resistor.

(a)

(b) (c)

The resistance can be marked directly, in color code, and by character. The resistors offered
in this kit are marked by different colors. Namely, the bands on the resistor indicate the
resistance.

When using a resistor, we need to know its resistance first. Here are two methods: you can
observe the bands on the resistor, or use a multimeter to measure the resistance. You are
recommended to use the first method as it is more convenient and faster. If you are not sure
about the value, use the multimeter.

In the kit, a Resistor Color Code Calculator card is provided as shown below:

(d)

5
As shown in the card, each color stands for a number.

Black Brown Red Orange Yellow Green Blue Violet Grey White Gold Silver

0 1 2 3 4 5 6 7 8 9 0.1 0.01

The 4- and 5-band resistors are frequently used, on which there are 4 and 5 chromatic bands.
Let’s see how to read the resistance value of a 5-band resistor as shown below. Normally,
when you get a resistor, you may find it hard to decide which end to start for reading the
color. The tip is that the gap between the 4th and 5th band will be comparatively larger.
Therefore, you can observe the gap between the two chromatic bands at one end of the
resistor; if it's larger than any other band gaps, then you can read from the opposite side.

(e)

So for this resistor, the resistance should be read from left to right. The value should be in this
format: 1st Band 2nd Band 3rd Band x 10^Multiplier (Ω) and the permissible error is ±Tolerance%. So
the resistance value of this resistor is 2(red) 2(red) 0(black) x 10^0(black) Ω = 220 Ω, and the
permissible error is ± 1% (brown).

One more example. The resistance of the resistor below should be 1(brown) 0(black) 0(black)
x 10^1(brown) Ω =100x10 Ω = 1000 Ω = 1KΩ, and the permissible error is ± 1%(brown). Now
try it by yourself!

(f)

Now let’s try a 4-band resistor. There are two 4-band resistors in the kit: a 1MΩ one and a
5.1MΩ one. You may not use such a large resistor in the experiments of the kit but you can
use them in other projects. Unlike 5-band resistors, the third band of a 4-band one is not the
3rd band but the multiplier; its fourth band is Tolerance. So the resistance value of a 4-band
resistor should be 1st band 2nd band x 10^Multiplier (Ω), and the permissible error is
±Tolerance%.

(g)

6
Read the resistance of the above resistor from left to right. The value is 1(brown) 0(block) x
10^5(green)=10x10^5Ω=10^6Ω=1MΩ and the permissible error is ±5%(gold)

The resistance value of the resistor below is 5(green) 1(brown) x 10^5(green) = 51 x 10^5 Ω =
5.1 x 10^6 Ω = 5.1 MΩ, and the permissible value is ±5% (gold).

(h)

You can also use a multimeter to measure the resistance value of these resistors to double
check whether you've read it correctly or not.

Potentiometer

Potentiometer is also a resistance component with 3 terminals and its resistance value can
be adjusted according to some regular variation. Potentiometer usually consists of resistor
and movable brush. When the brush is moving along the resistor, there is a certain resistance
or voltage output depending on the displacement. Figure (i) is the potentiometer and figure
(j) is the corresponding circuit symbol. The middle pin in figure (i), represented by the arrow
in Fig. (j) is the movable brush.

(i) (j)

The functions of the potentiometer in the circuit are as follows:

1. Serving as a voltage divider

Potentiometer is a continuously adjustable resistor. When you adjust the shaft or sliding
handle of the potentiometer, the movable contact will slide on the resistor. At this point,
a voltage can be output depending on the voltage applied onto the potentiometer and
the angle the movable arm has rotated to or the travel it has made.

2. Serving as a rheostat

7
When the potentiometer is used as a rheostat, connect the middle pin and one of the
other 2 pins in the circuit. Thus you can get a smoothly and continuously changed
resistance value within the travel of the moving contact.

3. Serving as a current controller

When the potentiometer acts as a current controller, the sliding contact terminal must be
connected as one of the output terminals.

LED

Semiconductor light-emitting diode is a type of component which can turn electric energy
into light energy via PN junctions. By wavelength, it can be categorized into laser diode,
infrared light-emitting diode and visible light-emitting diode which is usually known as light-
emitting diode (LED).

(k) (l)

See LED in figure (k). Figure (l) is the circuit symbol. Diode has unidirectional conductivity, so
the current flow will be as the arrow indicates in figure (l). You can only provide the anode
with a positive power and the cathode with a negative. Thus the LED will light up.

In this kit, LEDs of red, green, yellow and white are provided. An LED has two pins. The longer
one is the anode, and shorter one, the cathode. Pay attention not to connect them inversely.
There is fixed forward voltage drop in the LED, so it cannot be connected with the circuit
directly because the supply voltage can outweigh this drop and cause the LED to be burnt.
The forward voltage of the red, yellow, and green LED is 1.8 V and that of the white one is
2.6 V. Most LEDs can withstand a maximum current of 20 mA, so we need to connect a
current limiting resistor in series.

The formula of the resistance value is as follows:

R = (Vsupply – VD)/I

R stands for the resistance value of the current limiting resistor, Vsupply for voltage supply, VD
for voltage drop and I for the working current of the LED.

8
If we provide 5 voltage for the red LED, the minimum resistance of the current limiting resistor
should be: (5V-1.8v)/20mA = 160Ω. Therefore, you need a 160Ω or larger resistor to protect
the LED. You are recommended to use the 220Ω resistor offered in the kit.

RGB LED

An RGB LED is provided in this kit. RGB LEDs emit light in various colors. An RGB LED packages
three LEDs of red, green, and blue into a transparent or semitransparent plastic shell. It can
display various colors by changing the input voltage of the three pins and superimpose them,
which, according to statistics, can create 16,777,216 different colors.

RGB LEDs can be categorized into common anode and common cathode ones. In this
experiment, the latter is used. The common cathode, or CC, means to connect the cathodes
of the three LEDs. After you connect it with GND and plug in the three pins, the LED will flash
the corresponding color. Its circuit symbol is shown as figure (n).

(m) (n)
An RGB LED has 4 pins: the longest one is GND; the others are Red, Green and Blue. Touch its
plastic shell and you will find a cut. The pin closest to the cut is the first pin, marked as Red,
then GND, Green and Blue in turn.

(o)

9
Or you can distinguish them in another way. As GND is the longest one and can be defined
directly, you just need to confirm the other three pins. You can test it by giving them a small
voltage. The forward voltage drop from the three pins to the GND are respectively 1.8V (red),
2.5V (blue), and 2.3V (green). Thus, when you connect the same current limiting resistor with
the three pins and supply them with the same voltage, the red one is the brightest, and then
comes the green and the blue one. Therefore, you may need to add a current limiting resistor
with different resistances to the three pins for these colors.

Jumper Wires

Wires that connect two terminals are called jumper wires. There are various kinds of jumper
wires. Here we focus on those used in breadboard. Among others, they are used to transfer
electrical signals from anywhere on the breadboard to the input/output pins of a
microcontroller.

Jump wires are fitted by inserting their "end connectors" into the slots provided in
the breadboard, beneath whose surface there are a few sets of parallel plates that connect
the slots in groups of rows or columns depending on the area. The "end connectors" are
inserted into the breadboard, without soldering, in the particular slots that need to be
connected in the specific prototype.

There are three types of jumper wire: Female-to-Female, Male-to-Male, and Male-to-Female.
The reason we call it Male-to-Female is because it has the outstanding tip in one end as well
as a sunk female end. Male-to-Male means both side are male and Female-to-Female
means both ends are female.

Male-to-Female Male-to-Male Female-to-Female

(p) (q) (r)

More than one type of them may be used in a project. The color of the jump wires is different
but it doesn’t mean their function is different accordingly; it's just designed so to better
identify the connection between each circuit. The Male-to-Male and Male-to-Female
jumper wires are included in the kit. But actually only some Male-to-Male ones will be used in
the experiments. You can use the Male-to-Female wires in other experiments.

10
Breadboard

A breadboard is a construction base for prototyping of electronics. It is used to build and test
circuits quickly before finalizing any circuit design. And it has many holes into which
components like ICs and resistors as well as jumper wires mentioned above can be inserted.
The breadboard allows you to easily plug in and remove components. So if there are going
to be many changes or if you just want to make a circuit quickly, it will be much quicker than
soldering up your circuit. Therefore in lots of experiments, it is often used as a hub to connect
two or more devices.

Normally, there are two types of breadboard: full+ and half+. You can tell their difference
from the names. A half+ breadboard is half the size of a full+ one and their functions are the
same. Here take the full+ breadboard.

(s) Full+

(t) Half+

This is the internal structure of a full+ breadboard. Although there are holes on the
breadboard, internally some of them are connected with metal strips. Those holes are to
insert pins of devices or wires. As shown in the fig. (t) below, there are four long metal strips

11
on the long sides; the blue and red lines are marked just for clear observation. But you can
take the blue line as the GND and red one as VCC for convenience. Every five holes in the
middle are vertically connected with metal trips internally which don’t connect with each
other. You can connect them horizontally with wires or components. A groove is made in the
middle on the breadboard for IC chips.

(u) Internal structure of the full+

Now let’s make some simple experiment with the breadboard. Turn on an LED as shown in
the figure below. You can have a try and the LED will light up. The breadboard makes it
possible for you to plug and pull components at any time without welding, which is very
convenient for tests.

(v)

12
Get Started
Note:

Before starting your own project, you must download the file Basic Kit for Arduino on our
official website by visiting LEARN -> Get Tutorials -> Basic Kit for Arduino and unzip it.

Arduino

Description
Arduino is an open source platform with simple software and hardware. You can pick it up
in short time even if you are a beginner. It provides an integrated development environment
(IDE) for code compiling, compatible with multiple control boards. So you can just download
the Arduino IDE, upload the sketches (i.e. the code files) to the board, and then you can see
relative experimental phenomena. For more information, refer to http://www.arduino.cc.

SunFounder Arduino Board

Now, SunFounder has five Arduino boards: SunFounder Uno R3 Board, Mega 2560 Board,
Nano Board, SunFounder Mars Board and SunFounder Mercury Board. The Uno Board and

13
the Mars Board share the same kind of pins at the same position. And the pins of the first half
part on the Mega 2560 are the same as those on the Uno. The difference lies in that on the
Mega 2560 board, the I2C pin (SDA) and pin SCL don't correspond to pin A4 and A5 but to
pin 20 and 21. On the other hand, the Nano and the Uno also share the same kind of pins at
the same position. Though the Nano is in a smaller size, making it applicable for projects.

The following is the parameters of the four boards:

Board
Uno R3 Mars Nano Mega 2560 Mercury
Parameters

ATmega25
Microcontroller ATmega328P ATmega328P ATmega328P ATmega2560
60

USB
Type B Type C Mini-B Type B Type C
connection

USB-to-Serial
MEGA16U2 FT232R PL2303 MEGA16U2 FT232R
Chip

Power jack? Y Y N Y Y

Operating
5V 5V 5V 5V 5V
Voltage

Input Voltage 7-12V 7-12V 7-12V 7-12V 7-12V

54 (of
54 (of which
14 (of which 6 14 (of which 14 (of which 6 which 15
15 provide
Digital I/O Pins provide PWM 6 provide provide PWM provide
PWM
output) PWM output) output) PWM
output)
output)

Analog Input
6 6 8 16 16
Pins

DC Current per
20 mA 20mA 20 mA 20 mA 20 mA
I/O Pin

14
Install Arduino IDE

The code in this kit is written based on Arduino, so you need to install the IDE first. Skip it if you
have done this.

Now go to the arduino.cc website and click DOWNLOAD. On the page, check the software
list on the right side under Download the Arduino Software.

Find the one that suits your operation system and click to download. There are two versions
of Arduino for Windows: Installer or ZIP file. You're recommended to download the former.
Just download the package, and run the executable file to start installation. It will download
the driver needed to run Arduino IDE. After downloading, follow the prompts to install. For the
details of installing steps, you can refer to the guide on Learning->Getting Started with Arduino,
scroll down and see Install the Arduino Software.

After installing, you will see Arduino icon on your desk and double click to open it.

15
Plug in the Board

Connect the control board to your computer with a USB cable. If you use Uno, Mega2560 or
Mars as the control board, the system will automatically install the driver when you plug it in.
After a while, a prompt will show up at the bottom right corner telling you which port the
board locates at. If the control board is Nano, then you need to install the driver by yourself.
For more details, you can refer to WIKI on our website www.sunfounder.com.

For more details about Arduino IDE, go to Learning->Getting started->Foundation on the


arduino.cc and click Arduino Software (IDE) on the page
http://www.arduino.cc/en/Guide/Environment

If your sketch fails upload, on the same page click Troubleshooting


http://www.arduino.cc/en/Guide/Troubleshooting.

Notes:

- If your computer is running on the Windows XP system, the new version IDE will prompt
errors when running the code. You are recommended to download the Arduino 1.0.5 or
Arduino 1.0.6. Or you can also upgrade your Window system.

- All the experiments in this kit are done with SunFounder Uno R3 board, but they are also
compatible with SunFounder Mega 2560, SunFounder Mars, SunFounder Nano and all
official Arduino Boards. All the code included in this kit works with these boards.

So what does COMPATIBLE mean here? It means you can use any of the three boards to
do the same experiment with the same wiring. Simply put, if the wire is connected to Pin
12 of Uno in the user manual, likewise, you can connect it to Pin 12 on any other official
Arduino boards you are using. Then open the corresponding sketch and upload them.

Now let’s begin!

16
Lesson 1 Button
Introduction
In this experiment, we will learn how to turn an LED on/off by using an I/O port and a button.
The "I/O port" refers to the INPUT and OUTPUT port. Here the INPUT port of the SunFounder Uno
board is used to read the output of an external device. Since the board itself has an LED
(connected to Pin 13), you can use this LED to do this experiment for convenience.

Components
- 1 * SunFounder Uno board
- 1 * USB cable
- 1 * Button
- 1 * Resistor (10kΩ)
- Jumper wires
- 1 * Breadboard

Principle
Button
Buttons are a common component used to control electronic devices. They are usually used
as switches to connect or break circuits. Although buttons come in a variety of sizes and
shapes, the one used here is a 6mm mini-button as shown in the following pictures.

Pin 1 is connected to pin 2 and pin 3 to pin 4. So you just need to connect either of pin 1 and
pin 2 to pin 3 or pin 4.

The following is the internal structure of a button. Since the pin 1 is connected to pin2, and
pin 3 to pin 4, the symbol on the right below is usually used to represent a button.

17
When the button is pressed, the 4 pins are connected, thus closing the circuit.

Generally, the button can be connected directly to the LED in a circuit to turn on or off the
LED, which is comparatively simple. However, sometimes the LED will brighten automatically
without any button pressed, which is caused by various kinds of external interference. In order
to avoid this interference, a pull-down resistor is used – usually connect a 1K–10KΩ resistor
between the button and GND. It can be connected to GND to consume the interference
when the button is off.

This circuit connection is widely used in numerous circuits and electronic devices. We may
use the button to control a circuit later in many experiments (in or outside this kit maybe), so
you might get its principle, which is very simple, and application at the beginning of your
study.

The schematic diagram

18
Experimental Procedures
Step 1: Build the circuit

Pin 13 LED

Step 2: Open the code file

In the folder Basic Kit for Arduino you just downloaded and unzipped, you can see the folder
for the corresponding lesson which includes two folders: code (the sketch) and circuit
(Fritzing file). Go to the code folder and find the .ino file (.ino is the format of the sketch). Then
double click to open it.

Step 3: Select the correct Board

19
and Port

Step 4: Upload

Click the Upload icon to upload the sketch to the board

Note: The experimental steps for the subsequent lessons are the same. Here we just take
one lesson for example. You can modify the code as you like, but pay attention to save it
as another one for reference.

20
Now, press the button, and the LED on the SunFounder Uno board will light up.

Tips: For any TECHNICAL questions, add a topic under FORUM section on our website
www.sunfounder.com and we'll reply as soon as possible. For NON-TECH questions like order
issues, please email service@sunfounder.com.

21
Lesson 2 Flowing LED Lights
Introduction
In this lesson, we will conduct a simple yet interesting experiment – using LEDs to create
flowing LED lights. As the name suggests, these eight LEDs in a row successively light up and
dim one after another, just like flowing water.

Components
- 1 * SunFounder Uno board
- 1 * Breadboard
- Jumper wires
- 8 * LED
- 8 * Resistor (220Ω)
- 1 * USB cable

Principle
The principle of this experiment is simply to turn on eight LEDs in turn.

Experimental Procedures
Step 1: Build the circuit

22
The schematic diagram

Step 2: Open the code file


Step 3: Select the correct Board and Port
Step 4: Upload the sketch to the board

Now, you should see eight LEDs brighten one by one from left to right, and then dim in turn
from right to left. After that, the LEDs will light up from right to left and dim from left to right.
This whole process will repeat until the circuit is power off.

23
Lesson 3 Buzzer
Introduction
A buzzer is a great tool in your experiments whenever you want to make some sounds. In this
lesson, we will learn how to drive an active buzzer to beep.

Experimental Conditions
- 1 * SunFounder Uno board
- 1 * Breadboard
- 1 * USB data cable
- 1 * Buzzer (Active)
- Jumper wires

Principle
As a type of electronic buzzer with integrated structure, buzzers, which are supplied by DC
power, are widely used in computers, printers, photocopiers, alarms, electronic toys,
automotive electronic devices, telephones, timers and other electronic products for voice
devices. Buzzers can be categorized as active and passive ones (see the following picture).
Turn the pins of two buzzers face up, and the one with a green circuit board is a passive
buzzer, while the other enclosed with a black tape is an active one.

The difference between an active buzzer and a passive buzzer is:

An active buzzer has a built-in oscillating source, so it will make sounds when electrified. But
a passive buzzer does not have such source, so it will not tweet if DC signals are used; instead,
you need to use square waves whose frequency is between 2K and 5K to drive it. The active
buzzer is often more expensive than the passive one because of multiple built-in oscillating
circuits.

In this experiment, we use the active buzzer.

24
Experimental Procedures
Step 1: Build the circuit (Pay attention to the positive and negative poles of the buzzer)

The schematic diagram

25
Step 2: Open the code file
Step 3: Select the correct Board and Port
Step 4: Upload the sketch to the board

Now, you should hear the buzzer beep.

26
Lesson 4 Controlling an LED by Potentiometer
Introduction
In this lesson, we will learn how to change the luminance of an LED by potentiometer.

Components
- 1 * SunFounder Uno board
- 1 * Breadboard
- Jumper wires
- 1 * Resistor (220Ω)
- 1 * LED
- 1 * Potentiometer
- 1 * USB cable

Principle
Analog V.S. Digital
A linear potentiometer is an analog electronic component. So what’s the difference
between an analog value and a digital one? Simply put, digital means on/off, high/low level
with just two states, i.e. either 0 or 1. But the data state of analog signals is linear, for example,
from 1 to 1000; the signal value changes over time instead of indicating an exact number.
Analog signals include those of light intensity, humidity, temperature, and so on.

In this experiment, a potentiometer, or pot, is used to change the current in the circuit so the
luminance of the LED will change accordingly. And since the pot is an analog device, the
current change is smooth, thus the LED will gradually get brighter or dimmer instead of going
through an obvious stepwise process. Also it should be connected to analog ports, i.e. A0-
A5, instead of digital ports.

27
Experimental Procedures
Step 1: Build the circuit

The schematic diagram

28
As you see, the potentiometer is connected to pin A0 of the SunFounder Uno board, which
can measure voltages from 0V to 5V. The corresponding returned value is from 0 to 1024. The
measurement accuracy for voltage change is relatively high.

Step 2: Open the code file


Step 3: Select the correct Board and Port
Step 4: Upload the sketch to the board

Spin the shaft of the potentiometer and you can see the luminance of the LED change.

29
Lesson 5 Photoresistor
Introduction
A photoresistor or photocell is a light-controlled variable resistor. The resistance of a
photoresistor decreases with increasing incident light intensity; in other words, it
exhibits photoconductivity. A photoresistor can be applied in light-sensitive detector circuits,
and light- and dark-activated switching circuits.

Experimental Conditions
- 1 * SunFounder Uno board
- 1 * USB data cable
- 1 * Photoresistor
- 1 * Resistor (10KΩ)
- 8 * LED
- 8 * Resistor (220Ω)
- Jumper wires
-1 * Breadboard

Experimental Principle
The resistance of the photoresistor changes with incident light intensity. If the light intensity
gets higher, the resistance decreases; if low, the intensity increases.

In this experiment, we will use eight LEDs to indicate light intensity. The higher the light intensity
is, the more LEDs brighten. When the light intensity is high enough, all the LEDs will light up.
When there is no light on the sensor, all the LEDs will go out.

Experimental Procedures
Step 1: Build the circuit

30
The schematic diagram

Step 2: Open the code file


Step 3: Select the correct Board and Port
Step 4: Upload the sketch to the board

31
Now, shine a flashlight or other light sources on the photoresistor, and you will see several
LEDs light up. Change the light intensity and you will see more (or less) LEDs brighten. Place it
in a dark environment, and all the LEDs will go out.

Exploration
In addition, you can replace the photoresistor with a microphone and use the LEDs to
indicate sound intensity. The higher the sound intensity is, the more LEDs brighten. Try to realize
this effect by yourself!

32
Lesson 6 RGB LED
Introduction
In this lesson, we will use the PWM technology to control an RGB LED to flash various kinds of
colors.

Components
- 1 * RGB LED
- 3 * Resistor (220Ω)
- 1 * Breadboard
- 1 * SunFounder Uno board
- Jumper wires
- USB cable

Principle
RGB
RGB stands for the red, green, and blue color channels and is an industry color standard.
RGB displays various new colors by changing the three channels and superimposing them,
which, according to statistics, can create 16,777,216 different colors.

Each of the three color channels has 255 stages of brightness. When the three primary colors
are all 0, it is the least bright, thus turning it off. When the three colors are all 255, which is the
brightest, the LEDs will brighten. When the light emitted of the three colors are mixed together,
the colors will be mixed too. However, the brightness is equal to the sum of all brightness. And
the more you mix, the brighter the LED gets. This process is known as additive mixing.

PWM
Pulse width modulation, or PWM, is a technique for getting analog results with digital means.
Digital control is used to create a square wave, a signal switched between on and off. This
on-off pattern can simulate voltages in between full on (5 Volts) and off (0 Volts) by changing
the portion of the time the signal spends on versus the time that the signal spends off. The
duration of "on time" is called pulse width. To get varying analog values, you change, or
modulate, that width. If you repeat this on-off pattern fast enough with some device, an LED
for example, it would be like this: the signal is a steady voltage between 0 and 5V controlling
the brightness of the LED. (For more, check our website and the official website of Arduino).

In this experiment, apply PWM and input a value between 0 and 255 to the three pins of the
RGB LED to make it flash different colors.

33
Experimental Procedures
Step 1: Build the circuit

The schematic diagram

34
Step 2: Open the code file
Step 3: Select the correct Board and Port
Step 4: Upload the sketch to the board

Here you should see the RGB LED flash circularly red, green, and blue first, then red, orange,
yellow, green, blue, indigo, and purple.

35
Lesson 7 Servo
Introduction
Servo is a type of geared motor that can only rotate 180 degrees. It is controlled by sending
electrical pulses from your SunFounder Uno board. These pulses tell the servo what position it
should move to.

A servo has three wires, the brown wire is GND, the red one is VCC, and the orange one is
signal line.

Components
- 1 * SunFounder Uno board
- 1 * USB data cable
- 1 * Servo
- Several jumper wires

Experimental Principle

Servo
A servo is generally composed of the following parts: case, shaft, gear train, adjustable
potentiometer, DC motor, and control circuit board.

It works like this: The SunFounder Uno board sends out PWM signals to the servo, and then the
control circuit in the servo receives the signals through the signal pin and controls the motor
inside to turn. As a result, the motor drives the gear chain and then motivates the shaft after
deceleration. The shaft and adjustable potentiometer of the servo are connected together.
When the shaft rotates, it drives the pot, so the pot outputs a voltage signal to the circuit
board. Then the board determines the direction and speed of rotation based on the current
position, so it can stop exactly at the right position as defined and hold there.

36
Experimental Procedures
Step 1: Build the circuit

The schematic diagram

37
Step 2: Open the code file
Step 3: Select the correct Board and Port
Step 4: Upload the sketch to the board

Now, you can see rocker arm of the servo spin 90 degrees (5 degrees each time). And then
it spins in the opposite direction.

38
Lesson 8 Tilt-Switch
Introduction
The tilt switch used here is a ball one with a metal ball inside. It is used to detect small angle
of inclination.

Components
- 1 * SunFounder Uno board
- 1 * USB data cable
- 1 * Tilt switch
- Several jumper wires

Experimental Principle
The principle is very simple. When the switch is tilted in a certain angle, the ball inside rolls
down and touches the two contacts connected to the pins outside, thus triggering circuits.
Otherwise the ball will stay away from the contacts, thus breaking the circuits.

39
Experimental Procedures
Step 1: Build the circuit

The schematic diagram

40
Step 2: Open the code file
Step 3: Select the correct Board and Port
Step 4: Upload the sketch to the board

Now, tilt the switch, and the LED attached to pin 13 on SunFounder Uno board will light up.

41
Lesson 9 Thermistor
Introduction
A thermistor is a type of resistor whose resistance varies significantly with temperature.

Components
- 1 * SunFounder Uno board
- 1 * USB data cable
- 1 * Thermistor
- 1 * Resistor (10K)
- Several jumper wires

Experimental Principle
The resistance of the thermistor varies significantly with ambient temperature. It can detect
surrounding temperature changes in real time. Send the temperature data to analog I/O
port of SunFounder Uno board. Next we only need to convert sensor output to Celsius
temperature by simple programming and display it on Serial Monitor.

Experimental Procedures
Step 1: Build the circuit

42
The schematic diagram

Step 2: Open the code file


Step 3: Select the correct Board and Port
Step 4: Upload the sketch to the board

Now, you can see the current temperature displayed on Serial Monitor.

43
Lesson 10 Light Alarm
Introduction
This experiment is a very interesting one – a DIY phototransistor. DIY phototransistors use the
glow effect and photoelectric effect of LEDs. That is, LEDs will generate weak currents when
some light is shined on it. And we use a transistor to amplify the currents generated, so the
SunFounder Uno board can detect them.

Components
- 1 * SunFounder Uno board
- 1 * Breadboard
- 1 * USB cable
- Jumper wires
- 1 * Passive buzzer
- 1 * Resistor (10KΩ)
- 1 * LED
- 1 * NPN Transistor S8050

Principle
LEDs not only have a glow effect, but also a photoelectric effect. They will generate weak
currents when exposed to light waves.

NPN consists of a layer of P-doped semiconductor (the "base") between two N-doped layers
(see the picture above). A small current entering the base is amplified to produce a large
collector and emitter current. That is, when there is a positive potential difference measured
from the emitter of an NPN transistor to its base (i.e., when the base is high relative to the
emitter) as well as positive potential difference measured from the base to the collector, the
transistor becomes active. In this "on" state, current flows between the collector and emitter
of the transistor.

44
There are three poles for the regions: base (b), emitter (e) and collector (c). They form two
P-N junctions, namely the base-emitter junction and collector-base junction. The arrows in
the NPN symbol (see the figure below) indicates the direction of the base-emitter junction.

The symbol of NPN is shown here. We can see the two PN junctions with unilateral
conductivity inside, which enables it a switch component.

A 10kΩ pull-down resistor is attached to the transistor output stage in order to avoid analog
port suspending to interfere with signals and cause misjudgment.

Experimental Procedures
Step 1: Build the circuit

45
The schematic diagram

Step 2: Open the code file


Step 3: Select the correct Board and Port
Step 4: Upload the sketch to the board

Now, you can hear the buzzer beep when shining a flashlight on the LED.

46
Lesson 11 Automatically Tracking Light Source
Introduction
In this lesson, we will make some interesting creations – use a servo motor, a photoresistor and
a pull-down resistor to assemble an automatically tracking light source system.

Components
- 1 * SunFounder Uno board
- 1 * Servo motor
- 1 * Photoresistor
- 1 * Resistor (10KΩ)
- Several jumper wires
- 1 * USB data cable

Experimental Principle
The rocker arm of the servo and the bundled photoresistor sway together to scan and "look"
for light source within 180 degrees and record the location of light source when finding one.
Then they stop swaying just at the direction of the light source.

Experimental Procedures
Step 1: Build the circuit

47
Note: you need to bind one end of the resistor and photoresistor to the rocker arm of the
servo (cross the pin through the holes of the arm), as shown below:

The schematic diagram

Step 2: Open the code file

48
Step 3: Select the correct Board and Port
Step 4: Upload the sketch to the board

Now, shine a flashlight onto the photoresistor. Then you will see the rocker arm of the servo
and the photoresistor rotate and finally stop at the direction of light source.

49
For Safe Use
All parts and devices in this kit should be powered appropriately in compliance with
relevant regulations and standards applicable in the country of intended use.

The connection of unapproved external devices to the modules/boards in this kit may
affect compliance or result in damage to the unit, for which we will not be responsible.

To avoid malfunction or damage to your circuit boards, please observe the following:

DO NOT expose it to water/moisture or place it on a conductive surface whilst in


operation.

DO NOT expose it to heat from any source; the product is designed for reliable
operation at normal ambient room temperatures.

Take care whilst handling to avoid mechanical or electrical damage to the


printed circuit board and connectors.

PLEASE perform the connection or wiring based on the instructions in the manual
or our website if you are not clear of the results.

Copyright Notice

All contents including but not limited to texts, images, and code in this manual are owned
by the SunFounder Company. You should only use it for personal study, investigation,
enjoyment, or other non-commercial or nonprofit purposes, under the related regulations
and copyrights laws, without infringing the legal rights of the author and relevant right
holders. For any individual or organization that uses these for commercial profit without
permission, the Company reserves the right to take legal action.

50

You might also like