Skip to content
Jonathon Duerig edited this page Jun 27, 2014 · 45 revisions

How to install spreadpi onto your raspberry pi

  • First, do realise that spreads and spreadpi are both work in progress! They have been tested and found stable, but there might still be issues. Please do report them at https://github.com/DIYBookScanner/spreadpi/issues . Thank you.
  • Choose an SD card.
    • Make sure it's the fastest and the most reliable you can get. If it's not class 10, don't even think about using it. Buy a well known brand of card from a reputable shop.
    • In terms of size, 8Gb should be enough for both testing and production.
  • Get a spreadpi image to flash onto your SD card.
    wget http://buildbot.diybookscanner.eu/spreadpi_latest.img.gz
  • Check your computer's local storage.
    mount
  • Insert your SD card into your sd card reader. Now check again.
    mount
    .
  • What was the difference? You should have one extra line of output saying something like:
/dev/mmcblk0 on /media/usb0 type ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered)

In this example, the "/dev/mmcblk0" is how your computer refers to your SD card. This could be different on your machine! Note that you may see a device labelled something like "/dev/mmcblk0p1". The trailing 'p1' is an individual partition and you must write the card to the whole device rather than a partition. Omit the 'p1' suffix. In this example, you would still use "/dev/mmcblk0" as the device.

  • Unzip the spreadpi image and flash it to your SD card.
    gunzip spreadpi_latest.img.gz | pv -s 8G --eta | dd of=/dev/mmcblk0
  • Insert your spreadpi SD card into your raspberry pi.
  • Plug your pi into the local network. Make sure you have your linux machine also connected by cable to the local network.
  • Connect your cameras to your USB hub. Connect your USB hub to the raspberry pi.
  • Connect the USB foot pedal directly to the second USB port on your raspberry pi.

Troubleshooting

The cameras don't show the ip address of my raspberry pi.

We offer two alternative methods for finding out the ip address of your pi. The first depends on access to your router, the second requires root access to a linux machine on the local network.

Finding out the pi's ip address via your router

http://voipfan.net/other/finddhcp.php should give you a hint.

Finding out the pi's ip address via a local linux machine

  • On your linux machine, install a network mapper.
    sudo apt-get install nmap
  • Now let's check our linux machine's ip address.
    /sbin/ifconfig|grep -A1 eth0
    wlan0     Link encap:Ethernet  HWaddr 00:27:10:bb:e2:f1
    inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
    .
  • Aha! Nmap can find the raspberry pi on your local network.
    sudo nmap -p22 192.168.1.101/24|grep -B4 Raspberry
    Nmap scan report for 192.168.1.1
    Host is up (0.0018s latency).
    PORT   STATE  SERVICE
    22/tcp open ssh
    MAC Address: B8:27:EB:4C:00:00 (Raspberry Pi Foundation)

Connecting to your raspberry pi through ssh

  • We know the ip address of our pi. Now Let's connect to it. Both user name and password are "spreads".
    ssh spreads@192.168.1.1
    spreads@spreads:~$ 
  • We're inside the pi now!

Manually configuring spreads

http://diybookscanner.eu kits as of 20140318 have spreads preconfigured on the pi out of the box. If not, we have some configuration work to do. First, we have to switch into the virtualenv.

spreads@spreads:~$ source /virtspreads/bin/activate
(virtspreads)spreads@spreads:$
  • Now let's configure spreads.
(virtspreads)spreads@spreads:~$ spread configure
  • TODO: configuration documentation to be completed

Manually starting spreads on the pi

Again, we have to make sure we are in the virtualenv:

spreads@spreads:~$ source ~/virtspreads/bin/activate
(virtspreads)spreads@spreads:~$

Now we make the spreads web interface available at the ip address of your pi:

(virtspreads)spreads@spreads:~$ spread web --mode=scanner --standalone-device

Checking if spreads is running

Normally, spreads should start on boot. But that is not the case, so we want to investigate.

First, we need to be logged in as root on the pi. (The root password is "raspberry".)

ssh root@
root@spreads:~#

Is there a spreads process id?

The init system is responsible for starting spreads on boot. Let's check if there is a process id for spreads managed by the init system:

root@spreads:~# ls -l /var/run/spreads/spread.pid

If there is no process id, spreads is not running.

What do the logs say?

We can also go and check the spreads logs:

root@spreads:~# tail -n100 /var/log/spreads/spread.log

It's always a good idea to have a look at this. If you want someone to look at this information, make sure to keep a copy.

Can we see the spread process on the network?

Spreads runs on port 5000 by default. Let's see if we can detect any network service being offered on that port.

root@spreads~# netstat -ptan|grep 5000

If this yields no output, that's a bad sign. But maybe spreads is running, just not offering any web access?

Can we see a spread process?

root@spreads:~# ps aux|grep spread

Manually restarting, starting or stopping spreads

Spreads as installed on the pi by default has a standard initscript, so to stop or (re)start:

root@spreads:~# /etc/init.d/spread restart
root@spreads:~# /etc/init.d/spread start
root@spreads:~# /etc/init.d/spread stop

One of the cameras crashes/stops working/powers off, and it's always the same one!

Switch the card between the cameras. Does the problem persist in the same camera, or does it jump to the other camera?

Specific git revision

git reset --hard bd136bfe1251478c55e480ff65a267ec575f4e1c

Reporting bugs

Feel free to drop by on

irc.freenode.net , channel #diybookscanner
. Web access