Devices I have working RPi B+, RPi 2/3 B, All 4 camera models, Several wifi sticks that all seem to work in AP mode also. 


Starting with Jessie Lite

Since Jessie lite is a minimal install - you will probably need to install most of the tools you would like to use in the future. 

$sudo apt-get update
$sudo apt-get upgrade

RPi Cloning


A backup of the master file that was working for me as of 2015-11-01 is archived below. 

$ sudo apt-get install git
$ git clone https://github.com/billw2/rpi-clone.git
$ cd rpi-clone/
$ ls
$ sudo cp rpi-clone /usr/local/sbin

 Check for the USB mounted device 

 pi@pi2pic ~ $ dmesg
[  559.101351] usb 1-1.3: new high-speed USB device number 5 using dwc_otg
[  559.206110] usb 1-1.3: New USB device found, idVendor=0781, idProduct=a7c1
[  559.206139] usb 1-1.3: New USB device strings: Mfr=3, Product=4, SerialNumber=2
[  559.206156] usb 1-1.3: Product: SDDR-113
[  559.206172] usb 1-1.3: Manufacturer: SanDisk
[  559.206188] usb 1-1.3: SerialNumber: xxxxxxxxxxx
[  559.209702] usb-storage 1-1.3:1.0: USB Mass Storage device detected
[  559.218695] scsi host0: usb-storage 1-1.3:1.0
[  560.213054] scsi 0:0:0:0: Direct-Access     SanDisk  SDDR-113         9412 PQ: 0 ANSI: 0
[  560.229213] sd 0:0:0:0: Attached scsi generic sg0 type 0
[  560.368191] sd 0:0:0:0: [sda] 15523840 512-byte logical blocks: (7.94 GB/7.40 GiB)
[  560.369044] sd 0:0:0:0: [sda] Write Protect is off
[  560.369062] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
[  560.369897] sd 0:0:0:0: [sda] No Caching mode page found
[  560.369913] sd 0:0:0:0: [sda] Assuming drive cache: write through
[  560.381224]  sda: sda1 sda2
[  560.384973] sd 0:0:0:0: [sda] Attached SCSI removable disk

Run the clone 

pi@pi2pic ~ $ sudo rpi-clone sda -f -v

Forcing a partition initialization of destination disk sda
The existing destination disk 'sda' partitions are:
Disk /dev/sda: 7948MB
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      4.19MB  62.9MB  58.7MB  primary  fat16        lba
 2      62.9MB  7948MB  7885MB  primary  ext4

*** All data on destination disk sda will be overwritten! ***

Do you want to initialize the destination disk /dev/sda? (yes/no): yes

Imaging the partition structure, copying 70 megabytes...
70+0 records in
70+0 records out
73400320 bytes (73 MB) copied, 10.5617 s, 6.9 MB/s
Running fsck on /dev/sda1...
Sizing partition 2 (root partition) to use all SD card space...
Re-reading the partition table failed.: Device or resource busy
mke2fs 1.42.12 (29-Aug-2014)

/dev/sda is initialized and resized.  Its partitions are:
Disk /dev/sda: 7948MB
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      4.19MB  62.9MB  58.7MB  primary  fat16        lba
 2      62.9MB  7948MB  7885MB  primary  ext4

Your booted /dev/mmcblk0p2 rootfs existing label: RJ-16a
You may enter a label for the destination rootfs /dev/sda2: SD-8a

======== Clone Summary ========
Clone mode               :  rsync all files to sda root file system
Clone destination disk   :  sda
Clone destination rootfs :  /dev/sda2 (SD-8a) on /mnt/clone
Clone destination bootfs :  /dev/sda1 on /mnt/clone/boot
Verbose mode             :  on
Final check, is it Ok to proceed with the clone (yes/no)?: yes
=> Mounting /dev/sda2 (SD-8a) on /mnt/clone
=> Mounting /dev/sda1 on /mnt/clone/boot
Starting the filesystem rsync to sda
(This may take several minutes)...sending incremental file list


