PC/CP320 Physical Computing

Raspberry Pi GPIO Introduction


  1. To introduce the Raspberry Pi
  2. To become familiar with Raspberry Pi GPIO pins and numbering
  3. To learn shell commands for interacting with Raspberry Pi GPIO pins





The Rapsberry Pi GPIO pins can easily be damaged with improper handling. For this lab, you will not be connecting anything other than a meter to the GPIO pins.

  1. Raspberry Pi Connections


    Connect the USB keyboard and mouse and the wifi dongle to the Raspberry Pi.

  2. Connect the monitor using the HDMI-to-VGA adapter.

  3. Insert the micro-SD card, and plug the USB power connector into the board.

  4. When you plug the adapter into the wall, the Pi should boot up. (The switch in the cable allows you to turn off power without having to unplug.)

  5. Early on you should see a rainbow screen, and it should end with a command prompt.
    Show successfully booted Raspberry Pi to the lab instructor.

  6. The default login to the pi is "pi", and the default password is "raspberry". For now, don't change these!
  7. GUI and wifi

    When the pi is booted and you are logged in, type
    to launch the graphical user interface.

  8. From the menu, you should be able to select wifi, and be able to connect to eduroam. By default, the pi won't remember your eduroam password for security.
    (Alternatively, you can click on the the wifi icon.)
    wifi icon
    You should now be able to open a browser and access this web page. Show this to the lab instructor.

  9. You can now open a terminal so that you can leave the GUI open and still work at the command line.
    If you can't connect to eduroam, it may be that the router is too busy. You can go ahead and do the rest of the lab; just use your laptop or phone to read the instructions.

  10. Here are some common commands for linux. Note that the cursor up and down keys take you through a history of previously used commands.
    Common linux commands
    Command Description Example
    ls list files in directory ls *.py
    sudo execute program as superuser sudo python3 test.py
    shutdown shutdown computer properly sudo shutdown -h now

  11. Identifying GPIO pins

    Identify pins GPIO17 and GPIO18 according to the Broadcom numbering scheme. Which pins are they in the board numbering scheme?
    Show identified GPIO pins to the lab instructor.

  12. Using the shell to control GPIO pins

    Accessing GPIO pins from user space
    Set up pin GPIO18 for output, and use the voltmeter to show that you can set it HIGH and LOW.

  13. Set up pin GPIO17 for input, and connect it to GPIO18. Change the state of pin GPIO18 and see that that is detectable by GPIO17.

    Demonstrate outputting to and inputtting from GPIO pins to the lab instructor.

  14. When you are done, shut down using
    sudo shutdown -h now
    When shutdown is complete, you can disconnect power, and put everything away. Be sure to reconnect the display, keyboard, and mouse to the computer.


To view pdf documents, you can download Adobe Acrobat Reader .
get Acrobat Reader
If you need to update a browser, you might try Firefox which is Get Firefox!
Since this page uses cascading style sheets for its layout, it will look best with a browser which supports the specifications as fully as possible.

If you are looking for an office package, with a word processor, spreadsheet, etc., you might try LibreOffice which is Get LibreOffice!

Go to the main page for the Department of Physics and Computer Science.

Valid XHTML 1.1

Valid CSS!

(Level AA)

Wilfrid Laurier University