Raspberry PI and USB network scanner

Improved project details in here (28th/March/2013)

I came across this idea because there is a problem in the company that I work for. There is a remote office that has only a few people working a few hours a day. For these people computers are still a “complicated” object. We have internet and a VPN there. We also have e-mail and a server for remote backups. However something was missing. We need an easy way to transfer paper documents to our headquarters instantly.

.

.

To Buy a network scanner was too expensive; to buy a simple scanner and attach it to a computer was not a solution either, because there are 3 computers to 3 people. Despite that, it will not be would be an easy task to use this software due to people lack of knowledge.

 

The solution: an old scanner and a Raspberry Pi.

 

I assume that you may have some network background for setting up an email server and Bind so you can configure your operating system to send email to any email account.
In this solution I used Raspbian for the OS, Sendmail, Bind, Python, Bash, Sane, Imagemagick  and Mutt. I’ll skip the Sendmail and Bind details.

The idea is: atach an old USB scanner (must be compatible with Sane) to the Raspberry Pi, push a button to initiate the scanning process and a script is launched so the scanned image would be automatically sent to a predefined email address.

We have 2 leds for system status; I’ll be on headquarters and if the system fails, someone has to describe me, by phone what they see in the Raspberry Pi box.

So, let’s start by hardware: we will need 3 pins; one pin for the push button and two others for system status with leds.

System busy:
Pin 18 (RED) will be used to show that the system is performing is main task since the moment we’ll push the button to the moment that the image is processed, converted and sent.

Push button:
The button to trigger all the action. It will be conected to Pin 18 and a 10.000 omh resistor.

System status:
Pin 14 (GREEN) will be used to show the healthy system status by blinking twice every 5 seconds.
For that, I’ve used a simple Bash script that is called from /etc/rc.local on system boot.
rc.local
#initiate PINS 14 and 18 on GPIO
echo 14 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio14/direction
echo 18 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio18/direction
#turns leds 14 and 18 off
echo 0 > /sys/class/gpio/gpio14/value
echo 0 > /sys/class/gpio/gpio18/value
#bash script to initiate blinking status
/root/scripts/blinking.sh &
# python script to listen for the push button
/root/scripts/script_listen_for_scan.py &

/root/scripts/blinking.sh
#!/bin/bash
while true; do
echo 1 > /sys/class/gpio/gpio14/value
sleep 0.05
echo 0 > /sys/class/gpio/gpio14/value
sleep 0.09
echo 1 > /sys/class/gpio/gpio14/value
sleep 0.05
echo 0 > /sys/class/gpio/gpio14/value
sleep 5
done

/root/scripts/script_listen_for_scan.py
#!/usr/bin/env python
from time import sleep
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN)
GPIO.setup(24, GPIO.IN)
while True:
if ( GPIO.input(23) == True ):
os.system(‘/root/scripts/scan.sh &’)
sleep(1);

/root/scripts/scan.sh (this script will make all the job, and is called trough the loop of script_listen_for_scan.py)
#!/bin/bash
cd /root
rm -rf /root/sent.lock # to ensure that if something goes wrong, next time system will not hang up because of this
echo 1 > /sys/class/gpio/gpio18/value # process initiated – let’s turn led RED on
scanimage –resolution 100 > /root/scan_job.pnm # scan and save the file
convert /root/scan_job.pnm /root/scan_job.jpg # convert to JPG
cd /root # ensure to run as root to avoid the mutt to not send the file
sudo mutt -s “Scan from Remote Office” -a /root/scan_job.jpg -c email@mydomain.com < /root/MSG # MSG contains a simple message.
echo 0 > /sys/class/gpio/gpio18/value # job completed – Turn RED led off.

Video:

