Reading a postal scale
- more notes for my bad memory . . . .
Long term - Measure the honey flow in a beehive using a Linux box and view the results on a web page.
I have purchased various cheap electronic luggage scales and had hoped to use the strain gauges in them with some custom electronics.
But that is not easy.
Then I discovered various postal scales with built in USB output.
The cheapest is the stamps.com model 510 5lb postal scale - eBay in the USA lists lots of them being sold by people who no longer need their contract with stamps.com.
I plan to build a simple balance using a wide plank balanced on a strip of angle iron with the right angle V corner pointing up as a fulcrum.
The beehive will sit on the plank to one side of the fulcrum.
The other side will be longer and weights will be placed to just balance the hive.
The Model 510 will be placed in such a way as to register incremental increases in the weight of the beehive.
Care will be taken to ensure it never sees more than 5lb before an end stop limits the pressure.
It might be placed arranged so that, say, 20lb of new honey will apply 5lb of force to the scale.
First task - connect the USB postal scale to a Raspberry Pi
https://github.com/erjiang/usbscale presents an open source c program that reads the weight from a USB scale.
With many thanks to erjiang for publishing this software.
It can be compiled on the Pi
I unpacked usbscale-master.zip and put the contents into a new folder /home/graham/scales on the Pi
(I keep a backup of usbscale-master.zip here )
Using a ssh terminal on my iMac first I did
apt-get install libusb-1.0
ls showed that a binary file usbscale had been compiled
With nothing on the scale I saw
and with an item on the scale -
usbscale was then moved to /usr/sbin/ so that the program could be called like any other.
A copy is here
The instructions say -
"The file 50-usb-scale.rules contains a sample udev rule file that should be placed in /etc/udev/rules.d/"
the dmesg command to see the boot messages included
[87036.537177] usb 1-1.2: new low speed USB device number 7 using dwc_otg
[87036.676047] usb 1-1.2: New USB device found, idVendor=1446, idProduct=6a73
[87036.676092] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[87036.676114] usb 1-1.2: Product: Stamps.com Model 510 5LB USB Scale
[87036.676131] usb 1-1.2: Manufacturer: ELANE
[87036.676145] usb 1-1.2: SerialNumber: 00655495
[87036.765555] generic-usb 0003:1446:6A73.0004: hiddev0: USB HID v1.10 Device [ELANE Stamps.com Model 510 5LB USB Scale] on usb-bcm2708_usb-1.2/input0
- so my scale is the one listed in the first line of 50-usb-scale.rules
I guess you could include other models.
This version just prints the weight as decimal lb in format x.xx with no return characters
- it will be called by other programs.
I have yet to study -
another C version
- if I unplugged the scales and plugged them in again this ran but gave a zero
('ELANE Stamps.com Model 510 5LB USB Scale', 123, 255)
[123, 123, 123, 123, 123] -> 123
[255, 255, 255, 255, 255] -> 255
put something on: (press return here)