Zero to IPA, sw (kickstart)

Peter Marton edited this page Mar 23, 2014 · 9 revisions

When you sit in a tube with full of shit, please just read this and use a double of hops. It will make your day, I promise.

Please update this documentation after every install.

01 - Format the SD card

With formatter:

https://www.sdcard.org/downloads/formatter_4/

https://www.sdcard.org/downloads/formatter_4/eula_mac/

It doesn't require any information but if you have to select the format please use the FAT (MS-DOS).


With the OSX disk utility:

OSX Disk Utility is also capable of formatting the entire disk (select the SD card volume and choose "Erase" with "MS-DOS" format)

02 - Download the OS

http://www.raspberrypi.org/downloads

Last time we used the NOOBS (v1.3.4) https://github.com/raspberrypi/noobs/blob/master/README.md

03 - Copy the OS to the card

Yes, you can use cp.

cp -r ~/Downloads/NOOBS_v1_3_4/* /Volumes/UNTITLED

04 - Install OS

You have to connect your PI to a display, because it is needed to select which OS do you want to install.

The installation require ~40 minutes.

(May you can choose the automatic installation. In this case you have to modify the config files. We didn't have time to test it.)

05 - Connect to the PI

Connect directly to the router

ssh pi@ip.of.the.rpi (pass: raspberry)

OSX via ethernet:

Plug in the ethernet cable and share your internet connection.

ssh pi@192.168.2.2 (pass: raspberry)

Internet sharing:

http://blog.angryturtle.com/2013/02/setting-up-raspberry-pi-for-osx.html

06 - Install softwares

Upate your apt

sudo apt-get update
sudo apt-get upgrade

GIT

sudo apt-get install git-core

WiringPI

This can handle the DS18B20 digital temperature hw device. It will provide a cat style reading.

http://wiringpi.com/download-and-install/

git clone git://git.drogon.net/wiringPi
cd wiringPi
./build

Example: After the installation you can read the temperature from your DS18B20 device.

# init the devices
sudo modprobe w1-gpio
sudo modprobe w1-therm

# you should see your devices (ex. 28-0000048f07fd  w1_bus_master1)
ls /sys/bus/w1/devices
 
# and read it the result should looks similar like this:
# 56 01 4b 46 7f ff 0a 10 d1 : crc=d1 YES
# 56 01 4b 46 7f ff 0a 10 d1 t=21375
cat 28-0000048f07fd/w1_slave

pi-blaster

This will provide the PWM functionality on your Pins for the https://github.com/sarfata/pi-blaster.js/ npm lib.

https://github.com/sarfata/pi-blaster/

git clone https://github.com/sarfata/pi-blaster.git
cd pi-blaster
sudo make install

After the installation you should see the actual state of the pins.


NodeJS

It's tricky because you can use the sudo apt-get install nodejs but it will install a v0.6 node which is non supported by the most of the actual npm libs.

So you have to find an another way to get a newer version. compile you own node (it will take ~2 hours) use a precompiled version

install precompiled node

http://blog.rueedlinger.ch/2013/03/raspberry-pi-and-nodejs-basic-setup/

sudo mkdir /opt/node

wget http://nodejs.org/dist/v0.10.2/node-v0.10.2-linux-arm-pi.tar.gz
tar xvzf node-v0.10.2-linux-arm-pi.tar.gz
sudo cp -r node-v0.10.2-linux-arm-pi/* /opt/node
 
nano /etc/profile

 
# extend profile with this
...
NODE_JS_HOME="/opt/node"
PATH="$PATH:$NODE_JS_HOME/bin"
export PATH
 
# you have to logout-in to get your node
logout

07 - WiFi

We have a TP-Link TL-WN725 v2.

http://blog.pi3g.com/2013/10/easy-tp-link-tl-wn725-driver-installation/

// TO DO

# add third party repo to the apt-get
deb http://repository.pi3g.com/debian/ wheezy main
sudo wget -O /etc/apt/sources.list.d/repository.pi3g.com.list http://repository.pi3g.com/sources.list
wget -O - http://repository.pi3g.com/pubkey | sudo apt-key add -
 
# install driver
sudo apt-get install rtl8188eu
 
# load the driver
sudo modprobe 8188eu

09 - Install our stuff

Install the brewing software.

git clone git@github.com:brewfactory/brewfactoryorg.git
cd brewpi
npm install --production

 
# you have to copy your bower files into app/components or
npm install
bower install

Run the code

NODE_ENV=production node app

10 - upstart scripts

PI have to run some initialization scripts after boot. Like start the brewing software.

PM2

// TO DO: r&d with PM2

https://github.com/Unitech/pm2


Forever

ADD:

chmod 755 /etc/init.d/nodeup
update-rc.d nodeup defaults

REMOVE:

update-rc.d -f nodeup remove

Content of the /etc/init.d/nodeup:

#!/bin/sh
#/etc/init.d/nodeup
export PATH=$PATH:/usr/local/bin
case "$1" in
  start)
  sudo -u pi NODE_ENV=production forever start --sourceDir=/home/pi/Desktop/pwm/ -p /home/pi/Desktop/pwm_logs app.js
  ;;
stop)
  sudo -u pi forever stop /home/pi/Desktop/pwm/app.js
  ;;
*)
  echo "Usage: /etc/init.d/nodeup {start|stop}"
  exit 1
  ;;
esac
exit 0
  • Emergency

When it wasn't started automatically.

Emergency start:

Init temperature device

sudo modprobe w1-gpio
sudo modprobe w1-therm

Start the SW

NODE_ENV=production forever start ~/brewpi/app.js
Emergency stop
forever stop 0
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.