An automated measure of weight comes in useful for many automation applications: not only for getting the weight, but also for detecting the presence of an object or animal, or even for counting items. So we wanted to experiment with it for quite some time already. But we were missing a key piece of the puzzle until very recently, that is, until the arrival of the Yocto-milliVolt-Rx.
Principle and schema
Weight is measured using a load cell. A load cell is a transducer that converts the magnitude of a mechanical force, applied on a point, into a tiny voltage of a few millivolts, proportional to the force.
A load cell to measure up to 100 lbf
A load cell works like a Wheatstone bridge: the output voltage is also proportional to the excitation voltage applied to it. In our experiment, we use a 100 lbf load cell specified with approximately 20mV/V output. When powered with 3.3V, the output is therefore 66mV for a 100 lbf load, and 0.66mV for a 1 lbf load.
As the output value of the load cell depends on the supply voltage, it is important to use a stable power supply. Since it only requires very few milliamps, we can steal them directly on the output of the 3.3V linear regulator present on all Yoctopuce devices. Here is what our project looks like:
The connectivity and power supply comes over the Ethernet cable. The YoctoHub-Ethernet provides remote access to the Yocto-milliVolt-Rx, used to interface the load cell, and to a Yocto-MiniDisplay, used to display the value on the scale.
Mechanical construction
A tricky step in building a scale is the mechanical part: ideally, 100% of the gravity force should be directed to the sensitive point on the load cell. But since your load is likely to be much bigger than the tiny load cell, you need to use some kind of plate to hold the weight that stands stable on the load cell. One way to do solve that issue is to use multiple load cells to provide more stability, and sum the weight measured by all cells afterwards, but that costs more. We have chosen to build our scale using a single load cell, and to provide stability by mean of a small tower made of sliding acrylic glass plates.
Our DIY scale with Ethernet support
Another cheap alternative would have been to hack a kitchen scale and connect Yoctopuce sensors on the load cells output, in parallel to the original electronics. As the Yoctopuce sensors input impedance is huge, they would have no effect on the original electronics.
Software and Configuration
To display and log the measured weights on the control computer, we start from the sample sensor graph application provided in Yoctopuce library for Delphi. This application was originally written to work on a sensor connected directly by USB, but can trivially be adapted to work on a sensor connected to a YoctoHub-Ethernet, by replacing
by
In addition, we add to the value callback function the code to display the last value measured directly using MiniDisplay on the scale. This can be done as simply as :
dispLayer.drawText(32, 8, YALIGN_DECIMAL_CENTER, newValue)
In order to get nice stable measures, we setup the report frequency on the device to 60 measures per minute. In this way, the Yocto-milliVolt-Rx automatically performs oversampling, and returns average values computed internally.
That works out of the box to display and graph the millivolt value read from the load cell. Now to get a value in Kg instead of mV, we just need to configure the mapping in the Yocto-milliVolt-Rx.
The specified output of our load cell at 3.3V is 66mV per 100 lbf (45.36 Kg). This is however a theoretical value, and the exact ratio may slightly vary from one load cell to the other. The actual ratio can be computed once for all, simply by measuring the mV output for a known reference weight. In our case, we measure 2.5mV for 1.6 Kg so we will configure the Yocto-milliVolt-Rx mapping to map the 250mV range to 160 Kg.
The value returned by the load cell when there is no weight is biased as well, up to 5mV according to the datasheet. In our case, the zero-output reads -1.3mV. This needs to be compensated in the sensor setup as well, or significant reading error would occur. For this, we have just added in the Yocto-milliVolt-Rx firmware a new setting, named signalBias, that can be set to fix the signal zero point.
Once properly configured, the scale is actually quite precise
Once the Yocto-milliVolt-Rx mapping is configured, the graphing software and the display on scale automatically display the proper value. And the nice thing is, as all load cell-specific parameters are stored in the Yocto-milliVolt-Rx interface module instead of hard-coding them in the application software, the software does not need to be changed when replacing a sensor. And if another independant application needs to access our IP-enabled scale remotely, it will also get the properly computed values.
Here is the result in video:
As you can see, although the mechanical design of this scale is far from perfect (poorly centered objects result in friction of the acrylic plates) the precision of the resulting scale is very close to the load cell precision (1%). Keep in mind however that the use of an uncertified DIY scale is not permitted for business where you sell goods by their weight. So you won’t be able to enjoy our Yocto-Scale on the local fruit market any time soon, sorry !