Having beer on tap in your own home can be an extremely delightful experience. However, this can quickly fade to despair when your keg runs dry. It becomes extremely easy to lose track of how much beer has been poured. In this tutorial, I'll demonstrate how to convert a simple electronic bathroom scale into a WiFi-enabled home kegerator scale so you'll always know how much is left on tap.
Full disclosure: The hardware setup for this build is based on the hookup guide provided by SparkFun.
The core of this project revolves around four load cell sensors. A load cell is used to create an electrical signal that can measure the pressure or force being applied to it.
You could purchase these load cells separately and build a platform to rest on top. But I found that hacking an existing bathroom scale contained all the needed parts and would save a good deal of time. I purchased the scale I have listed in the hardware components section for around $10 at Fry's. This particular scale works nicely, as I just needed a screwdriver to remove the back cover and then had access to the load cells and their wires.
After removing the cover panel, I disconnected all 12 wires from the controller board. I would recommend cutting each wire as far away from the load cells as possible. The more slack you can give yourself with each wire, the better.
Combinator BoardThe next step is to combine the four load cells into a standard four-wire Wheatstone bridge configuration, using the Load Sensor Combinator from SparkFun. This configuration allows for greater accuracy and a higher maximum load.
With no prior soldering experience, I found it quite difficult managing 12 wires in the small amount of retail space on this board. Having a helping hand would be nice here. Pay close attention to each grouping of load cell wires and soldering the positive, negative, and signal wires to the corresponding location on the combination board.
With the load cells alone, the change in resistance is very minute which impairs our ability to obtain an accurate reading. To get a more precise measurement, the signal must be amplified. This can be done with the HX711 Load Cell Amplifier from SparkFun.
The next step is to connect the four wire Wheatstone bridge configuration from the load cell combinator to the amplifier. This is pretty straightforward and should just entail wiring up the corresponding color combinations (RED->RED, BLK->BLK, etc.).
NodeMCU ESP8266The last piece of hardware needed is a microcontroller to interface with the HX711 amplifier. This can certainly be done with an Arduino Uno or Raspberry Pi. However, I wanted the ability to not just read a scale measurement but also send this measurement data to an external endpoint. The NodeMCU ESP8266 fit this bill perfectly, especially priced at under $9.
This development board is powered by a micro-USB port, has 16 GPIO pins, and is compatible with the Arduino IDE. But the key feature is the built-in WiFi circuit, making this a great choice for any IoT project.
To connect the HX711 amplifier to the NodeMCU ESP8266, we just need to power the amplifier (VCC->3v3, GND->GND) and then connect the DAT and CLK pins to any available GPIO pins. I've used GPIO pins 4 and 5, respectfully.
CalibrationTo interpret any meaningful readings, the scale must be calibrated. This involves two scale measurements: an initial zero factor with no weight on the scale (offset); and a measurement against a known weight (multiplier).
SparkFun has made calibrating and reading the scale measurements quite easy with their GitHub repo.
Data UploadThe last step to make this a true IoT device is to publish the scale measurement readings to an external endpoint. Using the WiFiClient class available within the ESP8266WiFi library, we can set the available WiFi network Id and password, create a HTTP request containing the scale measurement, and then send it off! Thingspeak is a great resource to quickly setup an endpoint where data can be sent. The Wifi sketch in my GitHub repo demonstrates the full cycle of taking the scale measurement and uploading the data, pausing for 60 seconds, and then doing it all again.
Combining this scale measurement along with knowing the empty weight of my keg, I can determine exactly how much beer I have left on tap! Sprinkle in a little web design, and this is how TilleyTap.com came to be.
Comments