sent 1,837,429,052 bytes  received 1,247,082 bytes  5,496,789.64 bytes/sec
total size is 1,852,580,451  speedup is 1.01

*** Done with clone to /dev/sda ***
    Started: 04:09:37    Finished: 04:15:13

Hit Enter when ready to unmount the /dev/sda partitions...unmounting /mnt/clone/boot
unmounting /mnt/clone

This is now an exact file copy of your source PI ... 

Things you might want to change before testing the SD card.

- hostname
- static IP assignment
- mac address if you are manipulating it for any reason.
pi@pi2pic /mnt/clone/boot$ cat cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait smsc95xx.macaddr=XX:XX:XX:XX:XX:XX

Pro's with using rpi-clone

  1. Clone a running PI - careful with changing files, no issues with headless devices found. Did not try anything else. 
  2. Clone to any size card that has enough capacity for the entire running system. (nice for making smaller image files)
  3. Clone to USB stick and then run your from the USB stick with only the boot happening on the SD card.
  4. Quick backup - Typically less than 6 minutes. For a clean Jessie clone. 


 sudo wget -P /var/www http://dygraphs.com/dygraph-combined.js

Disable the HDMI 

This could save you some power. 
sudo /usr/bin/tvservice -o

On Jessie lite with a RPi2 and only a Lan cable it would draw .25A @  4.99V with hdmi on. When off it drops to .23A @5.00V, not these are not the most accurate measurements - in line USB Charger Doctor, but a decrease in power consumption seems true. 

Installing VNC Beta on RPi

curl -OL https://github.com/RealVNC/raspi-preview/releases/download/
sudo dpkg -i VNC-Server-5.3.1-raspi-alpha1.deb

sudo systemctl enable vncserver-x11-serviced.service
as pi ..  vncpasswd -virtual

On the client expert tab set: PreferredEncoding to JPEG, AutoSelect to False, and ColorLevel to Full.

Or alternatively as of October 2016 - use the distributed version. 

Update your config.txt 

.h264 convert to mp4 

sudo apt-get install gpac
MP4Box -add filename.h264 filename.mp4

RPi on an external USB device

Inset USB stick ... check dmesg
[ 3091.279634] usb 1-1.4: new high-speed USB device number 9 using dwc_otg
[ 3091.381313] usb 1-1.4: New USB device found, idVendor=0781, idProduct=5567
[ 3091.381341] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3091.381358] usb 1-1.4: Product: Cruzer Blade
[ 3091.381375] usb 1-1.4: Manufacturer: SanDisk
[ 3091.381392] usb 1-1.4: SerialNumber: xxxxxxxx
[ 3091.382515] usb-storage 1-1.4:1.0: USB Mass Storage device detected
[ 3091.382978] scsi host4: usb-storage 1-1.4:1.0
[ 3092.380971] scsi 4:0:0:0: Direct-Access SanDisk Cruzer Blade 1.00 PQ: 0 ANSI: 6
[ 3092.382134] sd 4:0:0:0: Attached scsi generic sg0 type 0
[ 3092.383444] sd 4:0:0:0: [sda] 15630336 512-byte logical blocks: (8.00 GB/7.45 GiB)
[ 3092.384511] sd 4:0:0:0: [sda] Write Protect is off
[ 3092.384540] sd 4:0:0:0: [sda] Mode Sense: 43 00 00 00
[ 3092.385130] sd 4:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 3092.401047] sda: sda1
[ 3092.404946] sd 4:0:0:0: [sda] Attached SCSI removable disk

Run rpi-clone $ sudo rpi-clone sda -f -v

on the SD card 

Edit the cmdline.txt on /boot (make a copy before editing) 

on the SD card 
change root=/dev/mmcblk0p2 to root=/dev/sda2

$sudo reboot

After the reboot - check your mount 

pi@pi2pic ~ $ mount
/dev/sda2 on / type ext4 (rw,noatime,data=ordered)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)

remember that your OS is now running on the USB device. Changes are not synced back the the SD card. 