Trackbacks/Pingbacks
  1. [...] We’ve come across extremely expensive photocopiers that also fax, scan to email, and generally have too many features to list. [Eduardo Luis] figured out how to implement some of this type office magic using very inexpensive components. Specifically, he can press one button to scan a document and send it to an email address. [...]

  2. [...] We’ve come across extremely expensive photocopiers that also fax, scan to email, and generally have too many features to list. [Eduardo Luis] figured out how to implement some of this type office magic using very inexpensive components. Specifically, he can press one button to scan a document and send it to an email address. [...]

  3. [...] We’ve come across extremely expensive photocopiers that also fax, scan to email, and generally have too many features to list. [Eduardo Luis] figured out how to implement some of this type office magic using very inexpensive components. Specifically, he can press one button to scan a document and send it to an email address. [...]

  4. [...] We’ve come across extremely expensive photocopiers that also fax, scan to email, and generally have too many features to list. [Eduardo Luis] figured out how to implement some of this type office magic using very inexpensive components. Specifically, he can press one button to scan a document and send it to an email address. [...]

  5. [...] en práctica algo de esta magia oficina de texto con componentes muy baratos. En concreto, puede un botón para escanear un documento y enviarlo a una dirección de correo electrónico . El usuario controla parche en la cabecera del RPI GPIO. Ahí está el botón que ya se ha [...]

  6. [...] an affordable way to help colleagues in a remote office easily scan and email documents using a Raspberry Pi computer [...]

  7. [...] into a painless scan-to-email setup Posted on January 10, 2013 by ddtechsolutionsHere’s an affordable way to help colleagues in a remote office easily scan and email documents using a Raspberry Pi computer [...]

  8. [...] an old scanner and a Raspberry Pi to create a handy scan-to-network box, from Eduardo Luís: I came across this idea because There is a problem in the company that I work for. There is a [...]

  9. [...] an affordable way to help colleagues in a remote office easily scan and email documents using a Raspberry Pi computer [...]

  10. [...] an affordable way to help colleagues in a remote office easily scan and email documents using a Raspberry Pi computer [...]

  11. [...] If you have and old scanner lying around and a Raspberry Pi to hand you might like to create your very own. All the details and everything you need is over on  Luís’ website. [...]

  12. [...] Eduardo Luis has come up with a cheap, and incredibly simple (single-button-simple) alternative to the [...]

  13. [...] tejto adrese: http://eduardoluis.com/raspberry-pi-and-usb-network-scanner/ sa objavil návod ako spravi? z Raspberry Pi sie?ový skener, ktorý posiela naskenovane [...]

  14. [...] Eduardo Luis has come up with a cheap, and incredibly simple (single-button-simple) alternative to the [...]

  15. [...] som er forklaret i videoen nedenfor. Desuden findes flere informationer omkring projektet på hans hjemmeside, hvis nogen skulle ønske at gøre ham kunsten [...]

  16. [...] Pi Wireless Access Point RasPiLapse Raspberry Pi Web Radio Raspberry PI and USB network scanner raspi.tv Bookmark the [...]

  17. [...] Raspberry Pi and USB network scanner (Eduardo Luis) [...]

  18. [...] If you have and old scanner lying around and a Raspberry Pi to hand you might like to create your very own. All the details and everything you need is over on  Luís’ website. [...]

  19. [...] Scanner is a product born from the One Button To Scan – A Raspberry Pi solution developed from the need to provide the simplest interface to send [...]

  20. [...] did some research and stumpled upon the great the solution from Eduardo Luís: http://eduardoluis.com/raspberry-pi-and-usb-network-scanner/. Eduardos solution scans tiff files to email – emulating a basic function of modern desktop [...]

  21. [...] did some research and stumpled upon the great the solution from Eduardo Luís: http://eduardoluis.com/raspberry-pi-and-usb-network-scanner/. Eduardos solution scans tiff files to email – emulating a basic function of modern desktop [...]

  22. [...] Raspberry Pi Network Scanner [Hack A Day] This entry was posted in Hardware on April 20, 2013 by praveen Kumar. [...]

  23. [...] into a Scan-To-Cloud Device: Frederik Granna expanded upon a scan-to-cloud RasPi project created by Eduardo Luís to add an Adafruit Blue&White 16×2 LCD+Keypad Kit for display. (read [...]

  24. […] Seguir leyendo el tutorial | Pulsa aquí […]

  25. My Homepage says:

    … [Trackback]

    [...] Find More Informations here: eduardoluis.com/raspberry-pi-and-usb-network-scanner/ [...]