Quickly Get Started with Raspberry Pi Kits

From Wiki
Revision as of 01:59, 22 June 2016 by Root (Talk | contribs) (Created page with "==Overview== This article is a tutorial of basics for getting started quickly with Raspberry Pi kits. If you're new to Raspberry, you can use it as a best tool to begin your...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

This article is a tutorial of basics for getting started quickly with Raspberry Pi kits. If you're new to Raspberry, you can use it as a best tool to begin your journey! Take the Lesson 1 of Super Kit for Raspberry Pi for example.

Get Started

Preparation

1.Prepare a MicroSD/TF car 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 WiFi 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.

How to Open a Terminal

In the subsequent tutorials, the terminal will be used from time to time. It is a platform for interactions in Linux. Therefore, before starting the lessons, you may need to know more about TERMINAL. Raspberry Pi as Master (recommended for beginners) 1.Preparations: a screen monitor, an HDMI cable (if your monitor only has a VGA port, use a VGA-HDMI converter), a USB mouse, a USB keyboard and a network cable. 2.Connect the monitor to power. Then connect it with the Raspberry Pi via the converter cable. Connect the LAN port of the router to the network port on the Raspberry Pi by a network cable, and the mouse and keyboard to USB ports. At last, connect a 5V 2A DC power to the Raspberry Pi. Power on the screen if needed. Then you can see the display showing the Raspberry Pi icon as shown below. If the monitor displays colored texts with a black background after booting, it indicates that the option for automatically loading a graphic user interface (GUI) is not active. To activate it, you can type in startx with the keyboard and press Enter. Wait for a while and the display will show up as below.

Note: The screen monitor shown above is the 7inch 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.

4.Then a terminal will pop up as follows:

For Windows Users If your computer runs on Windows, you may go to the Raspberry Pi in a remote way, like PuTTY. 1.Similarly plug the TF card into the Raspberry Pi (Raspberry Pi), power the Raspberry Pi with a 5V 2A DC power and connect the LAN of the router with the network port of the Raspberry Pi. So now the Raspberry Pi is ready. 2.Then you need to know the IP address of the Raspberry Pi. You can find it on the settings interface of your router. For more details, please refer to your router provider's page. 3.Open PuTTY and click Session on the left tree-alike structure (generally it's collapsed upon PuTTY startup):

4.Enter the IP address of the Raspberry Pi you just got in the textbox under Host Name (or IP address) and 22 under Port (by default it is 22)

5.Click Open. Note that when you first log in to the Raspberry Pi with the IP address, you'll be prompted with a security reminder. Just click Yes. When the PuTTY window prompts login as: type in the user name of the Raspberry Pi: pi, and password: raspberry (the default one, if you haven't changed it). Pay attention: when you're typing the password in, the window shows nothing just null, but you're in fact is typing things in. So just focus on typing it right and press Enter. After you log in the Raspberry Pi successfully, the window will display as follows.

For Linux or Mac OS X Users Linux and Mac OS X users can only log in the Raspberry Pi via ssh. Go to Applications->Utilities, find the Terminal and open it.


Type in ssh pi@ip_address – ssh is the tool for remote logging, pi, the user name, and ip_address as the name suggests, your Raspberry Pi's IP address. For example:

   ssh pi@192.168.0.1

Press Enter to confirm. If you get a prompt that no ssh is found, you need to install an ssh tool like Ubuntu and Debian by yourself:

   sudo apt-get install ssh

For other Linux platforms, please contact your supplier. Now, no matter what method you take, you can get in the client and log into the Raspberry Pi.


Introduction to Raspberry Pi Before starting to learn the commands, you first need to know more about the pins of the Raspberry Pi, which is key to the subsequent study. There are several models of Raspberry Pi. To know some information about them, both the Raspberry Pi Model B (R1) and Model B have 26 pins, when Model B+, 2 Model B, and 3 Model B have 40. This difference is vital when you have a Raspberry Pi and want to do experiments or projects, but the related tutorials or materials are written based on a specific board which is different from yours. For more, refer to the official website www.raspberrypi.org. 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.

26-pin GPIO Extension Board and GPIO cable for Raspberry Pi 1 model B and 1 model A:

Raspberry Pi Pin Number Introduction For you to better understand, we draw the pin mapping tables below for the 26-pin/40-pin GPIO Extension Board. The pin mapping table for 26-pin GPIO Extension Board. Its 5V0 and 3V3 pins are not shown.

26-pin GPIO Extension Board 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 GPIO21 (40). You'll get to more details in lessons later.


40-pin GPIO Extension Board


Install Libraries Similarly, go to the client and log in to the Raspberry Pi. Here we'll take the Raspberry Pi as the master. WiringPi Introduction WiringPi is a C language GPIO library applied to the Raspberry Pi platform. 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. How to install Step 1: Get the source code of wiringPi

   git clone git://git.drogon.net/wiringPi

Note: git clone is a command in Linux that is used to clone a release repository from a remote master. To use it, just type in git clone (address of the repository). Step 2: Install wiringPi

   cd wiringPi
   git pull origin
   ./build

Note: cd, short for change directory, is a Linux command to change to the intended directory literally. To use it, type in cd <directory>. For example, type in cd wiringPi to go to the wiringPi folder. The command git pull origin is to update. After you press Enter, with the script build, the source code of wiringPi will be compiled automatically and installed to the appropriate directory of Raspberry Pi OS.

Step 3: Test whether wiringPi is installed successfully 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

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

   gpio readall

Raspberry Pi.GPIO If you are a Python user, you can program GPIOs with API provided by Raspberry Pi.GPIO. Introduction Raspberry Pi.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/ The Raspbian OS image of Raspberry Pi installs Raspberry Pi.GPIO by default, so you can use it directly. So in this kit, please note that the example code is ONLY applicable for Raspbian.