Raspberry Pi Setup

 

I ordered a Raspberry Pi (Model B Rev 2) back in March and it finally arrived in November.  Since, I’ve been exploring the capabilities of this $35 computer-on-a-chip.  For its price and size it packs a very formidable punch.  From the raspberrypi.org FAQ:

… graphics capabilities are roughly equivalent to Xbox 1 level of performance. Overall real world performance is something like a 300MHz Pentium 2, only with much, much swankier graphics.

Turn it into a arcade game console, a media center,  a portable music player, pair it with an Arduino, or simply use it as a computer for word processing and internet browsing, the possibilities are endless.

Up and Running

I found the Adafruit tutorials to be helpful for getting started.  First off, setting up the SD card and the initial config…

1. Tutorial to setup SD card

2. Tutorial to do rasp-config

In addition, also change_locale as US – UTF8 – UTF8
and configure_keyboard to make it American layout

Now at this point the Pi started inexplicably crashing after 5-10 minutes of being on. Looking online, I was disappointed to learn that some others experienced this and the unit could be from a faulty batch.  The next day I decided to give it another shot, this time removing the Pi from this case purchased from RS Online.  That seemed to fix the issue and I have had no crashes since!  It appears the case was causing the Pi to overheat and crash.  Since I’ve discarded the case, I’ve been able to run the Pi without fail for days at a time.

 raspi in case    raspi no case

“Headless” mode

There are a couple ways to control your Pi remotely and free up the monitor and keyboard it is connected to.  

a) SSH access using Putty is possible by default.  The only setting needed is the Host Name for which you can use the Raspberry Pi’s IP address or “raspberrypi”.  Once prompted for login/password, use “pi”/”raspberry”.

b) VNC into an X11 session using these instructions.

Note that if you configured to launch X11 on startup, these instructions need a slight modification – use :1 instead of :0

Git installation and Dropbox integration

Dropbox Uploader is a great tool written in bash which makes it easy to automate reading from and writing to Dropbox. 

a) Install Git using the command: sudo apt-get install git-core

b) To install Dropbox Uploader script

cd /usr/local/bin 
sudo git clone https://github.com/andreafabrizi/Dropbox-Uploader.git dropbox

c) optional: delete everything except the file dropbox_uploader.sh

d) run dropbox_uploader.sh and follow instructions

Now you can call dropbox_uploader.sh from anywhere.

Setup WiFi

To set up a WiFi USB Adapter, modify file /etc/wpa_supplicant/wpa_supplicant.conf by appending this after update_config=1

network={
  ssid="YOUR_SSID"
  scan_ssid=1
  psk="YOUR_PASSPHRASE"
  proto=RSN
  key_mgmt=WPA-PSK
  pairwise=CCMP
  auth_alg=OPEN
}

Key:

ssid: your wifi name
scan_ssid: value of 1 means broadcast and value of 2 means hidden (suggest value of 1)
psk: your wifi password
proto: your choice of RSN or WPA. RSN is WP2 and WPA is WPA1. (most config is RSN)
key_mgmt: your choice of WPA-PSK or WPA-EAP (pre-shared or enterprise respectively)
pairwise: your choice of CCMP or TKIP ( WPA2 or WPA1 respectively)
auth_alg: OPEN option is required for WPA and WPA2 (other option, SHARED & LEAP)

Keeping the Screen On

When in X Windows, the screen goes blank after 10 min and needs to be “woken”.  There are many suggestions in the forums but most failed to keep my Raspi awake.  This solution which is a sort of attack on all fronts finally worked out.  Here’s an excerpt: 

Approach 1

On Pi 1 I don’t want screensaver – but don’t want to autorun x. When I start up x I do it manually and it references /home/pi/.xinitrc so managed to stop the screensaver on there by using information from http://raspberrypi.stackexchange.com/qu … oing-blank

apt-get install x11-xserver-utils

Now open up your ~/.xinitrc file (if you don’t have one then create it) and enter this:

xset s off # don’t activate screensaver
xset -dpms # disable DPMS (Energy Star) features.
xset s noblank # don’t blank the video device

Approach 2

On Pi 2 I have it auto-logging in and auto-starting to x using the raspi-config script use of lightdm. This seems to ignore /home/pi/.xinitrc

For this I used belt and braces.
The Belt:

Edit /etc/lightdm/lightdm.conf

[SeatDefaults]
xserver-command=X -s 0 -dpms

The Braces:

Step 1. Do as per Approach 1

Step 2. Run the .xinitrc as an autostart script

cd ~/.config
mkdir autostart
cd autostart
vi screensaver.desktop 

press “i” to insert, paste the following lines, then press the esc button and then “:wq” to save:

[Desktop Entry]
Type=Application
Exec=/home/pi/.xinitrc

 

2 comments

  1. Pingback: Raspberry Pi + Arduino + Tornado
  2. Pingback: Raspberry Pi Time Lapse via node | Jamie Gilmartin

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>