SunFounder Super Kit 3.0 User manual

Preface
About SunFounder
SunFounder is a technology company focused on Raspberry Pi and Arduino open source
community development. Committed to the promotion of open source culture, we strive to
bring the fun of electronics making to people all around the world and enable everyone to
be a maker. Our products include learning kits, development boards, robots, sensor modules
and development tools. In addition to high quality products, SunFounder also offers video
tutorials to help 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 the Super Kit 3.0
This super kit is suitable for the Raspberry Pi B, model B+, Pi 2 model B, Pi 3 model B and Pi 3
model B+. It includes various components and chips that can show different interesting
phenomena. You can make it happen by following the experiment instructions, and learn
basic knowledge about them. Also you can explore more application after mastering the
principle and code. Now get on the road!
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 the related code by
clicking LEARN --> Get tutorials and watch related videos by clicking 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 2.0

Contents
Components List ....................................................................................................................1
Components Introduction......................................................................................................8
Resistor............................................................................................................................................................8
Potentiometer ............................................................................................................................................10
LED.................................................................................................................................................................11
RGB LED........................................................................................................................................................12
Jumper Wires ..............................................................................................................................................13
Breadboard ................................................................................................................................................13
Get Started .......................................................................................................................... 16
Preparation .................................................................................................................................................16
Access to Raspberry Pi’s Console.........................................................................................................16
Using Console in GUI (terminal, recommended for beginners)...............................................16
Using Console Only ...............................................................................................................................18
Introduction to Raspberry Pi................................................................................................. 22
RAB Holder...................................................................................................................................................22
Raspberry Pi ................................................................................................................................................24
Raspberry Pi Pin Name.............................................................................................................................24
Extension Board .........................................................................................................................................25
GPIO Libraries ...................................................................................................................... 28
WiringPi .........................................................................................................................................................28
Introduction.............................................................................................................................................28
RPi.GPIO .......................................................................................................................................................29
Introduction.............................................................................................................................................29
Download the Code............................................................................................................ 30
Lesson 1 Blinking LED ............................................................................................................ 31
Lesson 2 Controlling an LED by a Button .............................................................................. 40
Lesson 3 Flowing LED Lights .................................................................................................. 44

Lesson 4 Breathing LED......................................................................................................... 48
Lesson 5 RGB LED ................................................................................................................. 52
Lesson 6 Buzzer..................................................................................................................... 56
Lesson 7 Relay...................................................................................................................... 60
Lesson 8 4N35....................................................................................................................... 64
Lesson 9 Ne555 .................................................................................................................... 68
Lesson 10 Slide Switch .......................................................................................................... 72
Lesson 11 How to Drive a DC Motor ..................................................................................... 76
Lesson 12 Rotary Encoder .................................................................................................... 81
Lesson 13 Driving LEDs by 74HC595 ...................................................................................... 86
Lesson 14 Driving 7-Segment Display by 74HC595................................................................ 91
Lesson 15 Driving Dot-Matrix by 74HC595............................................................................. 98
Lesson 16 LCD1602............................................................................................................. 106
Lesson 17 ADXL345............................................................................................................. 112

1
Components List
No.
Name
Quantity
Component
1
555 Timer IC
1
2
Optocoupler (4N35)
2
3
Shift Register (74HC595)
2
4
L293D
1
5
Accelerometer ADXL345
1
6
Rotary Encoder
1

2
7
Potentiometer (50k)
1
8
Resistor (220Ω)
8
(red, red, black, black, brown)
9
Resistor (1kΩ)
8
(brown, black, black, brown, brown)
10
Resistor (10kΩ)
4
(brown, black, black, red, brown)
11
Resistor (100kΩ)
4
(brown, black, black, orange, brown)
12
Resistor (1MΩ)
1
(brown, black, green, gold)
13
Resistor (5.1MΩ)
1
(green, brown, green, gold)
14
Diode Rectifier
4
15
Switch
1

