-
Software - HX711 Libraries
09/18/2016 at 03:10 • 0 commentsInitially I was going to skip this bit in the docs but writing these logs inspired me to do this thoroughly. So I went and code reviewed most of the libraries for the HX711 on github.
Arduino
In my previous log I gave a shout out to a blog I found when I was looking for a chip to read my load gauge. I managed to find the library from its original developer. It's very clean and simple and there's a good setup tutorial in the readme that makes full use of helper functions so you don't have to write them.
Next up [bogde]'s library is the most refined and most cloned out of all the ones that I found. It has everything from zeroing to power management. There aren't any examples of using a fixed offset so you don't have to zero your device any time but that's just a call away. The only caveat with this is that the default Arduino version under Linux is 1.0.6 which requires you to remove some specific ESP8266 code (i.e. the two yield() calls) before installing the library in your Arduino environment or manually install a version above 1.5.1.
Linux GPIO
There are quite a few implementations ranging from a simple C example, a port of [bodge]'s implementation to GPIO and even a driver. Because I'm using Node Red I thought a nodejs wrapper might also be of interest.
Conclusion
When I first started this project I used the library in the tutorial and it was even configured perfectly for my gauge. But I want something that will be working for weeks on end so now that I found a fix for [bogde]'s library I'm inclined to use its sleep functionality.
I hope that helps anyone who wants to have a go at playing with strain gauges to skip the tedious task of finding the appropriate library and get on with playing with the data.
If I skipped any library it's either because it was an unattributed copy of [bodge]'s, it was a very basic implementation or written in a scripting language (python, ruby, etc.).
P.S. There are [two] [projects] from sparkfun that refer to HX711 which have good samples on how to use this library including an interactive calibration sketch to get the default offset and scale.
-
Hardware
09/17/2016 at 23:07 • 0 commentsSo I built this hardware ages ago but it was up to the software to do the heavy lifting. I finally decided to pick this up again after finally getting around to figuring out the software platform I was going to use for my projects (updates for my other project coming soon). I decided Node-Red was the most appropriate as the data flow paradigm is well suited for sensor based data feeds.
But this is about the hardware so read on.
The donor device was the kitchen scale I had laying around which is a Salter 1036. Inside there's a strain gauge that attaches to the top and bottom plates by two screws on each side. It is then connected to the display board by 4 wires: VCC, GND, S+, S-. The PCB then handles the zeroing, measurement unit and display. I initially soldered my wire on the pads but that made the display show 0 so I decided to skip keeping the device functional and move everything to the ADC. One thing to note if you're following the images is that the wires coming from the gauge have different colours going through the thick cable: red-red, green-green, white-yellow, blue-black.
The next bit was pretty simple: order the appropriate (read cheapest) ADC for strain gauges, the XFW-HX711 (other HX711 variants are available), and hook it up to an Arduino. The breakout board offers two channels but most libraries deal with only one. Speaking of libraries the ones available have a tendency to use the analogue pins for digital communication in their samples but whatever. I'm not going to question them.
There's not much more to it. I might revisit it with some buttons and maybe an NFC reader with tags at the bottom but I want to get this one working first. Tune in next time for the firmware and software setup, where all the interesting things happen!
Acknowledgements: Shout out to the original article that suggested using the HX711 for this.