usb: Thu Oct 8 00:42:00 2009

Thu Oct 8 00:42:00 2009

A few years back I picked up a Radio Shack USB Electronic Scale, on clearance, on the theory that it might work someday - or else I'd get at least that much value out of taking it apart...

I found it on a shelf today, plugged it in, did a google search for the USB id, and found user-space code that talked to hiddev0 and turned the events into weights. As much for the practice as anything, I converted it to python - handling ioctls isn't particularly tricky, but it took some poking to determine that the event values were sign-extended bytes, and the multiple reassignments to different variables in the C code actually mattered.

The python code probably needs to run as root unless you do some udev tweaking; fire it up with the scale empty, when you get the prompt, put something on it, hit enter, and read the weight in grams. Not terribly exciting... but the next step might be to keep reading until the new value stabilizes. Ultimately I'd like to put this in the kitchen, maybe hooked to a chumby, with code that lets you set a target weight, then beeps in one tone when you get close, and another when you hit the actual value (or something more sophisticated.) Basically to let me look at what I'm pouring rather than at the display... could also do multiple targets for mixing, have it even "speak" the next item to add (or for things that are strictly proportional, adjust later measurements based on the initial one, though that seems like it might not be that useful compared to just being accurate.)

note added 20140224 I wonder if the app attached to the Adaptics "Drop" connected-scale will include that, it at least does sophisticated recipe integration...