3
16
Button
5
17
Power Supply Module
1
18
LCD1602
1
19
Dot Matrix Display (8*8)
1
20
7-Segment Display
2
21
DC Motor
1

4
22
RGB LED
1
23
LED (red)
8
24
LED (white)
4
25
LED (green)
4
26
LED (yellow)
4
27
NPN Transistor (S8050)
2

5
28
PNP Transistor (S8550)
2
29
Capacitor Ceramic
100nF
4
30
Capacitor Ceramic
10nF
4
31
Breadboard
1
32
Active Buzzer
1
33
Relay
1

6
34
Fan
1
35
Male-to-Male
Jumper Wire
65
36
Female-to-Male
Dupont Wire
20
37
5-Pin Anti-reverse Cable
2
38
9V Battery Buckle
1
39
M3*10 Screw
2
40
M2.5*6 Screw
4
41
M3*6 Screw
6

7
42
RAB Holder
1
43
T-Extension Board
1
44
40-Pin GPIO Cable
1
Notes:
After unpacking, please check that the number of components is correct and that all
components are in good condition.

8
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)

9
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)

10
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

11
3. 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.
4. 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.
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.

12
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)
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

13
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.
Jumper 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 colors of the jumper wires are
different but it doesn’t mean their functions are 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.
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. If there is going to be
many changes or if you just want to make a circuit quickly, it will be much quicker than

14
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
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 strips 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.

15
(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)

16
Get Started
Preparation
1. Prepare a MicroSD/TF card of no less than 8GB, a 5V 2A DC power adapter with a
MicroUSB port, and a network cable (to connect your router and Raspberry Pi, or plug in
the USB Wi-Fi adapter directly if you have one).
2. Download the image for the Raspbian system onto your computer. Refer to instructions
through DOWNLOADS->RASPBIAN on the official website raspberrypi.org:
https://www.raspberrypi.org/documentation/installation/installing-images/README.md.
Write the image into the microSD/TF card, and then plug the card into the slot on your
Raspberry Pi.
Note: For 2016-11-25 release or above, SSH (a protocol securing remote login session and
other network service) is Disabled by default. Therefore, when you need to log in remotely,
you need to create a file named "ssh" under /boot/ to enable it.
Access to Raspberry Pi’s Console
In the subsequent tutorials, the console will be used from time to time. It is platform for
interactions in Linux. Therefore, before starting the lessons, you may need to know how to
access to Raspberry Pi’s console.
Using Console in GUI (terminal, recommended for beginners)
Using console in GUI is of great help for the beginners. You can not only compile and run the
code in terminal, but also be able to do some simple file operating, code-downloading, etc.
cooperating with GUI.
1. Preparations: a screen monitor, an HDMI cable (if your monitor only support VGA, use a
VGA-HDMI converter), a USB mouse, a USB keyboard and a network cable or a USB Wi-Fi
dongle.
2. Connect the monitor to power. Then connect it with the Raspberry Pi via the converter
cable (HDMI cable). Connect the Ethernet cable or the USB Wi-Fi dongle, and the mouse
and keyboard to USB ports. At last, connect a 5V 2A DC power to the RPi. Power on the
screen if needed. Then you can see the display showing the Raspberry Pi icon as shown
below.

17
If the monitor displays colored texts with a black background after booting, and that is in
console. You can just use this as a terminal (but not recommend for beginners), or change
the option for automatically loading a graphic user interface (GUI). To activate GUI, you
can type in startx with the keyboard and press Enter, and to always boot up to GUI, type
in sudo raspi-config and go through Boot Options > Desktop/Desk Autologin, and reboot.
Wait for a while and the GUI display will show up as below.
Note:
The screen monitor shown above is the 10.1 inch one we're using, available on our website
www.sunfounder.com and our Amazon store. Check out now and use your Raspberry Pi
in a most convenient way.
3. Now click the icon of Terminal on the screen, or press CTRL+ALT+T simultaneously.
Table of contents