Boise Linux Users Group Meeting Report - December 16

Good Meeting, lots of discussion during Clint's 90 Minute presentation on his "Out of the Box" experience including a live demonstration on the overhead of what he was presenting.  The following is Clint's Outline that he used.  This is a work in process and will be updated as work continues:

CanaKit Raspberry Pi B+ Ultimate Starter Kit
What's in the box (picture)
Kit Includes:
1 x Raspberry Pi Model B+ (B Plus) 512 MB - Made in UK (Sony Factory)
1 x 8 GB Samsung MicroSD Card - Raspberry Pi Recommended MicroSD Card with the new NOOBS
1 x Raspberry Pi B+ Case
1 x CanaKit 2.5A MicroUSB Power Supply specially designed for the Raspberry Pi B+ (5-foot cable)
1 x Premium Quality HDMI Cable (6-foot)
1 x WiFi Adapter/Dongle (Ralink RT5370 chipset)
1 x Breadboard
1 x GPIO Ribbon Cable
1 x GPIO to Breadboard Interface Board
1 x GPIO Quick Reference Card
2 x Push Button Switches
1 x RGB LED
2 x Red LEDs
2 x Green LEDs
2 x Yellow LEDs
2 x Blue LEDs
10 x 220 Ohm Resistors
5 x 10K Ohm Resistors
1 x CanaKit General Guide for Beginners to Electronic Components

www.canakit/quick-start/pi

Amazon Price:
List Price:     $129.99
Price:            $ 99.99
Sale:             $ 69.95

Setting up

Loading software:
Downloads:
http://www.raspberrypi.org/downloads/

SD Preparation
Unmount all partitions on SD (Usually sdb)

> unmount /dev/sdb1...

df -h (confirm no mounted partitions on USB: /dev/sdb)

Use Parted to Clear the partition table:
> parted /dev/sdb
  mklabel msdos
  yes
  q

Write image out to card:
dd if=wheezy-raspbian.img of=/dev/sdb bs=4M

Configuring Raspian:

configures auto-login to the desktop and advanced features:
> raspi-config

Display configuration:
edit /boot/config.txt (This is mine to enable VGA 1280X1024)
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
overscan_left=16
overscan_right=16

overscan_top=16
overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
# 1280X1024 VGA http://elinux.org/RPiconfig:
hdmi_group=2
hdmi_mode=35

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDM if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

Timezone Settings:
dpkg-reconfigure tzdata

> date
> free
> date --set 2014-12-13
> date --set 05:20:00

Check network time protocol status:
> ntpdate us.pool.ntp.org
> ping 1.debian.pool.ntp.org
> ntpdate -q 1.debian.pool.ntp.org

Bring your Pi up to date:
> sudo -i
> apt-get update
> apt-get upgrade
> apt-get install python-dev
> apt-get install python-rpi.gpio
Also, update the pi firmware:
> wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update  -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update
> rpi-update
> reboot

GPIO Pin Out (General Scheme)
http://pi4j.com/pins/model-b-plus.html

Pin 7    GPIO 04        7
Pin 11  GPIO 17 *     0
Pin 12  GPIO 18 *     1
Pin 13  GPIO 27        2
Pin 15  GPIO 22        3
Pin 16  GPIO 23        4
Pin 18  GPIO 24        5
Pin 22  GPIO 25        6

Serial
Pin 8    TX (out)      15
Pin 10  RX (in)        16

Grounds pin 6, 9, 14, 20
5V   pin 2, 4
3.3V pin 1, 17

There seems to be a bit of disparity between users of the Pi as to how to address the GPIO pins.  Here is a table for the man page for the gpio utility:

WiringPi vs. BCM_GPIO Pin numbering
WiringPi   GPIO-r1   GPIO-r2   P1-Phys   Function
───────────────────────────────────────────────────
    0        17        17        11
    1        18        18        12      (PWM)
    2        21        27        13
    3        22        22        15
    4        23        23        16
    5        24        24        18
    6        25        25        22
    7          4          4         7
    8          0          2         3        I2C: SDA0
    9          1          3         5        I2C: SCL0
   10         8          8        24       SPI: CE0
   11         7          7        26       SPI: CE1
   12       10        10        19       SPI: MOSI
   13         9          9        21       SPI: MISO
   14       11        11        23       SPI: SCLK
   15       14        14          8       TxD
   16       15        16        10       RxD
   17         -        28
   18         -        29
   19         -        30
   20         -        31

Note  that  "r1"  and "r2" above refers to the board revision.
Normally wiringPi detects the correct board revision with use
for it's own numbering scheme, but if you are using a Revision
2 board with some of the pins which change numbers between
revisions you will need to alter your software.

gpiooutput.py:

import RPi.GPIO as GPIO
import time
GPIO.setmode( GPIO.BOARD)
GPIO.setup( 11, GPIO.OUT)
while True:        
  GPIO.output( 11, True)        
  time.sleep( 2)        
  GPIO.output( 11, False)        
  time.sleep( 2)

Another script that I used to test a led breadboard:
(Uses pin 11 but generally referred to GPIO logical pin 17)

gpioledoutput.py:

import RPi.GPIO as GPIO
from time import *
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
led_pin=11
GPIO.setup(led_pin, GPIO.OUT)
while True:
    GPIO.output(led_pin, True)
    sleep(1)
    GPIO.output(led_pin, False)
    sleep(1)


gpioinput.py:
import RPi.GPIO as GPIO
GPIO.setmode( GPIO.BOARD)
GPIO.setup( 12, GPIO.IN)
while True:        
  input_value = GPIO.input( 12)        
  if input_value = = False:                
     print(" The button has been pressed.")                
     while input_value = = False:                        
       input_value = GPIO.input( 12)