Pro's when running off a USB stick

  1. Faster
  2. Could be more reliable
  3. Use it as a cloning source (image written via PC not rpi-clone

Rudimentary IO speed test

Most tests need to be done a few time to get some sort of avg. 

Or you can just go and read an article that I found after doing my tests ;-) 


direct read

pi@pi2pic ~ $ sudo hdparm -t /dev/sda2
 Timing buffered disk reads: 106 MB in  3.03 seconds =  34.95 MB/sec
pi@pi2pic ~ $ sudo hdparm -t /dev/sda2
 Timing buffered disk reads:  94 MB in  3.04 seconds =  30.97 MB/sec
pi@pi2pic ~ $ sudo hdparm -t /dev/sda2
 Timing buffered disk reads:  94 MB in  3.00 seconds =  31.29 MB/sec
pi@pi2pic ~ $ sudo hdparm -t /dev/sda2
 Timing buffered disk reads:  94 MB in  3.01 seconds =  31.28 MB/sec

 cached read 

 Timing cached reads:   888 MB in  2.00 seconds = 444.07 MB/sec
pi@pi2pic ~ $ sudo hdparm -T /dev/sda2
 Timing cached reads:   878 MB in  2.00 seconds = 438.78 MB/sec
pi@pi2pic ~ $ sudo hdparm -T /dev/sda2
 Timing cached reads:   872 MB in  2.00 seconds = 436.11 MB/sec
pi@pi2pic ~ $

dd test 

pi@pi2pic ~ $ time sh -c "dd if=/dev/zero of=ddfile bs=8k count=250 && sync"; rm ddfile
250+0 records in
250+0 records out
2048000 bytes (2.0 MB) copied, 0.0170158 s, 120 MB/s

real    0m0.180s
user    0m0.000s
sys     0m0.020s

pi@pi2pic ~ $ time sh -c "dd if=/dev/zero of=ddfile bs=8k count=2500 && sync"; rm ddfile
2500+0 records in
2500+0 records out
20480000 bytes (20 MB) copied, 0.188266 s, 109 MB/s

real    0m2.304s
user    0m0.000s
sys     0m0.200

pi@pi2pic ~ $ time sh -c "dd if=/dev/zero of=ddfile bs=8k count=25000 && sync"; rm ddfile
25000+0 records in
25000+0 records out
204800000 bytes (205 MB) copied, 7.27474 s, 28.2 MB/s

real    0m42.821s
user    0m0.060s
sys     0m1.550s

Track my PI Domoticz 

add a crontab -e entry 

@reboot /home/pi/startup/runme.sh

run the script to update info to domoticz.
sleep 60
hostip=`hostname -I`
dfhost=`df -h / | grep -v ^File`
life="$host $hostip $dfhost"

test=`curl -G "http://domoticz:8080/json.htm?type=command&param=udevice&idx=IDX&nvalue=0" --data-urlencode "svalue=$life"`

echo $test

This works as the normal pi user. 

Conky on vncserver start.

In headless mode

Running stuff on autostart openbox needs to be started as a session

echo 'openbox-session' > /etc/vnc/xstartup

and the apps you want to load on autostart

pi@RPIbLUE:~ $ cat .config/openbox/autostart
lxpanel --profile LXDE-pi &
pcmanfm --desktop --profile LXDE &
conky -p 10 &

My conky below
pi@RPIbLUE:~ $ cat .conkyrc
# Conky, a system monitor, based on torsmo
# Any original torsmo code is licensed under the BSD license

alignment bottom_left
background yes
use_xft yes
xftfont DejaVu Sans Mono:size=9
xftalpha 1
own_window yes
own_window_type normal
own_window_transparent no
own_window_hints undecorated below sticky skip_taskbar skip_pager
update_interval 3.0
double_buffer yes
gap_x 15
gap_y 28
maximum_width 500
minimum_size 200 550
default_color white
default_outline_color white
default_shade_color black

total_run_times 0
use_spacer left

