Part 3: Update the OS, Enable SPI & GPIO, and install modules


Make sure your Linux distribution is up to date and has the right Python modules installed:

    1. Update your Linux distribution by typing in the following commands(**NOTE** This can take up to 45 minutes or more to complete):
      sudo apt-get update then
      sudo apt-get upgrade then
      sudo apt-get dist-upgrade (this part takes a long time) then
      sudo apt-get install python3-pip to update python 3 packages, then
      sudo apt-get install git-core to install github 3rd party software and modules.
    2. Get SPI working on the Raspberry Pi by typing:
      sudo nano /etc/modprobe.d/raspi-blacklist.conf then edit raspi-blacklist.conf to look like the below text(comment out the blacklist spi line with a # mark):

      # blacklist spi and i2c by default (many users don't need them)
      
      #blacklist spi-bcm2708
      blacklist i2c-bcm2708
      

      sudo reboot to reboot your Raspberry Pi. After rebooting type:
      ls /dev/ now you should see spidev0.0 and spidev0.1 listed as devices (see below image).

      SPI devices

      SPI devices shown when typing ‘ls /dev/’

    3. Download and install the SPI and GPIO Python module for the Raspberry Pi by typing:
      git clone git://github.com/quick2wire/quick2wire-python-api.git to download the quick2wire module then
      cd quick2wire-python-api then
      sudo python3 setup.py install to install the quick2wire module then
      cd .. then
      sudo rm –r quick2wire-python-api to remove the directory after installation
    4. Download and install the forked version(maintains flicker code, which I need) of pigredients, with ws2801 driver IC, by typing:
      git clone git://github.com/mikegwatson/pigredients.git to download the pigredients module then
      cd pigredients then
      sudo python3 setup.py install to install the pigredients module then
      cd .. then
      sudo rm –r pigredients to remove the directory after installation
    5. Download and install the weatheralerts module by typing:
      sudo pip-3.2 install weatheralerts wait a while for this to install…
    6. Download the WS2801 RGB test script by typing:
      sudo wget https://dl.dropbox.com/u/8170542/RGB_test.py to download the RGB test script
      sudo chmod 755 RGB_test.py to make the script executable
    7. Download the General Purpose Input/Output test script by typing:
      sudo wget https://dl.dropbox.com/u/8170542/GPIO_test.py to download the GPIO test script
      sudo chmod 755 GPIO_test.py to make the script executable
    8. Download the Alerts Tube Python script by typing:
      git clone git://github.com/mikegwatson/AlertsTube.git to download the AlertsTube.py script then
      cd AlertsTube then
      sudo chmod 755 GPIO_test.py to make the script executable
  1. Personalize the Alerts Tube script by typing: sudo nano AlertsTube.py and edit line 16 which says:
    KEY = ‘YOUR_KEY_GOES_HERE’ and set KEY equal to your own free Weather Underground Developer key. You can get a free Weather Underground key at: http://www.wunderground.com/weather/api/d/pricing.html then modify your location to whatever State and City you are in, e.g. LOCATION = ‘MA/Wellesley’.
  2. Personalize

    Personalize the AlertsTube.py script

  3. Get your area’s weather alert SAME code at http://www.nws.noaa.gov/nwr/indexnw.htm#sametable and modify it accordingly to your area’s SAME code, e.g. MY_SAME_CODE = ‘025021’ then set ALERT_SEVERITY to “severe” or “major” or “moderate” or “minor”. The “minor” option yields the most alerts, while “severe” option yields the least, but only the most severe. Next set PRECIP_THRESHOLD to a number between 0 and 100, where 0 is 0% chance of precipitation and 100 is 100% chance of precipitation. e.g. PRECIP_THRESHOLD = 40. Next set CHECK_DELAY to the number of seconds that you would like to wait before checking for alerts. For example, CHECK_DELAY = 600, means check for alerts every 600 seconds, which is 10 minutes. Next enable or disable ALERT_SOUND, which plays a sound when a new alert is generated. e.g. ALERT_SOUND = True, means play a sound when a new alert is detected. Additionally, enable or disable CHECK_EMAILS, which when enabled will check an email account like gmail for emails containing alert information. e.g. CHECK_EMAILS = True, enables email account checking. When CHECK_EMAILS is set to True you must also include email account login credentials, such as your EMAIL_ADDRESS and EMAIL_PASSWD. These are stored as clear text, since the account created, on gmail, is for the AlertTube only, so it doesn’t really matter if it gets hacked. I’ll just create another account if there’s a problem.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s