Introduction
Welcome to the guide for the Makerverse Load Cell kit. With this hardware you will be able to make a set of scales capable of measuring weights up to 3kg with a precision as low as 0.1g!
To follow along you will need:
- The Makerverse Load Cell Kit
- The Makerverse Essentials Kit
- A soldering iron
- A computer capable of running Thonny (a desktop or laptop running Windows, MacOS, or Linux)
Kit Contents
Inside the Makerverse Load Cell Kit you should find:
- A Load Cell ADC module
- A 3kg Load Cell
- A Load Cell mounting kit
- A 50g calibration weight
- 4x Mounting screws
From the Essentials Kit you will need:
- The breadboard
- The Raspberry Pi Pico
- Several male-male jumper wires
- The Screwdriver
Load Cell Platform Assembly
To assemble the load cell platform grab the load cell, acrylic platform and bag of screws from the Load Cell Kit and the screwdriver from the Essentials kit.
The provided screws require the screwdriver bit labelled "PH2" - this is a so-called "No 2 Phillips". It is the largest of the "+" shaped driver bits. The driver bits are stored inside the screwdriver and can be removed by unscrewing the top end cap.
The Load Cell Mounting Kit contains two large platforms, four rubber feet, and four spacers. The spacers fit between the platforms and load cell to allow the platforms to flex slightly without touching the load cell. Two types of spacers are provided for compatibility with different load cells so align the spacers with the load cell's mounting holes to select the correct ones.
The laser-cut acrylic pieces are shipped with the backing paper still applied. This paper can be peeled off by using the included paper peeler's round edge to lift a corner of the paper, then finish peeling by hand. The flat edge can be used to scrape any small pieces of paper left after engraving - You can apply a significant pressure before the acrylic scratches itself so don't hold back while removing the fragments inside the Makerverse logo.
Just like the spacers, the platform pieces have two pairs of mounting holes for compatibility with two load cell types. Align the load cell with the pair of holes that fit.
Note that both the load cell and acrylic platform pieces have a "top" and "bottom". The acrylic platform with the Makerverse logo should be aligned so that it reads correctly when viewed from above. The holes in each platform piece are also "counterbored" - they have a large diameter hole about 1mm deep which allows the "countersunk" screw head to sit flush with the acrylic surface after being tightened.
The load cell has an arrow indicating the direction of force required for a positive measurement. This arrow should point towards the platform with the Makerverse logo (ie: placing a weight on the top results in a positive measurement). Furthermore, the mounting holes next to the arrow and 3kg rating label should be screwed to the top platform.
Place the correct spacers between the acrylic platform and the load cell, loosely screw the four mounting screws, and check the orientation against the photograph below:
With everything aligned correctly, the four screws can be hand tightened for a snug fit.
When screwed together, the assembled platform will have a "Z" or "S" shape when viewed side-on.
Flip the platform upside down and apply the four adhesive rubber feet.
Load Cell ADC Module Assembly and Pinout
Assembly of the Load Cell ADC module involves soldering the 4-pin header on the right side, facing down, and the 4-pin screw terminal to the left, facing up, as shown below.
The table below shows the pin assignment for the left side of the load cell ADC module. A small screw terminal block is provided to allow easy connection to a load cell with unterminated wires.
The provided load cell connects here, with the wire colours matching the colour labels on the pins.
In addition, two ground pins are provided so that load cells with shielded cables can have their shield connected and to allow easy mechanical mounting to a prototype board via header pins.
The ADC module is designed to operate with load cells with a nominal impedance of 1k Ohm.
Pin | Description |
Red | Low-noise +2.5V output, load cell positive supply voltage |
Black | Ground, 0V, load cell negative supply voltage |
White | Load cell negative signal output |
Green | Load cell positive signal output |
The right side of the module contains the main power pins (Vcc and GND) and digital interface (Dout and Sclk). The Vcc pin is designed for 3.3V and 5V operation while the MicroPython driver handles the digital interface.
More information about the digital interface can be found in the HX710C datasheet.
Pin | Description |
Vcc | Main supply voltage, 3.3V to 5.0V |
Dout | Digital output, serial interface data pin |
Sclk | Digital input, serial interface clock pin |
GND | Main supply voltage ground |
Once the headers are soldered the load cell can be connected to the screw terminal, aligning the colours indicated on the PCB. It is recommended that the load cell wires' stripped end be bent over so that the screw terminal clamps to both the bare wire and the insulation, increasing mechanical reliability.
Breadboard Assembly
For initial testing and basic use of the Load Cell ADC only four connections need to be made, listed in the table below:
Load Cell ADC Pin | Raspberry Pi Pico Pin |
Wire Colour in Image |
Vcc | 36 - 3V3(OUT) | Red |
Dout | 22 - GP17 | Brown |
Sclk | 21 - GP16 | Orange |
GND | 38 - GND | Black |
The Pico's pins listed above can be changed in code but connections made as shown allow the code below to run unmodified. The listed wire colours are purely a suggestion and are only listed to allow easier identification in the wiring diagram.
Download MicroPython Modules
Download the Makerverse Load Cell ADC driver module: Makerverse_hx710c.py (right-click, "Save Link As...")
Once downloaded, copy Makerverse_hx710c.py onto your Raspberry Pi Pico with Thonny.
A full description of all methods provided by this library can be found in the GitHub repository.
Running the Example Code
To get started reading values from the load cell ADC, copy and paste the following example into Thonny, save it to the Pico as example.py, then press ctrl+r to execute it:
from machine import Pin from Makerverse_hx710c import Makerverse_hx710c from time import sleep_ms LC = Makerverse_hx710c(dataPin = Pin(17), clkPin = Pin(16), calibration=1.4397e-3) while True: Data = LC.read_hx710_calibrated() print("{:+.3f} g".format(Data)) sleep_ms(90)
During execution it will print weight estimates in grams to the console at a rate of approximately 10 samples per second. The example screenshot below also includes the "plotter" which can be enabled from the menu item "View > Plotter".
Note that the sleep_ms(90) is not strictly required as the load cell ADC controls the sample rate. However, without an explicit call to sleep_ms() it can be very difficult to stop execution with ctrl+c.
Note that there will be a small amount (+/-0.5g or so) of drift over periods of minutes. To re-zero the scales you can stop and restart the program or add a "zero" button, documented below.
Weight Calibration
Every load cell will have a slightly different response to a given applied force so, for accurate measurements, your particular load cell needs to be calibrated against a known, high precision, reference mass.
Provided in the kit is a 50.00g calibration mass which we can use to calibrate our setup to within +/-0.1g precision.
Note, however, that +/-0.1g precision is only guaranteed under 50g. Above 50g the absolute error increases with the percentage error remaining at 0.2%.
The calibrate() method walks you through the calibration procedure with console output, but the steps are:
- Run the example code then stop it with ctrl+c
- Type "LC.calibrate()" in the Shell
- Remove anything from the load cell platform
- Press Enter - it will, by default, read 50 values and average them to obtain a high accuracy "zero" point
- Place the 50g calibration weight on the load cell platform
- Press Enter - again, 50 values will be read and averaged
- The text "The calibration value is: ..." will appear with a number after it. Copy this number into the "calibration= ..." keyword argument to Makerverse_hx710c()
With the calibration value entered, short-timespan changes in weight can be trusted to about 0.1g. Note that long term aging of the load cell and changes in temperature will require re-calibration to maintain this accuracy. For non-critical applications, accuracy can be trusted to about 0.5g.
Adding a Zero Button
Many weighing applications are made simpler when the "zero" weight can easily be set. For example, a recipe may require 100g of butter but the load cell would need to measure both the butter and the container it was measured into. By adding a "zero" button the zero weight can easily be set at any point. The container can be placed on the load cell platform, the zero button pushed, and then butter added until the measured weight was 100g.
To add a zero button grab a button and cap from the Essentials Kit and insert it into the breadboard as shown.
The switch will be wired such that pushing it connects +3.3V to GP18 while GP18 will be configured with a "pull-down". This results in a value of logic 1 being read if the switch is pressed and logic 0 otherwise.
The two extra wires are connected as follows:
- The button's left pin connects to Pico pin 36 - 3V3(OUT)
- The button's right pin connects to Pico pin 24 - GP18
Lastly, replace your code with the following:
from machine import Pin from Makerverse_hx710c import Makerverse_hx710c from time import sleep_ms LC = Makerverse_hx710c(dataPin = Pin(17), clkPin = Pin(16), calibration=1.4397e-3) zeroPin = Pin(18, Pin.IN, Pin.PULL_DOWN) while True: Data = LC.read_hx710_calibrated() print("{:+.3f} g".format(Data)) sleep_ms(90) if zeroPin.value() == 1: LC.setZero()
Observe that now a weight can be added to the load cell platform and pressing the zero button sets that weight to a reading of zero.
Controlling an LED With Pressure
There are many applications where measuring weight can be used as a "control input", not just a numerical weight measurements! Pressure on the load cell platform could control the pitch of a buzzer tone, a motor speed, open a gate for a robot, etc.
In this simple example we will use the Raspberry Pi Pico's PWM (pulse width modulation) hardware to control the brightness of an LED. For this we will need an LED of your choice and one 470 Ohm resisor from the Essentials Kit.
Connect the LED and resistor as shown below. The positive side of the LED (the anode, longer pin) connects to GP15 on the Pico, the negative (cathode) pin then connects to the adjacent empty breadboard row. The 470 Ohm resistor then completes the circuit from this empty row to a nearby GND pin.
With the LED inserted the code can be updated to that below:
from machine import Pin, PWM from Makerverse_hx710c import Makerverse_hx710c from time import sleep_ms LC = Makerverse_hx710c(dataPin = Pin(17), clkPin = Pin(16), calibration=0.001400719) zeroPin = Pin(18, Pin.IN, Pin.PULL_DOWN) led = PWM(Pin(15)) # Pulse-Width Modulation to control LED brightness while True: Data = LC.read_hx710_calibrated() duty = int(Data*64) # Scale 0-1023 grams to 0-65535 PWM # Restrict duty to 0-65534 if duty < 0: duty = 0 if duty > 65534: duty = 65534 led.duty_u16(duty) # Update LED brightness print("{:+.3f} g".format(Data)) # prints with a +/- sign to 3-decimal places sleep_ms(80) if zeroPin.value() == 1: LC.setZero()
The PWM object takes a value between 0 (off) and 65535 (fully on) so the code multiplies the weight in grams by 64 to create a PWM value. This scales 0g to off and roughly 1000g to full brightness. There is also code that restricts the PWM value so that it cannot go outside 0 and 65535, which would cause unpredictable LED brightness.
Conclusion
We hope you've enjoyed building this kit and encourage you to continue experimenting with new ideas. Maybe you can add a numeric display to make standalone scales, use the load cell to measure water in a rain gauge, or even make a pressure-sensitive musical instrument!
If you make something cool we'd love for you to share it on our forums! And if you'd like some help with this guide, start the conversation below - We're full-time makers and here to help!