#${scroll 32 $nodename – $sysname $kernel on $machine | }
$sysname $kernel on $machine
#${color lightgrey}$hr
${color lightblue} Local:$color ${time %x %X}
#${color lightblue} UTC:$color $utime
${color lightblue}Uptime:$color $uptime
#${color lightblue}Frequency (in GHz):$color $freq_g
#${color lightgrey}$hr
${color lightblue}RAM Usage:
$color $mem/$memmax – $memperc% ${membar 4}
${color lightblue}Swap Usage:
$color $swap/$swapmax – $swapperc% ${swapbar 4}
#${color lightgrey}$hr
Usage (Avg): ${freq_g}Ghz ${cpu cpu0}% ${alignr}${cpubar cpu0 5,80} ${exec /opt/vc/bin/vcgencmd measure_temp}
${color lightblue} CPU: $color${cpu cpu1}% ${cpu cpu3}% ${cpu cpu2}% ${cpu cpu4}%
${color lightblue}Processes:$color $processes ${color lightblue}Running:$color $running_processes
#${color lightgrey}$hr
${color lightblue}File systems:
/ $color${fs_used /}/${fs_size /} ${fs_bar 6 /}
${color lightgrey}$hr
${color lightblue}Networking:
${color lightblue}IP address: $color${addr eth0}${color lightblue}
eth0 Up:$color${upspeed eth0}${color lightblue}/ Down:$color${downspeed eth0}
#${color lightgrey}$hr
${color lightblue}SSID: $color${wireless_essid wlan0}
${color lightblue}Signal: $color${wireless_bitrate wlan0} – ${wireless_link_qual wlan0}%
${color lightblue}IP address: $color${addr wlan0}${color lightblue}
wlan0 Up:$color${upspeed wlan0}${color lightblue}/ Down:$color${downspeed wlan0}
${color lightgrey}$hr
${color lightblue}Name PID CPU% MEM%
${color lightgreen} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgreen} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgreen} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgreen} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}


See http://rpi-experiences.blogspot.fr/ for the latests details. 

$sudo apt-get install apt-transport-https ca-certificates
$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 2C0D3C0F
$ sudo wget http://goo.gl/rsel0F -O /etc/apt/sources.list.d/rpimonitor.list
$ sudo apt-get install rpimonitor
$ sudo /usr/share/rpimonitor/scripts/updatePackagesStatus.pl

Comparing IO results 

Test rig: Jessie Rpi2 - no over clocking patch to the max 
Linux pi2pic 4.1.7-v7+ #817 SMP PREEMPT Sat Sep 19 15:32:00 BST 2015 armv7l GNU/Linux
To reduce the chance of USB congestion networking will be done via eth01 not USB Wifi

External USB card reader 


USB dmesg 

 [ 2424.565390] usb 1-1.4: new high-speed USB device number 6 using dwc_otg
[ 2424.670067] usb 1-1.4: New USB device found, idVendor=0781, idProduct=a7c1
[ 2424.670097] usb 1-1.4: New USB device strings: Mfr=3, Product=4, SerialNumber=2
[ 2424.670114] usb 1-1.4: Product: SDDR-113
[ 2424.670130] usb 1-1.4: Manufacturer: SanDisk
[ 2424.670146] usb 1-1.4: SerialNumber: XXXXXXXXXXXXX
[ 2424.671611] usb-storage 1-1.4:1.0: USB Mass Storage device detected
[ 2424.672261] scsi host1: usb-storage 1-1.4:1.0
[ 2425.667134] scsi 1:0:0:0: Direct-Access     SanDisk  SDDR-113         9412 PQ: 0 ANSI: 0
[ 2425.668380] sd 1:0:0:0: Attached scsi generic sg0 type 0
[ 2425.835395] sd 1:0:0:0: [sda] 15523840 512-byte logical blocks: (7.94 GB/7.40 GiB)
[ 2425.836264] sd 1:0:0:0: [sda] Write Protect is off
[ 2425.836282] sd 1:0:0:0: [sda] Mode Sense: 03 00 00 00
[ 2425.837116] sd 1:0:0:0: [sda] No Caching mode page found
[ 2425.837132] sd 1:0:0:0: [sda] Assuming drive cache: write through
[ 2425.849118]  sda: sda1 sda2
[ 2425.852683] sd 1:0:0:0: [sda] Attached SCSI removable disk

 SD demsg 

