Skip to content

Commit 7a9a7c5

Browse files
author
Lorena Mesa
authored
Merge pull request #3 from tachyonlabs/Adding-Intro-to-the-Raspberry-Pi-presentation
Adding Introduction to the Raspberry Pi presentation for Santa Cruz P…
2 parents f56e5ed + 68f4d0b commit 7a9a7c5

File tree

2 files changed

+154
-0
lines changed

2 files changed

+154
-0
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# A short introductory Raspberry Pi Presentation
2+
3+
*I had mentioned a Raspberry Pi project at a [Santa Cruz PyLadies](https://www.meetup.com/PyLadiesSC/) meetup,
4+
and some people who weren't familiar with the Raspberry Pi asked me about it. I volunteered to demonstrate some
5+
Raspberry Pi stuff at the [June 4, 2018 Speaker Night](https://www.meetup.com/PyLadiesSC/events/250555271/),
6+
and the following is the script I wrote for my presentation, with links and code.*
7+
8+
## Introduction to the Raspberry Pi
9+
10+
*(I hand someone my Raspberry Pi, so they can examine it and pass it around the room.)*
11+
12+
The [Raspberry Pi](https://www.raspberrypi.org/) is a single-board Linux computer which was first released in
13+
2012, and over 19 million of them have been sold. The most common models are the size of a credit card, and cost
14+
around $35, but there are also smaller Raspberry Pi Zero models that only cost $5 and $10. You *can* use them as
15+
general purpose computers -- [Idea Fab Labs](http://santacruz.ideafablabs.com/) has some as dedicated print
16+
servers for 3D printers -- but at those prices, as you can imagine they're pretty low-end and slow compared to
17+
mass-market laptop and desktop computers. What makes them particularly special and popular (in addition to the
18+
price) is that they have a lot of input/output pins that your programs can use to talk to and control hardware,
19+
making them well-suited for use in robotics, home automation, art installations, etc.
20+
21+
Being Linux computers, you can write and run programs on them using any language you like, but the Raspberry Pi
22+
community mostly revolves around Python. Raspberry Pis come with Python 2 and 3 installed, including the Python
23+
[Rpi.GPIO](https://pypi.org/project/RPi.GPIO/) library that makes it easy for your programs to control the
24+
Raspberry Pi's GPIO (General Purpose Input/Output) pins. They also come with the
25+
[IDLE](https://docs.python.org/3/library/idle.html) Python IDE, but you can use other IDEs (or text editors)
26+
too, such as
27+
[PyCharm](https://www.jetbrains.com/pycharm/) free Community Edition, which I use.
28+
29+
## Hello World, plus HATs
30+
31+
Remember the last meetup, where we were doing "Hello World!" with different languages and web frameworks? Well,
32+
when you're getting started with a Raspberry Pi (or Arduino, or Android Things), the "Hello World" equivalent is
33+
to connect and blink an LED. A [breadboard](https://learn.sparkfun.com/tutorials/how-to-use-a-breadboard) is a
34+
tool that lets you easily make circuits and connections by poking wires and components into it -- everything is
35+
reusable, and you don't need to do any soldering. Adafruit has a product called the
36+
[Cobbler](https://www.adafruit.com/product/914) which I have here, and which connects to the Raspberry Pi with a
37+
cable, and then plugs into a breadboard, to make all Raspberry Pi pins labeled and easily accessible from the
38+
breadboard, but you can also just use jumper wires to connect individual Raspberry Pi pins one at a time to a
39+
breadboard.
40+
41+
*(I retrieve my Raspberry Pi from the audience, plug the Cobbler into it, plug in a keyboard, mouse, and cable
42+
to a giant display on the wall, and power it up.)*
43+
44+
For the hardware part of this example we're going to use a jumper wire to connect one of the Raspberry Pi's
45+
Ground pins to one end of this 330-ohm resistor, then we're connecting the other end of the 330-ohm resistor to
46+
the negative pin of this LED, and then using another jumper wire to connect the Raspberry Pi's GPIO20 pin to the
47+
positive pin of the LED. (I didn't choose GPIO pin 20 for any particular reason - you can use whichever GPIO pin
48+
or pins you like so long as you use the same pins in your software.)
49+
50+
For the software part of this example we have
51+
[hello_world_blink.py](./hello_world_blink.py).
52+
53+
*(I do a walk-through of [the code](./hello_world_blink.py) and run it.)*
54+
55+
In addition to building your own circuits or prototypes, you can also buy pre-built add-on boards called "HAT"s
56+
("**H**ardware **A**ttached on **T**op") that plug onto the Raspberry Pi's pins and extend your Raspberry Pi's
57+
functionality with components like sensors, buttons, displays, etc., and may come with their own Python libraries
58+
to make them really easy to use in your programs.
59+
60+
## [Raspberry Pi Instagram Slide and Video Show](https://github.com/tachyonlabs/raspberry_pi_slide_and_video_show)
61+
62+
I'm a volunteer at the [Idea Fab Labs](https://santacruz.ideafablabs.com/) maker/hacker/artspace here in Santa
63+
Cruz, and I was asked to set up a Raspberry Pi for our weekly open house and for IFL booths at events, so that
64+
all you had to do was plug it into a large monitor and it would start running a slideshow of
65+
[Idea Fab Labs' Instagram feed](https://www.instagram.com/ideafablabs/) of photos of projects, facilities, and
66+
events.
67+
68+
I had written my original
69+
[Raspberry Pi Instagram Slideshow](https://github.com/tachyonlabs/raspberry_pi_instagram_slideshow) version in
70+
Python using the [Tkinter](https://wiki.python.org/moin/TkInter) GUI, but when I was asked to update it to
71+
include Instagram videos as well as photos, I
72+
[rewrote it](https://github.com/tachyonlabs/raspberry_pi_slide_and_video_show) (still in Python) using the
73+
cross-platform (you can run your same Python application on Windows, OS X, Android, and iOS, in addition to
74+
Raspberry Pi/Linux) [Kivy](https://kivy.org/) Framework.
75+
76+
*(I demonstrate my Raspberry Pi Instagram Slide and Video Show application.)*
77+
78+
## Free Giant Amazing Raspberry Pi Project Books!
79+
80+
There are three official Raspberry Pi project books that are free online, each one 200 lavishly-illustrated
81+
pages of projects and articles (including beginner's guides). You'll see projects for gaming, music, robotics,
82+
Lego, telescope control, high-altitude photography, terrarium lighting control, etc. etc. etc.
83+
84+
* [The Official Raspberry Pi Projects Book](https://www.raspberrypi.org/magpi-issues/Projects_Book_v1.pdf)
85+
* [The Official Raspberry Pi Projects Book Volume 2](https://www.raspberrypi.org/magpi-issues/Projects_Book_v2.pdf)
86+
* [The Official Raspberry Pi Projects Book Volume 3](https://www.raspberrypi.org/magpi-issues/Projects_Book_v3.pdf)
87+
88+
*(I load [The Official Raspberry Pi Projects Book](https://www.raspberrypi.org/magpi-issues/Projects_Book_v1.pdf)
89+
into a browser window on the Raspberry Pi.)*
90+
91+
## Have fun!
92+
93+
So get a Raspberry Pi, and have fun! A lot of people are hesitant to try hardware projects with their computers
94+
because they have no idea where to start, and are afraid they might fry their computers. But the Raspberry Pi
95+
is not only built for hardware projects and very beginner-friendly and Python-friendly, but also very cheap, in
96+
case of those rare occasions where worst really does come to worst.
97+
98+
## A Cautionary Tale
99+
100+
"Have fun!" would normally be the end of the story, but in this case I also have a postscript:
101+
102+
If you remember the "HAT"s, well, when I was writing my script for this presentation, and concluded it with the
103+
part about not worrying about frying your computer, I thought, oh, I have an "Android Things"
104+
"[Rainbow HAT](https://www.adafruit.com/product/3354)" board which is supposedly also compatible with the
105+
Raspberry Pi, I should demo that in my presentation as well. And I plugged it into my Raspberry Pi, and powered
106+
up, and it didn't boot. And I powered down, unplugged the Rainbow HAT, powered up again, and still nothing.
107+
108+
A Raspberry Pi stores the OS and all your files on a micro SD card, which helps keep it very cheap, but in my
109+
experience they can be kind of sensitive, and in this case it had gotten fried not just to the point where I
110+
would need to use my laptop to reformat it and recopy a system image to it, but to the point where it would just
111+
not even format. And because I didn't have a spare one (which is like a $5 part) and hadn't backed up my
112+
existing one before this happened, it was a mad dash to get a new one and download/install/compile lots of
113+
packages that I use in time to be able to do this presentation this evening.
114+
115+
So yes, have fun! But it's also good to play it safe by having one or more spare SD cards, and backing up a
116+
system image of your SD card to your laptop or desktop *after* you've installed everything in sight on it.
117+
118+
## Author Information
119+
| Author Name | Email | OK to contact? |
120+
| ----------- | ----- | -------------- |
121+
| Tané Tachyon | tachyon@tachyonlabs.com | Yes |
122+
123+
This presentation is also available at
124+
[https://github.com/tachyonlabs/raspberry_pi_pyladies_presentation](https://github.com/tachyonlabs/raspberry_pi_pyladies_presentation).
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# The Rpi.GPIO library makes it easy for your programs to read from and write to
2+
# the Raspberry Pi's GPIO (General Purpose Input/Output) pins
3+
import RPi.GPIO as GPIO
4+
import time
5+
6+
# GPIO.BCM mode selects the pin numbering system of GPIO pin channels
7+
# as opposed to GPIO.BOARD mode which uses P1 connector pin numbers
8+
GPIO.setmode(GPIO.BCM)
9+
# Any Raspberry Pi pin you use needs to be set as either an input or an output
10+
# Here we are setting pin GPIO 20 as an output to control the LED
11+
GPIO.setup(20, GPIO.OUT)
12+
13+
# Blink the LED 20 times
14+
for i in range(20):
15+
# Output high (3.3 volts) on pin 20, to turn the LED on
16+
GPIO.output(20, 1)
17+
# Leave the LED on for one second
18+
time.sleep(1)
19+
# Output low (0 volts) on pin 20, to turn the LED off
20+
GPIO.output(20, 0)
21+
# Leave the LED off for one second
22+
time.sleep(1)
23+
24+
# This resets any ports used in your program
25+
GPIO.cleanup()
26+
27+
# Why not? :-)
28+
print("Hello World!")
29+
# This will print some general info about your Raspberry Pi
30+
print("Raspberry Pi stats: {}".format(GPIO.RPI_INFO))

0 commit comments

Comments
 (0)