Raspberry Pi/GERTBOARD

Introduce the student to the GERTBOARD input/output interface for the Raspberry Pi. The purpose of the lab is to allow students to get experience on how a computer can interact with simple peripheral devices, such as switches and light-emitting diodes (LEDs). The student will gain experience making software changes, to make hardware perform in a desired fashion.
Parts Needed
• Raspberry Pi version B+
Computers are designed to process data from external input devices such as keyboards, mice, switches, lights, scanners, and sensors. Computers control various output devices such as monitors, printers, LCD displays, motors, and solenoids.
Procedure Part 1

  1. Connect the GERTBOARD to the Raspberry Pi.
  2. Connect the computer monitor, mouse, and keyboard to the Raspberry Pi.
  3. On the GERTBOARD make the following connections.
    Place small black jumpers on 74244 driver outputs B1–B8.
    Connect two long jumpers from GP25 to B1 and GP22 to B2.
  4. Plug in power to the Raspberry Pi.
  5. After the Pi boots up, key in username pi, and password raspberry.
  6. At the command prompt, key in startx.
  7. Double click LXTerminal.
  8. Open Python v. 2.7.
  9. The Python Shell will appear.
  10. On the top menu, click FILE, NEW WINDOW.
  11. Key in the program below. The Raspberry Pi will read the condition of switch S1 on the GERTBOARD. If the switch is pressed, a Logic 0 is sent to GPIO pin 25. If the switch is untouched, a Logic 1 goes to pin 25. A message is sent to the computer monitor indicating the state of the switch. The program will pause asking if the operator wants to continue checking the status of the switch. Type y for YES or n for NO (program will terminate).
  12. Hit F5 to compile and check for syntax errors, when the system asks if it is OK TO SAVE, save the file as YourNameWk3part1.py in /home/pi directory.
  13. The Python Shell should indicate “RUNTIME ERROR: NO ACCESS TO /DEV/MEM. TRY RUNNING AS ROOT.” If this is the only error and no syntax issues occur, you are ready to run the program.
  14. On the Raspberry Pi desktop, launch LXTerminal.
  15. At the command prompt key in: sudo python YourNameWk3part1.py
  16. If the switch is not pressed, the message on the screen will display:

Pin 25 is a logic 1.
Continue checking pin 25?
On the GERTBOARD, LED D2 should be on, LED D1 will be on.

  1. Press and hold S1 on the GERTBOARD, on the keyboard, key in y and press the enter key. While S1 is pressed, D2 LED will be off, LED D1 will be off, and the message on the screen will be
    “Pin 25 is a logic 0”.
    Continue checking pin 25?

Instructor signoff ________________

  1. Hold the CTRL key and press c to terminate the program.
  2. Move the long jumpers that are connected to (B2/GP22) to (B3/GP23) and (B1/GP25) to (B2/GP24). Now the S2 switch (middle switch) will be monitored for a key depression. The LEDs to observe will be D2 and D3.
  3. Modify the program to initialize GP24 for input using internal pull-up resistors and GP23 for output. Change the print instruction so the program will display the following.
  4. Hit F5 to compile the program.
  5. Go to LXTerminal, hit the up arrow to retrieve the previous command and hit the ENTER key.

Instructor signoff ________________

Part 2

  1. From the Python Shell upper menu, select FILE/NEW WINDOW.
  2. Key in the program below.
  3. Connect two long jumpers from GP25 to B1 and GP17 to B2. These connections will connect switch S1 to GPIO pin 25 (input) and LED D2 to GPIO pin 17 (output).
  4. Use the same procedure in Part 1 to save the file as YourNameWk3part2.py
  5. If S1 is pressed on the GERTBOARD, LED D2 will flash ON and OFF at 1- second intervals. If the button is released, the output will be OFF.
  6. Test the program to make sure it works. On the keyboard, hit CTRL-c to terminate the program.
  7. Change the long jumpers to the following.

Modify the Python program to reinitialize the GPIO port pins so when the program runs, D1 will flash ON/OFF when S3 is pressed. Change the delay time to 500msec [replace sleep (1) with sleep(.5)].

  1. Go to LXTerminal and run the Python program to verify the software/hardware modification is functional. Hit CTRL-c to terminate the program.

Submission Instructions
Connect Ethernet cable to the Raspberry Pi. Go to Desktop, open Web browser. In the address area, type http://devryu.net. Put in eCollege username and password. Open course. Go to Dropbox, attach your Python Files, then Submit. On a PC, complete Lab 3 datasheets and save as FirstNameLastNameWeek#Lab.docx and submit to the Dropbox.
Type sudo shutdown –h now, hit the ENTER key. Disconnect power from Raspberry Pi.

For instant digital download of the above solution, Please click on the “PURCHASE” link below to get the tutorial for ECT 274 Week 3 Raspberry Pi GERTBOARD Answer

For instant digital download of the above solution or tutorial, please click on the below link and make an instant purchase. You will be guided to the PAYPAL Standard payment page wherein you can pay and you will receive an email immediately with a download link.

In case you find any problem in getting the download link or downloading the tutorial, please send us an email on ekmtutor@gmail.com

Leave a Comment