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
Table of contents
Other Elecrow Educational Equipment manuals


















