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:

29 thoughts on “Raspberry PI and USB network scanner

  1. Pingback: One-button scan to email using Raspberry Pi

  2. Pingback: One-button scan to email using Raspberry Pi | Daily IT News on it news..it news..

  3. Pingback: One-button scan to email using Raspberry Pi | Siecurity.com

  4. Pingback: One-button scan to email using Raspberry Pi | Cool Internet Projects

  5. Pingback: Un solo botón escanear a correo electrónico utilizando Raspberry Pi - | Indagadores |Seguridad informatica |Seguridad en internet

  6. Pingback: Raspberry Pi can turn an old scanner into a painless scan-to-email setup | Arne Ruhnau News

  7. Pingback: DD Tech Solutions - Raspberry Pi can turn an old scanner into a painless scan-to-email setup

  8. Pingback: Raspberry PI and USB network scanner #piday #raspberrypi @Raspberry_Pi « adafruit industries blog

  9. Pingback: ????????????????????? ???????????????????????????????????? ???? Raspberry Pi | Raspberry Pi Thailand

  10. Pingback: Blog ALL » Raspberry Pi can turn an old scanner into a painless scan-to-email setup

  11. Pingback: Raspberry Pi can turn an old scanner into a painless scan-to-email setup | Bitmag

  12. Pingback: Raspberry Pi Used To Transform Old Scanner Into Scan-to-email System (video)

  13. Pingback: Single-button scan-to-email | Dank Logic

  14. Pingback: Jedno tla?idlo pre skenovanie na E-Mail

  15. Pingback: Single-button scan-to-email | Information News

  16. Pingback: Scan til e-mail vha. én knap • RaspberryPi.dk

  17. Pingback: Petkov.ME | ????????? Raspberry Pi ???????

  18. Pingback: Raspberry Pi Print And Scan Server part 1: Scan Straight To Dropbox

  19. Pingback: ??? ? Raspberry Pi ?? MalinaPi.ru » Raspberry Pi Used To Transform Old Scanner Into Scan-to-email System (video)

  20. Pingback: NetPi Scanner – Network scanner | Eduardo Luís

  21. Pingback: Turn your Raspberry Pi into a Scan-To-Cloud Device | doctape

  22. Pingback: Turn your Raspberry Pi into a Scan-To-Cloud Device « adafruit industries blog

  23. Pingback: Scan to Email Using Raspberry Pi | Eptins

  24. Pingback: Community Corner: This Week in Adafruit’s Community! « adafruit industries blog

  25. Pingback: Tek tu?la taray?c?dan e-posta göndermek (One button scantomail) | Raspberry Pi Türkiye Toplulu?u

  26. Pingback: Raspberry Pi y escáner de red por USB - Raspberry Pi | Raspberry Pi

  27. Pingback: My Homepage

  28. Pingback: Network Inventory Scan |

  29. Pingback: Address Scanner | onlinesystembackup.com

Comments are closed.