Week 3 Lab 3 Name: Raspberry Pi/GERTBOARD Objective Introduce the student to the GERTBOARD input/output interface for the Raspberry Pi.

Week 3                                           Lab 3                Name:

Raspberry Pi/GERTBOARD

Objective

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+

GERTBOARD

Introduction

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

Connect the GERTBOARD to the Raspberry Pi.

Connect the computer monitor, mouse, and keyboard to the Raspberry Pi.

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.

Plug in power to the Raspberry Pi.

After the Pi boots up, key in username pi, and password raspberry.

At the command prompt, key in startx.

Double click LXTerminal.

Open Python v. 2.7.

The Python Shell will appear.

On the top menu, click FILE, NEW WINDOW.

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).

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.

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.

On the Raspberry Pi desktop, launch LXTerminal.

At the command prompt key in: sudo python YourNameWk3part1.py

If the switch is not pressed, the message on the screen will display:

Pin 25 is a logic 1.

Continue checking pin 25?       y or n

On the GERTBOARD, LED D2 should be on, LED D1 will be on.

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?       y or n

Instructor signoff ____________________________

Hold the CTRL key and press c to terminate the program.

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.

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.

“Pin 24 is a logic (0 or 1 state)”

Continue checking pin 24?       y or n

Hit F5 to compile the program.

Go to LXTerminal, hit the up arrow to retrieve the previous command and hit the ENTER key.

Instructor signoff ____________________________

Part 2

From the Python Shell upper menu, select FILE/NEW WINDOW.

Key in the program below.

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).

Use the same procedure in Part 1 to save the file as YourNameWk3part2.py

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.

Test the program to make sure it works. On the keyboard, hit CTRL-c to terminate the program.

Change the long jumpers to the following.

(B1/GP25) to (B3/GP24)—switch S3 connects to GPIO pin 24, input.

(B2/GP17) to (B1/GP22)—LED D1 connects to GPIO pin 22, output.

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)].

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.







Calculate Your Essay Price
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Order your essay today and save 10% with the coupon code: best10

Academic Pros