Skip to content
Jonathan Bloedow edited this page Feb 16, 2017 · 18 revisions

Welcome to the EngineeringClub wiki!

Raspberry Pi

Bootstrapping the Pi

  1. Write raspbian-jessie image to microsdcard using Win32DiskImager

  2. Turn on pi while physically connected over ethernet to a router

  3. Log in to the router to find the LAN ip.

  4. ssh to the pi from laptop using that LAN ip. id=pi, password=raspberry. Windows users download and use putty for this.

  5. Configure wireless access vi:

    nano /etc/wpa_supplicant/wpa_supplicant.conf

Add something like:

network={
    ssid="<wifi id>"
    psk="<wifi password>"
    id_str="home"
}

network={
    ssid="NCA Students"
    key_mgmt=NONE
    id_str="school"
}
  1. Refresh all the libraries on the system. Just needs to be done 1x at startup.

    sudo apt-get update sudo apt-get upgrade (this takes a while!)

Webserver Stuff

Apache

 pi@raspberrypi:~ $ sudo apt-get install apache2

Mod-WSGI:

http://modwsgi.readthedocs.io/en/develop/user-guides/quick-configuration-guide.html

pi@raspberrypi:~ sudo apt-get install -y libapache2-mod-wsgi
pi@raspberrypi:~ sudo nano /etc/apache2/apache2.conf

Add this line to the end of that file:

WSGIScriptAlias /myapp /var/www/wsgi/myapp.wsgi

pi@raspberrypi:~ sudo mkdir /var/www/wsgi
pi@raspberrypi:~ sudo service apache2 restart

Dependencies (for turning on LEDs, LCDs, motors, etc.)

GPIO_ZERO

https://www.raspberrypi.org/blog/gpio-zero-a-friendly-python-api-for-physical-computing/

PIGPIO

Get & install it from this link (Download): http://abyz.co.uk/rpi/pigpio/python.html

To run now: sudo pigpiod

To have run on boot: sudo systemctl enable pigpiod

or better

sudo systemctl enable pigpiod 

From the pi, install git (if you don't already have it) and download the scripts here via:

git clone https://github.com/jonathanhhb/EngineeringClub.git

(This copies my code to your local system.)

LCD

Follow the instructions here: http://www.raspberrypi-spy.co.uk/2012/07/16x2-lcd-module-control-using-python/

That works.

Now copy the "init_script" instructions from this page:

https://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/init-script

(copy that code, do the 'chmod', and the line below). This makes it so your Pi displays the IP address on the LCD at boot.

LED Control

Copy the led_switch.py file to /var/www/wsgi/

sudo cp led_switch.py /var/www/wsgi/myapp.wsgi

Give it execute permissions

cd /var/www/wsgi
sudo chmod +x myapp.wsgi

Servos

https://learn.adafruit.com/adafruits-raspberry-pi-lesson-8-using-a-servo-motor/software