Starting to write down a few tips for Raspberry Pi
Hardware
To sort out what model of Pi you have, look into /proc/cpuinfo:'0002' => 'Model B Revision 1.0', '0003' => 'Model B Revision 1.0 + Fuses mod and D14 removed', '0004' => 'Model B Revision 2.0 256MB', (Sony) '0005' => 'Model B Revision 2.0 256MB', (Qisda) '0006' => 'Model B Revision 2.0 256MB', (Egoman) '0007' => 'Model A Revision 2.0 256MB', (Egoman) '0008' => 'Model A Revision 2.0 256MB', (Sony) '0009' => 'Model A Revision 2.0 256MB', (Qisda) '000d' => 'Model B Revision 2.0 512MB', (Egoman) '000e' => 'Model B Revision 2.0 512MB', (Sony) '000f' => 'Model B Revision 2.0 512MB', (Qisda)
Install the OS
I used NOOBS: download, and selected OS Raspbian. In /etc/apt/sources.list, I use a Raspbian mirror:# debian mirror in France deb https://goddess-gate.com/archive.raspbian.org/raspbian/ wheezy main contrib non-free
Firmware
To update the Raspberry Pi Firmware:rpi-update
USB devices
Sometimes, you need to prevent the USB HID from claiming a given USB device. In that case, put in /boot/cmdline.txt:usbhid.quirks=0x0fde:0xca01:0x4
Set timezone
raspi-config
Backup
Locate the sdcard: cat /etc/fstab:proc /proc proc defaults 0 0 /dev/mmcblk0p5 /boot vfat defaults 0 2 /dev/mmcblk0p6 / ext4 defaults,noatime 0 1To backup the SDcard,
sudo dd if=/dev/mmcblk0p6 of=remote/raspberrypislash.img bs=1M
Audio
/etc/pulse/daemon.conf:;resample-method = speex-fixed-3/etc/asound.conf:
pcm.!default { type hw card 0 } ctl.!default { type hw card 0 } pcm.mmap0 { type mmap_emul; slave { pcm "hw:0,0"; } } pcm.!default { type plug; slave { pcm mmap0; }To set analogical audio output:
sudo amixer cset numid=3 1Test audio in : /opt/vc/hello_pi/hello_audio To set HDMI audio output:
sudo amixer cset numid=3 2The standard VLC package (apt-get) did not work, and had to be re-compiled:
- Compiling VLC with HW acceleration on Raspberry
- or Tutorial: VLC with hardware acceleration on Raspberry Pi
cvlc --vout omxil_vout
GPIO
GPIO filesystem files
To export a GPIO:echo 22 > /sys/class/gpio/exportTo configure the direction of a GPIO:
sudo sh -c 'echo out > /sys/class/gpio/gpio27/direction'So, for example, if you need GPIO 17, 22, 23 and 27:
for i in 17 22 23 27 do echo $i > /sys/class/gpio/export echo out > /sys/class/gpio/gpio$i/direction doneTo enable use of GPIO for the GPIO group:
SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c 'chown -R root:gpio /sys/class/gpio; chmod -R 770 /sys/class/gpio; chown -R root:gpio /sys/devices/virtual/gpio; chmod -R 770 /sys/devices/virtual/gpio'"
GPIO Python library
Installing python GPIO lib (Check for for the latest version):$ wget https://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.11.tar.gz $ tar zxf RPi.GPIO-0.5.11.tar.gz $ cd RPi.GPIO-0.5.11/ $ sudo python setup.py install
Limiting writes on the SDCard
In theory, the number of writes on a SD card is bounded, and if you write too much, it will eventually fail. This is certainly true with old and/or low quality SD cards, I am however unable to say if this is still true with today's SD cards.Yet, if you want to be sure, it might be a good idea not to write "everything" on your SD card, in particularly some logs or temporary files: a tmpfs is a far nicer and simple solution.
To do this, just specify the mountpoint for the tmp filesystem. For instance, my /etc/fstab mounts /tmp and /var/tmp as 2 tmpfs. The size is specified (and taken on the RAM).
proc /proc proc defaults 0 0 /dev/mmcblk0p5 /boot vfat defaults 0 2 /dev/mmcblk0p6 / ext4 defaults,noatime 0 1 /dev/sda1 /media/usbstick vfat uid=xbmc,gid=staff,dmask=002 0 2 tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 00 tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=30m 00There are some other tweaks on this website