Raspberry-Pi-E-Mail-Notifier-Using-Leds.pdf

(640 KB) Pobierz
Raspberry Pi E-mail Notifier Using LEDs
Created by Mikey Sklar
Guide Contents
Guide Contents
Overview
Remote SSH
Prepare Python
Wire LEDs
Python Script
Adafruits Cobbler Breakout Kit
2
3
4
5
7
9
11
© Adafruit
Industries
http://learn.adafruit.com/raspberry-pi-e-mail-notifier-using-leds
Page 2 of 11
Overview
Raspberry Pi’s popularity make things so easy that it is almost scary. I set forth on a simple
starter project of having the raspberry pi show me when new gmail messages arrive. After
some searching it seems that lots of people are already talking about how to do this and there
are some great examples.
Michael over at MitchTech (http://adafru.it/aJG)
had the most ready
to go code which I pilfered from.
Adafruits Cobbler Breakout Kit (http://adafru.it/914)
makes the
bread board experience even easier with the clearly labeled pins for each of raspi’s GPIOs.
These are the things I had to setup in order to get a working raspberry pi + gmail + adafruit
cobbler. You can probably get yourself up and running with this same setup in less than 30
minutes!
© Adafruit
Industries
http://learn.adafruit.com/raspberry-pi-e-mail-notifier-using-leds
Page 3 of 11
Remote SSH
The first step is to get the Raspberry Pi ready to SSH in. This allows us to do all the typing on a
bigger, more comfortable computer. Its not essential but we found it pretty darn handy!
Setting up the pi to allow remote log-ins only has to be done once!
Be sure to have a SD card with a working Linux distribution (we wont cover this here)
Be sure to have a micro USB cable to power the Pi
Connect a monitor (Television or HDMI), USB keyboard, and working Ethernet cable to the Pi
Power up the Pi. Make sure you can start up the Pi, see the white loading text and
the
lo gin:
prompt. Login with user name
pi
and password
raspberry
Then type in the following commands in order
1.
sudo bash
2.
ssh-keygen -t rsa
(hit enter twice when prompted)
3.
mv /bo o t/bo o t_enable_ssh.rc /bo o t/bo o t.rc
Then reboot by typing in
rebo o t.
Now look for the IP address on boot up. Its circled in red
above.
Now you can use an SSH client on a windows/mac/linux computer (there are lots of free ones
out there) and log in to that ip address (for example,
192.168.1.106
or whatever yours is)
with the same username
pi
and password
raspberry
Now you can control the Pi from your desktop computer! Remember that this IP address can
only be accessed from
within the lo cal netwo rk
(that is, your home or office with a shared
router) - you can't get to it from the outside world if you have a
192.
or
10.
IP address. Ask
your friendly IT/Network admin if you have questions about this.
© Adafruit
Industries
http://learn.adafruit.com/raspberry-pi-e-mail-notifier-using-leds
Page 4 of 11
Prepare Python
We have to install Python (the programming language controller) and some libraries to follow
the tutorial
Now from either the keyboard/monitor or SSH console type in
sudo apt-get install pytho n-dev
sudo apt-get install pytho n-pip
Then you can install the email management python library:
sudo pip install feedparser
© Adafruit
Industries
http://learn.adafruit.com/raspberry-pi-e-mail-notifier-using-leds
Page 5 of 11
Zgłoś jeśli naruszono regulamin