OS Installation
RPi has no hard drive. It boots OS from an SD card. The steps to prepare bootable card are:
- Download Raspbian Debian Wheezy
- Extract the OS image from the ZIP file
- Download Win32 Disk Imager and install it.
- Insert an SD card (minimum 4Gb)
- Run the Win32 Disk Imager, browse for the OS image file, select the disk drive of the SD card, and click Write button.
The SD card should be ready to boot. Safely Eject it from your computer and insert into RPi.
The First Boot
A configuration utility runs automaticllay on the first boot. Do the following:
- Expand root partition to fill SD card
- Select keyboard layout
- Select locale
- Enable SSH
- Finish, reboot.
Using SSH to control RPi from Windows computer
- Download and install either MobaXterm or both PuTTY and WinSCP
- Download and unzip sshScan
- Connect RPi with Ethernet cable to your computer or a hub. Note that three more LEDs must be on - a yellow and two green ones.
- Run the sshScan utility. Select the network adapter RPi is connected to - it usually has 'Ethernet' in its name:
- Note the IP address. If you have other computers connected to the same hub, you will see their addresses too.
- Run MobaXterm (or PuTTY). Create a new SSH session. Specify the found IP (192.168.0.170 in my case), the user name is pi and the password is raspberry.
- Make sure your computer allows RPi to access Internet.
Pure Data
sudo apt-get install python-software-properties
sudo add-apt-repository "deb http://apt.puredata.info/releases `lsb_release -c | awk '{print $2}'` main"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 9f0fe587374bbe81
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key D63D3D09C39F5EEB
sudo apt-get update
sudo apt-get install pd-extended
OpenFrameworks
This part may take an hour or two.
In the RPi, execute:
- sudo apt-get clean
- sudo apt-get update
- sudo apt-get upgrade
- cd
- curl -O http://www.openframeworks.cc/versions/v0.8.1/of_v0.8.1_linuxarmv6l_release.tar.gz
- mkdir openFrameworks
- tar vxfz of_v0.8.1_linuxarmv6l_release.tar.gz -C openFrameworks --strip-components 1
- cd /home/pi/openFrameworks/scripts/linux/debian_armv6l
- sudo ./install_dependencies.sh
- sed -i 's/VC_IMAGE_TRANSFORM_T/DISPMANX_TRANSFORM_T/g' /home/pi/openFrameworks/libs/openFrameworks/app/ofAppEGLWindow.cpp
- make Release -C /home/pi/openFrameworks/libs/openFrameworksCompiled/project
Now OF can be used to compile your sources in RPi.
Compilation errors
1) In file included from src/Controller.h:6:0,
from src/TabMenu.cpp:2:
../../../addons/ofxIniSettings/src/ofxIniSettings.h:17:19: fatal error: conio.h: No such file or directory
This line was commented out: ofxIniSettings.h:17.
In addition. _getch() was commented out in ofxIniSettings.cpp:64
2) <glut.h> is not found.
OF applications
In order to get an OF application running on another Raspberry Pi (without OF), install missing dependencies with the folowing command (one long line):
sudo apt-get install libmpg123-dev alsa-base alsa-tools alsa-utils libupnp-dev automake cvs libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libasound2-dev libxmu-dev libxxf86vm-dev g++ libgl1-mesa-dev libglu1-mesa-dev libraw1394-dev libudev-dev libdrm-dev libglew-dev libopenal-dev libsndfile-dev libfreeimage-dev libcairo2-dev libgtk2.0-dev python-lxml python-argparse libfreetype6-dev libassimp-dev portaudio19-dev libssl-dev libpulse-dev libgtk2.0-dev
or download the script:
install_of_libs.sh , make it executable:
chmod a+x install_of_libs.sh
and run:
./install_of_libs.sh
Python
$ sudo easy_install-pypy pip
Auto login
Edit the file
sudo nano /etc/inittab
and comment out the tty1 line and replace it with
1:2345:respawn:/bin/login -f pi tty1 /dev/tty1 2>&1
Preventing the screen from going blank
The screen might go to sleep after some time as your Pi does not detect any activity. To prevent that, edit the rc.local file
sudo nano /etc/rc.local
Add the following line just before the exit 0 line:
sh -c 'setterm -blank 0 -powersave off -powerdown 0 < /dev/console > /dev/console 2>&1'
Save the file and exit. Reboot your Pi:
sudo reboot.
Startup scripts
Starting a program on boot
In /home/pi create an executable shell script called startup.sh:
touch startup.sh
chmod a+x startup.sh
Then open .bashrc
sudo nano ~/.bashrc
and add the following line at the end of the file:
~/startup.sh
Save the file and exit.
Edit the startup.sh file to distinguish between direct login and SSH access. Open the file in text editor:
sudo nano ~/startup.sh
Replace the contents of the file with the following:
#!/bin/bash
echo "Checking SSH connection...";
if [ -z "$SSH_CONNECTION" ]; then
echo "No SSH connection, launching scripts.";
# Your scripts here
else
echo "SSH connection, nothing to be launched.";
fi
Force USB1.1 mode to get external sound card working
The RPi has a USB2.0 controller that apparently can cause issues with USB1.1 audio interfaces. The solution is to force the controller to use USB1.1 mode. You can do this by adding the following kernel parameter to your /boot/cmdline.txt file on your RPi:
dwc_otg.speed=1
NB: my USB keyboard doesn't work with this setting.
WiFi USB adapter
Follow the
instructions:
$ uname -a
Linux victorpi 3.10.25+ ....
The version needs 8188eu-20131219.tar.gz
Execute:
$ wget https://dl.dropboxusercontent.com/u/80256631/8188eu-20131219.tar.gz
$ tar -xzf 8188eu-20131219.tar.gz
$ sudo install -p -m 644 8188eu.ko /lib/modules/$(uname -r)/kernel/drivers/net/wireless
$ sudo insmod /lib/modules/$(uname -r)/kernel/drivers/net/wireless/8188eu.ko
$ sudo depmod -a
There is also a script that can do this (not tested, though):
install-8188eu.tgz
From
this page
Edit the file /etc/wpa_supplicant/wpa_supplicant.conf and add the network={.....} section.
network={
ssid="Your-Network-Name"
psk="Your-Network-Password"
}
Restart RPi without ethernet cable connected.
WiFi Access Point
From
this page and
this page
$ sudo apt-get install hostapd udhcpd
Edit the /etc/default/udhcpd with sudo and comment out the line:
DHCPD_ENABLED="no"
Edit the configuration:
$ sudo nano /etc/udhcpd.conf
Change
interface from eth0 to wlan0
Uncomment the
remaining yes line
Change IP addresses to belong to 192.168.42.x
start 192.168.42.20 #default: 192.168.0.20
end 192.168.42.254 #default: 192.168.0.254
...
opt router 192.168.42.1
opt dns 192.168.42.1 192.168.10.10
Edit new file and add the following content to make open - that is not secure - access point
$ sudo nano /etc/hostapd/hostapd.conf
interface=wlan0
ssid=RasPiAP
hw_mode=g
channel=1
auth_algs=1
wmm_enabled=1
driver=rtl871xdrv
ctrl_interface=wlan0
ctrl_interface_group=0
ignore_broadcast_ssid=0
Edit the file /etc/default/hostapd and change the line:
#DAEMON_CONF=""
to:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Edit the /etc/network/interfaces.
Comment out these lines
#allow-hotplug wlan0
#iface wlan0 inet manual
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
and add these
iface wlan0 inet static
address 192.168.42.1
netmask 255.255.255.0
Replace the /usr/sbin/hostapd with the one compiled from Realtek driver sources
hostapd.zip
Make the file executable
$ sudo chmod a+x /usr/sbin/hostapd
Automatic service start at boot
$ sudo update-rc.d hostapd enable
$ sudo update-rc.d udhcpd enable
Start the services
$ sudo /etc/init.d/hostapd start
$ sudo /etc/init.d/udhcpd start
Restart RPi without ethernet cable connected.
Further reading
Avahi
Made for you
by
Victor X
Thanks to
CC4AV Team