GPIO 40pin Breakout Expansion Board

From Wiki
Revision as of 01:36, 18 August 2016 by Root (Talk | contribs)

Jump to: navigation, search

Introduction

Gpi1.jpg

We can easily lead out pins of the Raspberry Pi to breadboard by GPIO Extension Board to avoid GPIO damage caused by frequent plugging in or out. This is our 40-pin GPIO Extension Board and GPIO cable for Raspberry Pi model B+, 2 model B and 3 model B.

Gpi2.jpg

Raspberry Pi Pin Number Introduction

The middle column is the pin names marked on the extension board, and the corresponding pin names are provided on its left and right for numbering by BCM and by wiringPi. The Name column is what the Raspberry Pi defines of the pin. "-" in two columns on the same line indicates the pin number and name is the same for the two numbering methods.

Besides, in Python, pins are usually defined by the physical position on the board. From top to bottom and left to right, the pin is defined as 3V3 (1), 5V0 (2), SDA1 (3), etc., till GPIO40. You'll get to more details in lessons later.

Gip3.jpg

40-pin GPIO Extension Board

GPIO Libraries WiringPi

Introduction

WiringPi is a GPIO library for C applied to the Raspberry Pi. It complies with GUN Lv3. The functions in wiringPi are similar to those in the wiring system of Arduino. They enable the users familiar with Arduino to use wiringPi more easily.

Now the Raspbian Jessie 2016-05-27 has wiringPi pre-installed, you can use it directly.

Test whether wiringPi is installed or not

WiringPi includes lots of GPIO commands which enable you to control all kinds of interfaces on Raspberry Pi. You can test whether the wiringPi library is installed successfully or not by the following instructions.

   gpio –v

Gpi4.jpg

If the message above appears, the wiringPi is installed successfully.

Use the command below to see the GPIO layout

   gpio readall

Gpi5.jpg

RPi.GPIO

If you are a Python user, you can program GPIOs with API provided by RPi.GPIO.

Introduction

RPi.GPIO is a module to control Raspberry Pi GPIO channels. This package provides a class to control the GPIO on a Raspberry Pi. For examples and documents, visit http://sourceforge.net/p/raspberry-gpio-python/wiki/Home/

Now the Raspbian Jessie 2016-05-27 has RPi.GPIO pre-installed, you can use it directly, too.

Test whether RPi.GPIO is installed or not:

Type in python to python CLI:

Gpi6.jpg


In Python CLI, Type in:

import RPi.GPIO

If no error prompt, means RPi.GPIO is installed.

Gpi7.jpg

Then, type in

RPi.GPIO.VERSION

Gip8.jpg

If it show its version like about, your Pi is ready to go!