[    1.101858] mmc0: new high speed SDHC card at address aaaa
[    1.107720] mmcblk0: mmc0:aaaa SL08G 7.40 GiB
[    1.114401]  mmcblk0: p1 p2

  USB mounted /dev/sda2 SD /dev/mmcblk0p2
 direct read56 MB in 3.06 seconds
= 18.31 MB/sec
 56 MB in  3.09 seconds =  18.15 MB/sec
  cache read  870 MB in 2.00 seconds = 434.36 MB/sec814 MB in  2.00 seconds = 406.62 MB/sec
2 MB (2.0 MB) copied, 0.0170072 s, 120 MB/s(2.0 MB) copied, 0.0175781 s, 117 MB/s
 20 MB(20 MB) copied, 0.152643 s, 134 MB/s(20 MB) copied, 0.15668 s, 131 MB/s
 205 MB (205 MB) copied, 3.86576 s, 53.0 MB/s(205 MB) copied, 3.02502 s, 67.7 MB/s

For the USB dd test the USB SD card was mounted to /mnt

pi@pi2pic ~ $ sudo mount /dev/sda2 /mnt
pi@pi2pic ~ $ cd /mnt/home/pi


Using the same SD card it would seem that access via the usb interface is faster on smaller files and reads. So all future storage compare will be done via the USB interface till we hit the USB interface limit. 

collectd - install and use

sudo apt-get install rrdtool && sudo apt-get install collectd

sudo apt-get install lighttpd


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

$git clone git://git.drogon.net/wiringPi
$cd wiringPi
$git pull origin
$~/wiringPi/gpio/gpio readall


Tried both C+ wiringpi and adafruit python c methods. 

Python seem slower but more accurate. 

https://chrisbaume.wordpress.com/category/technology/raspberry-pi/ not using the wiringpi stuff but the graphing looks good. 

Using DHT11 with RPi-Monitor

Connected to pin4 on GPIO. 

/etc/rpimonitor/template $ sudo nano dht11.conf

# Extract temperature and humidity from DHT11/DHT22
#  Page: 2
#  Information               Status     Statistics
#  - tempetature             - yes      - yes
#  - humidity                - yes      - yes
# Add new pages (number 2)
# Get dynamic data
dynamic.1.regexp=Temp = (\S+)

dynamic.2.regexp=Hum = (\S+)

# Add a line of status in page number 2
web.status.2.content.1.line.1="Ambiant Temperature: <b>"+data.yard_temp+"&deg;C</b>"
web.status.2.content.1.line.2="Ambiant Humidity: <b>"+data.yard_humidity+"%</b>"

# Add a statistic graph (with 2 curves suing separate scales) in page number 2
web.statistics.2.content.1.ds_graph_options.yard_temp.label=Ambient temp. (deg C)
web.statistics.2.content.1.ds_graph_options.yard_humidity.label=Humidity (%)
#web.statistics.2.content.1.graph_options.legend= { position: "sw"}
web.statistics.2.content.1.graph_options.y2axis={ position: "right", min: 0, max: 100 }

Crontab to write values out to a file that is read by rpi-mon. 
*/1 * * * * sudo /usr/bin/dht11.py 11 4 >/dev/null 2>&1

Modified dht11.py file 

if humidity is not None and temperature is not None:
        line= 'Temp = {0:0.0f} *C, Hum = {1:0.0f} %'.format(temperature, humidity)
        print line
        file = open("/run/dht11.log", "w")


Get the latest form http://webiopi.trouch.com/DOWNLOADS.html

$ tar xvzf WebIOPi-x.y.z.tar.gz
$ cd WebIOPi-x.y.z
$ sudo ./setup.sh
f fish,
6 Nov 2015, 18:16