Day 25

Physical Computing with Raspberry Pi

Supplies

Raspberry Pi and Power Cord

Micro SD Card with Raspbian

Female Jumper Wires

3.5mm Screws (4)

Wire Stripper

Scissors

Screw Driver or Drill

5 1/2" x 7 1/2" Piece of Wood (1/2" or 1" thick)

Long Wood Screws or Nails

Soldering Iron

Solder

5 1/2" x 3 1/2" Piece of Wood

LED

150 Ω Resistor

Step 1: You need a piece of wood that is about 5 1/2" x 7 1/2". It can be inch or half inch thick.

Step 2: Place the Raspberry Pi with the formatted SD card on the upper left corner of the wood.

Step 3: Take your small 3.5mm Raspberry Pi screws and attach the Pi to the wood. Caution, do not screw in too tight. You can break the SD Card. Trust me on this one.

Step 4: You are going to mark the locations for the 5 tall screws/nails. Place them at the bottom of the board and evenly spaced.













Step 5: Drill or hammer the screws/nails into place. Do not go all the way through the wood. Just deep enough to be secure.

Step 6: Label the screws from left to right; Gnd, GPIO 4, GPIO 3, GPIO 2, 5V

Step 7: Take your female jumper cables and attach them to the correct pins. See the diagram for help. The wires should be placed in the same order as the labeled screws.

Step 8: You want to stretch out the wire to the designated pin and strip it to allow you about an inch or so of the copper exposed so you can wrap it around the nail/screw.

Step 9: You will use the solder and the soldering iron to connect the wire to the screw/nail. Important note: You need to make sure that your screw/nail is not coated with something that will not make is conductive/less conductive. If it is, you can always connect the alligator clips directly to the soldered area on the nail/screw and it will work.

Step 10: Connect the rest of the wires the same way you connected the GND.

Be careful! Soldering Irons get hot!

Congrats! You have a Raspberry Pi Physical Computing Board!

Let's make a part to connect to it!

An LED is the simplest add-on for the board.

Step 1: You will need 5 1/2 x 3 1/2 board

Step 2: Solder the Resistor to the short end of the LED and connect the other resistor into the female end of the Jumper Cable.

Step 3: Connect the female end of another Jumper Cable to the long end of the LED.

Step 4: Like you did with the Pi Board, mark off where the nails/screws will go. You will only need two. One for GND and the other for GPIO.

Step 5: Measure out the length you will need for the wires and clip, strip, and solder them to the nails.

Step 6: The LED likes to move around, so I found using a staple gun to staple them in place was helpful. Notice that I stapled over the plastic covers to stay away from the conductive parts. A little stick tack on the bottom of the LED kept it upright and in place.

Congrats! You have a LED Physical Computing Board!

Let connect them all together!

Step 1: Plug in the HD cable and the power to the Raspberry Pi. Also plug in a mouse and keyboard.

Step 2: Open up Thonny in the programming section of the Raspberry Pi menu.

Step 3: Type in the following code exactly as it is written:

from gpiozero import LED

myled = LED(2)

myled.blink()

Step 4: Connect an alligator clip from the Raspberry Pi Board nail labeled GPIO 2 and connect it to nail labeled GPIO on the LED Board.

Step 5: Connect an alligator clip from Raspberry Pi Board nail labeld GND and connect it to the nail labeled GND on the LED Board.

The LED might light up right away. That is a good sign the connections are working, but you haven't run the code yet.

Step 6: Press the green button on Thonny to run the program you wrote. You should see the LED blink.

You did it!

What's next?

You can create boards that incorporate buttons and buzzers. The 5V pin is needed to run motion and light sensors. You can create all of those following the same steps as above.

Resource

Raspberry Pi GPIO Library - This will give you all of the lines of code you might need to make buttons, buzzers, sensors, and other items work with your physical computing boards.