Blog2015 ≫ Laundrino diy smart connected washing machine continued

I have changed my code now to use SSOCR now instead and it's working nicely. Live results hopefully embedded here.

For a while I had a live update from my washing machine here. Long gone, sorry. Should be details elsewhere on the site as to how it all worked.

Exciting stuff eh? All just a bash script too, I will publish it soon.

Those missing images are available on my home network only; they're not for you, I can't be doing with the unneccessary network traffic of exporting those. There's one image there you can see, so we can all get an impression of what the camera can see right now. Helps with debugging if the SSOCR reading is not quite right.

This is all done with a raspberry pi with camera module pointed at the display on my washing machine. I'd like a smart washing machine but they're still hella expensive. I'd like to open up the machine and connect something or other to the gpio of the raspberry pi, but not sure what my wife would say when I broke the washing machine. So here is my safe DIY alternative!

Code is approximately:

#!/bin/bash
IMGFOLDER=/var/www
WIDTH=[2000](/wiki/#2000)
[HEIGHT](/wiki/#height)=[2000](/wiki/#2000)
CROPWIDTH=400
CROPHEIGHT=110
CROPLEFT=1300
CROPTOP=160
/usr/bin/raspistill -sh 100 -co 100 -w ${WIDTH} -h ${[HEIGHT](/wiki/#height)} --shutter 9000 -o ${IMGFOLDER}/laundrino.jpg
/usr/bin/convert -crop ${CROPWIDTH}x${CROPHEIGHT}+${CROPLEFT}+${CROPTOP} ${IMGFOLDER}/laundrino.jpg ${IMGFOLDER}/laundrinoCropped.png
SSOCR=`/usr/local/bin/ssocr -f white -b black -d-1 ${IMGFOLDER}/laundrinoCropped.png -o ${IMGFOLDER}/laundrinoSSOCR.png`
# time looks like 1123 as it thinks the : is a 1, can fix that with ssocr options I think...
HOURS=`expr ${SSOCR} / 1000`
MINS=`expr ${SSOCR} % 100`
/usr/bin/convert -threshold 20% -negate ${IMGFOLDER}/laundrinoCropped.png ${IMGFOLDER}/laundrinoBlack.png
BLACKBASE64=`cat ${IMGFOLDER}/laundrinoBlack.png | base64 | tr '\n' ' '`
DATE=`date`
MESSAGE="so estimate ${HOURS} hours and ${MINS} minutes remaining"
# then do something with this info... sms? tweet?

Will add this to a repo soon, perhaps pi-motion or maybe one of its own...

Any questions? Reply here or @pauly ...

raspberry pi: Credit card sized super cheap computer, awesome.

⬅️ :: ➡️

Paul Clarke's blog - I live in Hythe in Kent. Married to Clare + dad to two, I'm a full-stack web developr, and I do js / Node, some ruby, python, php ect ect. I like pubs, parkrun, eating, home automation and other diy stuff, history, family tree stuff, TV, squirrels, pirates, lego, + TIME TRAVEL.