Scan to Evernote with Rasberry Pi

scanner

I’ve had long time a plan to scan all receipts and documents and save them to Evernote in order to find what I need quickly, even when mobile.

Problem

I’ve been lazy scanning because there are so many steps:

  1. Connect scanner to a computer
  2. Open scanning software
  3. Place the document inside the scanner
  4. Click scan in the software
  5. Enhance contrast
  6. Copy the image to Evernote

While it should be simple as:

  1. Place the document inside the scanner
  2. Click email button from the scanner

Solution

Plug the scanner to a Rasberry PI (connected to internet) and keep it always on. Have the physical scanner buttons scan and send to different targets (Evernote, Dropbox, printer, email).

Requirements

  • Scanner (Canon CanoScan Lide 110)
  • Rasberry PI Model B
  • 4GB SD
  • USB stick with Raspbian installer

Steps

  1. Install Raspbian
  2. Install scanner software: apt-get install sane
  3. Install scanbd to control scanner buttons:
    apt-get install libconfuse-dev libhal-dev libsane-dev
    wget http://downloads.sourceforge.net/project/scanbd/releases/scanbd-1.4.1.tgz
    tar zxvf scanbd.tar.gz
    ./configure
    make
    make install
    
  4. Install mutt mail client: sudo apt-get install mutt
  5. Configure smtp for mutt (place the configuration under /root):
  6. Install imagemagick: sudo aptitude install imagemagick
  7. Take control of one of the Rasberry PI’s led:
    echo 1 > /sys/class/leds/led0/brightness
    echo 0 > /sys/class/leds/led0/brightness
    
  8. Set up Dropbox commandline client
  9. Configure scanbd:
    echo 1 >/sys/class/leds/led0/brightness 
    DIR=`dirname $0`
    scan_dir=/var/spool/scan
    datetime=`date +%F_%H%M%S`
    filename=scan-$datetime
    case $SCANBD_ACTION in
    pdf)
    # Not working
    ;;
    scan)
    # Upload to dropbox, used for photos
    scanimage --mode Color --depth 32 | convert - $scan_dir/$filename.jpg
    dropbox_uploader.sh upload $scan_dir/$filename.jpg  /
    ;;
    copy)
    # Print with default printer
    scanimage --depth 16 | convert - $scan_dir/$filename.jpg
    lp $scan_dir/$filename.jpg
    ;;
    email)
    # Send to Evernote via email
    scanimage --mode Color --depth 16 | convert - -normalize -level 10%,90% -sharpen 0x1 $scan_dir/$filename.jpg 
    echo "" | mutt username.secret@m.evernote.com -a $scan_dir/$filename.jpg -s "$filename" -d 5
    ;;
    esac
    rm $scan_dir/$filename.jpg
    echo 0 >/sys/class/leds/led0/brightness 
    exit 0
    
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s