Elecrow Raspberry Pi & Arduino Starter Kit User manual

1 of 114
Elecrow
Raspberry Pi & Arduino
Starter Kit
ELECROW RASPBERRY PI STARTER KIT

2 of 114
CATALOG
Introduction................................................................................................................................................................ 3
Driver Installation........................................................................................................................................................ 3
LESSON 1: Blink LED.....................................................................................................................................................4
LESSON 2: Button........................................................................................................................................................ 8
LESSON 3: Ball switch.................................................................................................................................................14
LESSON 4: Active buzzer............................................................................................................................................ 19
LESSON 5: Passive buzzer...........................................................................................................................................24
LESSON 6: RGB LED....................................................................................................................................................35
LESSON 7: 1 Digit 7 Segment display..........................................................................................................................40
LESSON 8: 4 Digit 7 Segment display..........................................................................................................................45
LESSON 9: Heart-shaped display................................................................................................................................ 51
LESSON 10: 9G Servo................................................................................................................................................. 56
LESSON 11: Step motor..............................................................................................................................................61
LESSON 12: Ultrasonic ranging...................................................................................................................................66
LESSON 13: Touch lamp.............................................................................................................................................72
LESSON 14: PCF8591 Module.....................................................................................................................................77
LESSON 15: Flame sensor...........................................................................................................................................82
LESSON 16: Photo resistance sensor (light sensor).....................................................................................................87
LESSON 17: Thermistor sensor...................................................................................................................................93
LESSON 18: Potentiometer........................................................................................................................................ 98
LESSON 19: Water level monitoring......................................................................................................................... 103
LESSON 20: Joystick................................................................................................................................................. 109
LESSON 21: IR Remote............................................................................................................................................. 114
LESSON 22: IR Remote control LED.......................................................................................................................... 119
LESSON 23: DHT11...................................................................................................................................................125
LESSON 24: LCD1602 With IIC.................................................................................................................................. 130
LESSON 25: Temperature and humidity monitoring................................................................................................. 100
ELECROW RASPBERRY PI STARTER KIT

3 of 114
INTRODUCTION
Thank you for purchasing Elecrow Starter kit for Raspberry Pi & Arduino!
In this lessons file, we’ll go through all the components that you received by purchasing our
product, we will explain, step by step, the functionality of each of the components and how to
use them.
This lesson file is a great start for the making world, making the first step in creating something
on your own by connecting hardware and programming them to function in different ways!
For each lesson, three will be example demo code that you can run available from our GitHub
account. We will keep the GitHub account updated so make sure to follow up!
We hope you will enjoy this lessons as much as we did while writing them.
ELECROW RASPBERRY PI STARTER KIT

4 of 114
DRIVER INSTALLATION & GIT CLONE
In order to to use the lessons first we’ll need to clone the repository from GitHub that includes all
the examples that we’ll need.
To do so, run the following commands:
git clone https://github.com/Elecrow-RD/Raspberry-Pi-Starter-Kit.git
cd Raspberry-Pi-Starter-Kit/Drivers
After cloning the repository and CD (going into the folder) Drivers, we’ll now continue in
installing the actual drivers.
There are couple of drivers we’ll need to install:
*adafruit_python_charLCD - Adafruit library to control the LCD screen
*adafruit_python_DHT - Adafruit library to control the DH11 sensor
*Adafruit_Python_LED_Backpack - Adafruit library to control the segment LED
*Luma.LED_Matrix - Library to control the matrix LED
We have all the drivers we need in the drivers/ folder in our Raspberry-Pi-Starter-Kit repository.
So let’s proceed installing them all. We are going to install each driver seperately so make sure to
follow the instructions very carefully.
Before you start make sure your current location on the terminal states “Drivers” as the drivers
folder you are currently at.

5 of 114
You will need to install each of those drivers by running the following command for each one:
Adafruit_Python_CharLCD:
cd Adafruit_Python_CharLCD
sudo python setup.py install
sudo python3 setup.py install
cd ..
Adafruit_Python_DHT:
cd Adafruit_Python_DHT
sudo python setup.py install
sudo python3 setup.py install
cd ..
Adafruit_Python_LED_Backpack:
cd Adafruit_Python_LED_Backpack
sudo python setup.py install
sudo python3 setup.py install
cd ..
Luma Matrix LED:
cd luma.led_matrix
sudo python setup.py install
sudo python3 setup.py install
cd ..