wiringpi.com/download-and-install

A great breadboard project complete with code and explanation can be found in issue 144 of Linux User & Developer Raspberry Pi sampler p. 62. This project provides a looping sound machine complete with pushbuttons and leds as well as sound output!  And with the code analysis, you get a good feel for programing in python 2.

A very basic hardward programing project can be found in LinuxFormat issue 181 (March 2014), p. 38 and includes a small python script that you can type in to find out how GPIO works.

Books:
Raspberry Pi User Guide
Wiley Press
ISBN 978-1-118-92166-1
Available on Kindle

One of the limitations of the Raspberry Pi is its I/O (GPIO) features. The chip used by the Pi is a low voltage device and is easily damaged.  The operates at the 3.3 volt level and does not interface easily to 5 volt or higher devices, nor can it sink readily sink current where the voltage exceeds 3.3v.  There are a number of devices available to get around these limitations.  One is a simple level shifter that translates 3.3 to 5 volt logic: http://www.adafruit.com/products/1875 which is based on the Texas Instruments TXB0104 chip, a 4-Bit Bidirectional Voltage-Level Translator with Auto Direction Sensing and +/-15 kV ESD Protection. These are standalone "boards" that would have to be hardwired into your project.  The Pi has 8 pins that are commonly used for I/O so one would need two of these.

Another solution is the PiFace Digital interface that plugs directly piggybacks on the Pi's GPIO socket and provides the following:
* 2 dry changeover relays
* 4 tactile pushbutton switches
* 8 digital inputs
* 8 open collector outputs (current sinking, positive voltate)
* 8 LED indicators

The PiFace software is available on Pi's Raspian operating system. To install:
apt-get install python3-pifacedigitalio python-pifacedigitalio
There is also an emulator you can install and use with Scratch:
apt-get install python3-pifacedigital-emulator python3-pifacedigital-scratch-handler  
Visit http://www.piface.org.uk/guides for more information and Pi projects. The PiFace digital board is available from Newark Element 14 at 27.95.

For advanced users, there is the Gertboard which also plugs directly onto Raspberry Pi GPIO socket and features:
Motor controller, capable controlling a motor bi-directionally, delivering 18V and 2A maximum
* Dual-channel D-to-A converter, 8-bit
* Dual-channel  A-to-D converter, 10-bit
* Onboard Atmel ATmega328 MCU for running off-board programmes which are written, compiled and uploaded to Gertboard from Raspberry Pi
* 6 open collector outputs
* 12 LED indicators
* 3 momentary push switches
Kit includes 10 strap cables and 18 pin jumpers. Software and manuals available for download to operate and learn how to use Gertboard
Price at Newark Element 14 is 39.95

As an electronics engineer in a earlier career, I bought both of these devices and look forward to using them in the future.

There seems to be some interest in making the Pi a "HTPC" (Home Theater PC) which you can connect via the HDMI connection on your TV.  I have spent more than a couple of hours in this effort and found the results less than satisfying and it appears that what is out there for doing this is "beta", somethings works, resolution was poor, and it took multiple attempts at imaging an SD card to get a working HTPC configuration.

At the meeting, a webserver running the Pi was demonstrated and is very easy to setup.

Since the meeting, I have found a number of resources on the net for all kinds of projects based on the Pi.  Just be aware that the Pi is not a high performance system and has been compared to a 300 MHz Pentium, anybody remember having one of them? 

I set up USB "Storage" using the Pi and it took 10 minutes to upload a file compared to 2 minutes using a USB storage drive attached to my router.  Also, invest in powered USB hub as very little power is available for USB devices from the Pi or use a USB drive that has its own power supply.  I tried two USB "pocket" drives and neither of them were recognized by the Pi until I used the powered USB hub to connect them.

Here is a potpourri of links for your Pi Pleasure:

Instructables Raspberry Pi How-To (Extensive)
http://www.instructables.com/howto/raspberry+pi/

http://www.infoworld.com/article/2606860/consumer-electronics/158674-Hero-hacks-14-Raspberry-Pi-projects-primed-for-IT.html

Lifehacker - Australia - Projects
http://www.lifehacker.com.au/tags/raspberry-pi/

Rasberry Pi: Top 15 Projects to try over Christmas
http://www.itpro.co.uk/mobile/21862/raspberry-pi-top-15-projects-to-try-over-christmas

http://www.wikihow.com/Make-a-Raspberry-Pi-Web-Server
(from scratch, includes configuration & updating)

Wordpress Install:
http://www.raspberrypi.org/learning/web-server-wordpress/

http://raspberrywebserver.com/serveradmin/share-your-raspberry-pis-files-and-folders-across-a-network.html

http://raspberrywebserver.com/serveradmin/connect-your-raspberry-pi-to-a-USB-hard-disk.html

RPi Distrobutions
http://elinux.org/RPi_Distributions

http://raspberrywebserver.com/serveradmin/run-a-script-on-start-up.html

http://wiki.openelec.tv/index.php?title=Ssh_commands

Fedora 21 Conversation (Links):

http://www.zdnet.com/article/say-hi-to-linuxs-future-fedora-21-is-here/
http://www.hecticgeek.com/2014/12/fedora-21-review/
http://www.pcworld.com/article/2842555/how-fedora-21-is-splitting-itself-inself-in-thirds-to-prepare-for-the-next-10-years.html

Fedy (Fedora Utils) - post installation, installs and tweaks for everything that Fedora didn't do including multi-media support. http://sourceforge.net/projects/fedorautils/