Raspberry Pi Scanner using HP PSC 2170

A few days ago I decided to have a good sort of all my old documents, statements and piles of paper that I’ve kept for years just incase I need it (I doubt I’m ever going to need my mobile phone statement from 2008).
I’ve been looking on ebay for a few months for a networked duplex document scanner. but these seem to easy break £70 and I don’t think I’d get alot of use out of it beyond initially scanning everything.
I already have a HP PSC 2170 Printer/scanner (not duplex), but the windows software is pretty crap, I use irfanview (which is a great bit of software), but the HP scanning software insists on loading for each scan then warmup the lamp and do a prescan before allowing me to actually scan. It’s always put me off using it.

So while thinking I’ve got papers everywhere, a scanner, and a few free PI’s a little light went off in my head, surely I can use a PI (I’m not expecting wonders with the scanner) but it’s something to play with. So google being your friend I went looking and came across:-

ok so I could just take what he’s done and just use it. It looks like a good idea, and he/she has updated the process to include some form of web interface. Anyway it’s not what I need I just want to be able to scan to a device that’s on my network.

I put a rasbian image onto the PI, expanded the 16Gb SD card, named the PI and run updates.
Then I installed ‘sane’ via ‘apt-get install sane’
{note this is from memory, my history doesn’t contain all the commands I’ve used, I’ll need to recheck this on a fresh install}
Once sane was installed I used ‘scanimage -L’ to check my device is being detected. Nope nothing get’s listed. A quick google search for ‘sane HP PSC 2170’ I found a page listing HP PSC 2170 as good support. so I thought, well it should just be working. after a bit of scrolling around I noticed the table had an end column listing driver as hpaio, this wasn’t apparent against my printer, nevermind it’s another clue. So a bit more poking around to find out if the driver is installed I found ‘apt-get install libsane-hpaio’. Now when running ‘scanimage -L’ I get device `hpaio:/usb/PSC_2170_Series?serial=XXXXXXXXX’ is a Hewlett-Packard PSC_2170_Series all-in-one’.

With all this up and running I’m now onto getting an image. Running ‘scanimage -p –format=tiff –resolution=150 > test.tiff’ gives me a nice image within a few seconds. I was surprised at just just how quick the scanner sprang into action. No scanning the same piece of paper twice, no warming up the lamp.

Now that I have this, I’d much rather a jpg than a tiff. so I use ‘convert temp.pnm temp.jpg’ oh look another error, convert isn’t a valid command. Of course it’s not, I forgot to install anything. ‘apt-get install imagemagick’ and rerun the convert and now I have a much smaller jpg file. (I’m going to skip the steps I used to install and configure samba, to be able to pickup my images, but take it I did. I could have just as easily used WinSCP to access the files)

With all the tests done, and alot of {press up, press enter} I decided to write a quick bas script. First to just capture an image then convert it using a filename provided, then I improved it to save the filename based on the unix time, next I improved it to be able to group multiple pages into a single folder. Below is the script that when run, gives an option of single scan page or multi scan page, goes off and runs the scan and convert and returns either to the initial prompt or in multimode ask if there’s another page.

cat /usr/sbin/scan_it.sh
image_date=`date +%s`
echo "  :  Scanning Image $image_date into $pwd"
scanimage --resolution=200 > temp.pnm
convert temp.pnm $image_date.jpg
rm temp.pnm
while [ true ]
  read -n 1 -p "Single, Multiple, Quit? " INPUT
  case "$INPUT" in
    cd /var/scans/
    folder_date=`date +%s`
    mkdir /var/scans/$folder_date
    cd /var/scans/$folder_date
    while [ "$YN" == "y" ]
      echo "Another Page? (Y/N) "
      read -n 1 YN
    echo " Quitting... Goodbye..."
    exit 0
    echo " Not an Option! "
This script presumes you have already made a folder ‘/var/scans’ using ‘mkdir /var/scans’
I did also setup sane to run as a network service making the scanner available from other machines, but I haven’t tested this yet. For my needs I decided to keep the images as jpgs rather than make PDF’s I still may make PDF’s out of all my documents, especially the multi paged ones. But I like the idea that I can access jpg’s on pretty much anything (including my recent experiments with python and pygame to display graphics on my TV via HDMI. I think PDF’s are a little more restrictive).
When doing the initial google search I also came across:-
Which looks like a really promising idea. To move away from needing terminal access to the PI to scan stuff.
The main reason I’ve decided not to go any further at the moment, is my printer/scanner I think is starting to die (not related to this setup) on a few occasions it’s refused to scan and needed a reboot, it’s also locked the scanner at the bottom of the page instead of returning after a scan, and went through alot of clunking (which just wouldn’t stop) when it was initializing after one reboot.
While it has the possibility of failing to complete a scan I’d rather be able to see any errors on screen.
I’ve spent tonight scanning over 400 pages, at the end of which I copied all the files to my server and run a backup then happily set fire to each piece of paper I’ve been keeping for years. It’s been something of a therapeutic exercise. I have no doubt I’ll be returning to this little project in time to actually incorporate sending the files directly to the server, having the option to email them, converting to PDF on request, and god knows whatelse. For the time being this script is doing me just fine. The only option I may incorporate is a selection of a ‘scan to’ folder before selecting single/multiple after scanning alot of bank statements, phone statements, payslips, etc I know I’m going to be sorting them all into subfolders and doing this at the time of scan just makes more sense.
Anyway that’s my rambling for today. Hopefully it will give someone some ideas.

Twonky Server Slow Scanning

Ok so first a little about my setup.
I have twonky running on a RaspberryPI along with OpenVPN. The whole point is so that I can play my files when away from home. This worked great a few months ago simply plug in to the internet, the VPN connects and then the shares are connected, and twonky scans the folders. It’s not perfect in that twonky can scan empty folders and remove stuff from it’s database so it kinda screws with the playlists and I can never remember what episode I got upto. But it still works. Then I upgraded to 6.0.39 and things went a little weird. It used to complete a scan within a few minutes. But now it was taking over an hour to complete. For the most part it didn’t really bother me, plug it in and leave it do it’s thing. But if the VPN ever went a bit weird it could cause a full rescan, it also seemed to use more data, previously a few Mb now it could be a few 100Mb.

It was more of an annoyance than anything. I did have a search around but couldn’t find anything that would have caused it in the version changes that jumped out at me.

That is until today.
Today I found an article on Series and Movie thumbnails http://server.vijge.net/tw-video-scraper/ so I grabbed the files. I’m not sure if they work 100% yet, I’m getting a symlink error when I run it manually, but it does pull and save a thumbnail. As I’m watching something I don’t want to restart twonky to test it.
But I noticed in the cgi-bin folder a few other {scripts}, in particular ffmpeg-video-thumb.desc
Now the stuff in the link does say to disable this, but it got me thinking. Is this running on the PI, so I decided to have a look. There’s alot more files in the cgi-bin for 6.0.39 than previous versions, and this will try to make a thumbnail for each video file. So I disabled the code by putting # at the start of each line. It may not be the cleanest approach but I want to be able to put it back if it breaks something.

Restarted twonky on the PI, and watched the status page. It managed to scan everything across the VPN within a few minutes again. And looking at the network stats probably pulled around 10Mb of data.
So I think that’s solved this little problem of slow scanning in Twonky for me.

Raspberry PI

After waiting all of Feb for news of when the Raspberry PI was going to be released, We finally got told that an announcement would be made at 6am on Wednesday 29th.
As I was still awake at 3am, I thought no point in setting the alarm I’ll just stay awake. Hoping that this would indeed be the launch day.
(As it was very early in the morning and I’ve definitely slept since the following times are approx.)
Sometime after 5am raspberrypi.com was replaced with a down for maintenance page.
Then about 5:45am, raspberrypi.org seemed to disappear off the net, then come back with a nice server error. but this only lasted a few mins.
As the time got closer to 6am, I could feel the pain of the PI’s servers. As I had at least 10 mins to go, I wasn’t hitting refresh 60 times per min (I’m sure enough people were). Every now and again the server wouldn’t respond, so I’d gave it 30 secs and try again.

All of a sudden (I’d say at about 5:58am), the raspberrypi.org page loaded up and was completely different. This is it the announcement we’re all waiting for.
As I scanned through quickly, I noticed them saying about licensing 2 resellers I kept looking quickly for the ‘where to buy’, then I got it 2 links. So I quickly right clicked on each and opened in a new tab.

Both loaded fairly quickly. Once into the Farnell site I searched raspberry, as the results come back it said 2 products but didn’t show them. So I click on the words products and it reloaded and displayed. Clicking the add to cart option threw up a nice little dialogue under the cart saying adding, then that was replaced with an ‘unable to find price in database. Item not added to cart’ error.
SHIT!! was the exact thought, never mind try the 2nd obviously farnell has an issue.
As I got to the RS site again there wasn’t anything on the homepage like I’d expect for a pretty big launch. So again type raspberry into the search and hit enter. It comes straight back with a specific RaspberryPI page. I scrolled quickly down looking for the add to cart button or buy button, but nothing only a form to fill out with my details to register my interest.
‘Surely that’s not right, I’m on the wrong page.’ I thought. Again type raspberry into the search box and back I come to the same page. Bugger it, as least I found it on the farnell site so I went back to that tab. reloaded the page and searched again, expanded the products and clicked the add to cart button. Again I got the nice error!! I’m seriously not impressed now, I’ve hit both sites very early on but not getting me any closer to having a nice order number.
Back I went to the RS site and thought well I’ll fill in the details and maybe it’ll direct me then to another page. Filled them all in and submit. Great but still no page where I can order it. So decided to go back to the start page for RS and look at the categories incase it’s not coming up on a search. It was at this point that the RS site started to load slowly for me. So back I jump to farnell, and refreshed back to the homepage.
Now the fun begins, Farnell just completely stopped loading anything for me. give it a couple of secs and refresh, oh I’m pushed to a page telling me their site is overloaded but I can phone an order through.
Great stick the number into my mobile and press dial. Nope it didn’t dial, instead I’m being sent to a page. Thinking to myself wtf, as the page sprung up with a list of alternative numbers, I quickly realised I installed No to 08 app ages ago (I dont ring 08 numbers very often and forgot I did it). Never mind though it’s given me an alternative so clicked it and dial commences. Ring-Ring, and I’m answered. Oh NO it’s an IVR happily telling me their lines open at 8am but I can place and order or enquiry at their website. Not F###ing likely I thought while hanging up.
Refreshed Farnell, dead. back I go to RS. It’s loading but the search is still giving me the same register my interest page.

All this has taken place within about 5-10 mins.

So thinking quite calmly, ‘Maybe they haven’t released yet, I should really read through the raspberry announcement page’. So back to that tab and scrolled to the top. This time paying attention, I take in all the info and yep they are on sale from today.
Back to Farnell tab and refresh = nothing.
Over to the RS tab and refresh = oooohh it’s slow, and now it’s gone.
After about 5-10 mins of jumping back and forth between tabs, and I have to admit I’d also opened additional tabs since I’d been refreshing the Product Search on Farnell, I’d opened a new one for their front page. and similar on the RS.
As I’m getting nowhere fast, I went back to the RPI page. Then noticed they’re twitter link. So I opened this (in a new tab).
oh there’s lots of people shouting on here that they can’t get anywhere. All of a sudden I noticed a posting from Liz saying if your getting the register your info page on RS your on the wrong page.
‘F#ck It!!’ I thought, back to the RS tabs and refresh, luckily the one did load and did another search still it took me back to the register interest page. Another search gave no results.
Back to Twitter I go, in the 20 or so seconds I’d been away twitter was very happy to tell me 80+ new posts.
Now I have to admit, I’ve gone through product launches from a tech side and it’s always worse than what the marketing people tell ya. I knew that the R-PI was going to be big and that the first 10,000 was going to sell out fast. I’d only judged that on the number of downloads that the (pre) software image had a few weeks back and the number of people talking in the forums. Having never looked at the number of followers the R-PI had on twitter, I didn’t expect the overwhelming chatter I now threw myself into.
I’m not a big fan of twitter personally, it just doesn’t appeal or click with me. But at 6:30 in the morning I have to say I was enjoying managing to read 2/3 comments before it was popping up another 10+ new comments, clicking that reading a few and repeating.
While doing this jumping to other tabs and trying to refresh, unlike early though where the pages did load but slowly, I was now hit with no response across all the Farnell & RS refreshes.

After another 20 mins of reading tweets and trying to refresh pages, I had a call from my cousin did I want to go for coffee and he’s now on the way home.
‘Yep, fine’, not getting anywhere with this now. 2 sites down, lots of angry tweets, and my hopes of getting a R-PI early was pretty much wiped out.

After an eventful trip to the coffee place, which consisted of the coffee girl in tears because a boss she doesn’t like is coming back to the store and she now has to transfer stores.
We’re back in the car, oh the times 7:59am. Well their lines open at 8am, I doubt very much that they’ll have any left now, but don’t ask don’t get so I pressed redial on my phone. It rang and rang then an announcement ‘higher call volumes than expect, please hold’, at least their open. Then I get a nice double beep off my phone 8% battery remaining.

Now I’ve been in much worse positions with little battery life, but the timing just sucks. never mind I’ll keep on the line until the battery is dead. Now I have to say a big thumbs up to HTC, every other phone I’ve had has pretty much died within seconds of telling me it’s low when on a call, but this one managed a 10 min journey home while still on the call (in a queue I should add), and my 5 mins fumbling around single handed trying to find my keys, while not dropping either my phone or tablet.
Alas after 15 mins of holding, I decided there’s little point in holding, if they had any left at 8am, 15 mins worth of calls would definitely wiped them out. So I hung up.
Went back to my laptop and refreshed. Both pages still out, so back to twitter I go.

Plenty more chatter to catch up on, but still there’s one hell of a constant flow of new stuff coming through.
All of a sudden a refresh of Farnell kicked in. It was my search one, so I quickly clicked add to cart. oh it’s added!!!!!
Checkout!! – it’s only gone straight through and given me the checkout.
So in I filled the address info, and proceed. it’s trying to load an invoice page but nope timed out. I can see in the addressbar I have a session ID, so maybe just maybe it will remember me if I refresh and it wont kick me back to the start.
5 refreshes later and I have an invoice page loaded. Quickly filled in my details and onto the next page.
All in all it took me about 5 mins to get all the way through and a hell of a lot of refreshes along the process. but finally it’s complete my order.

I received an email confirmed my new account, a few hours later I had some mails confirming my order and giving an estimated delivery of end of march (I’d be quite happy with that I thought).

Today I received another confirmation of my order, but now pushing estimated delivery back to the end of April. I’m kind of expecting that to get further back as time progresses, but we’ll see what happens.

This evening I received a mail from RS confirming my interest and saying they will be mailing out to take orders later in the week. They also put that the orders will be sent out in a first come first served.
Now I’m not entirely sure if they mean the register your interest order, or a new order starting with another gold rush when they mail people saying you can buy them from them.
If it’s the former, I’m hopeful that my submission for interest was early enough to be amongst the first while everyone else was still looking to buy it. It was after all done while they’re site was quite alive.

Time will tell. I’m still really excited with all this, and think that the enormous following it’s gathered has to be a good thing. I’ve got so many little projects that I want to do with it, if I could get a few by the summer-time it would definitely keep me busy all summer.

Raspberry PI

Not sure if anyone reads these at all, but thought I’d make a comment as I go.
I’m waiting on news from Raspberry PI to know when they’re being launched. At first they’re going to have a run of just 1000 units, I have a load of ideas I’d like to try and do on it from some home automation, security system, all the way to maybe getting zoneminder running on it with a webcam.
It looks a fantastic little board and I think the idea of putting them into schools and letting kids play, program and create it a great one. I wish they’d done that kind of thing when I was in school. I wanted to do the computer control part of CDT but the teacher wouldn’t run it, or even let me do it as an extra after school in my own time.

Still I’ve done little bits and pieces as I go, but I’m really looking forward to the Raspberry PI coming out and getting to just play and experiment again. After looking on the forums yesterday I doubt very much that I’d be in with a chance of getting one of the 1st 1k, and it’s looking like a good couple of runs of 1k each are going to shift like hot cakes, but I’ll be looking out hoping the site doesn’t crash as soon as I know they’re out.