6 of 114
Make sure there are no errors on the way and congratulations! you’ve successfully installed all
the required drivers.
Please follow the next steps to prepare for the IR LED driver installation.
IR LED driver installation
First, let’s install the lirc library, the main library that will help us send and receive IR codes using
our sensor later on in this lessons:
sudo apt-get install lirc
After successfully installing the lirc library, we need to install the python support for lirc so we
could write python code and being able to connect it with the lirc library all together.
sudo pip install python-lirc
sudo pip3 install python-lirc
Note: on the latest Raspbian pip3 install python-lirc will not work, we are working to solve it
ASAP. You’ll need to use python2 for the IR script for now.
Inside CrowPi/Drivers/LIRC folder that we cloned, there are 3 files you need to copy the files to
the LIRC configuration directory, from the CrowPi folder run the following commands:
sudo cp Drivers/LIRC/* /etc/lirc
After you moved the configuration file, edit your boot config file

7 of 114
sudo nano /boot/config.txt
And where it says
# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi
change it to this
# Uncomment this to enable the lirc-rpi module
dtoverlay=gpio-ir,gpio_pin=20
previously it used to be dtoverlay=lirc-rpi but this one got deprecated in the newer version of
Raspbian.
Execute the following commands to copy the configuration files
sudo cp /etc/lirc/lirc_options.conf.dist /etc/lirc/lirc_options.conf
sudo cp /etc/lirc/lircd.conf.dist /etc/lirc/lircd.conf
edit /etc/lirc/lirc_options.conf by writing the command sudo nano /etc/lirc/lirc_options.conf and
modify the following lines to be exact as here:
driver = default
device = /dev/lirc0
now reboot
sudo reboot

8 of 114
Once the reboot successfully finished, run apt-get install Lirc once again to fix the previous
errors if any
sudo apt-get install lirc
Last step, stop the LIRC library so we could use the IR driver with our python script
sudo /etc/init.d/lirc stop
Note: if you get runtime error that the command cannot be found, maybe you have a different
version of LIRC, try this command instead:
sudo /etc/init.d/lircd stop
Well done!
You are now officially read to start the python lessons properly when all the drivers and
everything is need is already installed and ready for use.
let’s get going!
LESSON 1: BLINK LED

9 of 114
Introduction
The Blink LED will be our first lesson, during this lesson we’ll learn what is LED and how it works, how to connect it
properly to the raspberry pi using GPIO ports and then we’ll use example script to run and test a code with our
hardware.
The Blink LED is a very simple example to start with, we will use 5mm LED of any colour and make it “blink” turn on
and off rapidly in timely manner.
Specification
Below you can see the LED specification, the long pin indicate the positive side while the short pin indicate the
negative side.
Note: it's important not to mistake accidentally the long pin with the short pin, that will cause the circuit not to work
properly.

10 of 114
Hardware required
Below is the list of the hardware required for us to accomplish the lesson, all the hardware is included in the kit.
Please make sure to take the right hardware and prepare it for the lesson. The resistor can be either 220 or 300
ohms, both will work.
Material diagram
Material Name
Number (amount)
LED
1
220/300Ω resistor
1
Raspberry Pi Board
1
T-Cubbler Plus
1
40P GPIO Cables
1
Breadboard
1
Jumper wires
Several

11 of 114
Breadboard Schematic
Below is the breadboard schematics, make sure to be familiar with it. it’s important to understand how the
breadboard works in order not to damage components that are included with this kit.
Connection Diagram
As the diagram states, we will connect the negative pin of the LED to the resistor and the positive directly to the
Raspberry Pi GPIO.
Connection
LED
Raspberry Pi

12 of 114
LED
Raspberry Pi
Long Pin (+)
GPIO17
Short Pin (-)
GND
Code Overview, Code Overview, Compile and run
Our code is quite simple. We’ll define GPIO 17 as the blinking LED pin and then setup the pin as GPIO.OUT, we will
go through a while loop (forever till the program quit using CTRL-C or CTRL-Z, We will turn the LED on by setting
GPIO.HIGH, wait 0.2 seconds (200 milliseconds) and turn it off by setting GPIO.LOW.
We will repeat the process forever.
Compile the script by going into the samples directory and running: python3 blink.py
Application effect
Running the program, will turn on an LED on for one second, then off for one second, repeatedly.

13 of 114
It’s inside a while loop, the program will stop by pressing CTRL+C on the keyboard or CTRL+Z.
LESSON 2: BUTTON
Introduction
In this lesson we’ll learn how to use the button.
The button is very useful in many applications for example turn on light by press or even play some music.
In our specific example we’ll use the button to indicate if it was pressed or released.
Specification
Below is the button specification, as we can see, there are 2 pins, once the button is closed, it will close the circuit
and will cause the GPIO INPUT to indicate as “HIGH” once the button is open, the circuit is open and the GPIO INPUT
will indicate as “LOW”.

14 of 114
Hardware required
Below is the list of all the components that are required for this lesson.
Make sure to note that the resistor is 10K (kilo) ohm and not 10 ohm.
Material diagram
Material Name
Number (amount)
Button
1
10KΩ resistor
1
Raspberry Pi Board
1
T-Cubbler Plus
1
40P GPIO Cable
1
Breadboard
1
Jumper wire
Several

15 of 114
Connection Diagram
As we can see in the diagram, we connect the button to the 10K ohm resistor on the negative side as well as to the
GPIO port at GPIO17. The other pin of the button goes to 3V pin on the raspberry pi.
Please note: if you connect the button on the wrong direction the raspberry pi might indicate the opposite, GPIO
HIGH when the button is released and GPIO LOW when the button is pressed, therefore the script might not work as
expected.
Connection
Button
Raspberry Pi
Pin 1
GPIO17
Pin 2
3V3

16 of 114
Code Overview, Code Overview, Compile and run
Let’s take a look through our code: we set the button pin as GPIO 17 then the mode as GPIO.BCM, the button GPIO
will be GPIO.IN as we receive input from the button whenever it was pressed or not. Then we go while true (forever)
if GPIO.INPUT button is TRUE means the button is pressed, we print “button pressed” else, if it’s released, we print
“button released”.
Compile the script by going into the samples directory and running: python3 button.py

17 of 114
Application effect
Running the program, will print “button pressed” if the button is pressed and “button released” if the button is
released.
LESSON 3: BALL SWITCH
Introduction
In this lesson we’ll learn about the ball switch, also called “tilt sensor” once the switch is tilt to one side, it could be
either open or closed. The ball will touch the side of the switch causing it to close a circuit, tilting it to the other side
will cause the circuit to be open (due to the ball not touching the side of it)
Specification
Below is the ball switch specification, as we can see inside the switch there small balls, once they touch the left side,
it will close the circuit between the two “sticks” (pins) allowing the current to flow.

18 of 114
Hardware required
Below is the hardware list for our lesson, please make sure you are using the 10K ohm resistor and not a 10 ohm
resistor for this example.
Material diagram
Material Name
Number (amount)
Ball Switch
1
10KΩ resistor
1
Raspberry Pi Board
1
T-Cubbler Plus
1
40P GPIO Cable
1
Breadboard
1
Jumper wires
Several

19 of 114
Connection Diagram
As can be seen on the diagram, we connect the negative pin to the GND in the raspberry pi as well as to the 10K ohm
resistor and to one pin of the ball switch.
Note: it doesn’t matter which pin of the ball switch you choose, the decision, might effect the script. For example,
GPIO HIGH might be GPIO LOW or GPIO LOW might be GPIO HIGH.
If you see that the script is not as what expected in this tutorial, try to change the pins of the ball switch.
Connection
As we mentioned, the ball switch doesn’t have a specific pins, try both and see the results.

20 of 114
Component
Raspberry Pi
Pin 1
GPIO17
Pin 2
3V3
Code Overview, Code Overview, Compile and run
Let’s walk through our code: we setup the switch pin to GPIO17 as GPIO.IN because we receive input from the ball
switch whenever he close the circuit by tilting it or not. Then we go for while loop (forever) and print “BALL is HIGH”
if it’s closing the circuit or “BALL is LOW” if not. You can tilt the ball switch around to see the data changing.
Compile the script by going into the samples directory and running: python3 ball_switch.py
Table of contents
Other Elecrow Educational Equipment manuals
Popular Educational Equipment manuals by other brands

Tensegri-Teach
Tensegri-Teach 6-Dowel bowl with cacao pod Assembly instructions

popular
popular Little i-PEN manual

laerdal
laerdal Little Anne Important product information

Quanser
Quanser QNET Physics and Dynamics quick start guide

Regina
Regina FH-100E VER.2 instruction manual

pathway
pathway eGlass user manual

Global Specialties
Global Specialties PB-505A user manual

Prestan
Prestan PP-IM-100M Use and Care Instructional Sheet

AVer
AVer AVerVision F17+ user manual

Ambu
Ambu Airway Management Trainer Directions for use

Saltillo
Saltillo ALT-Chat Quick reference guide

CHASSE
CHASSE POPSICLE STICK BIRDHOUSE instructions