Two HX711 Load Cell Amplifiers on Pico

I am trying to use two HX711 load cell amplifiers to connect two load cells to one Raspery Pi Pico.

By using the HX711 library and sample code at

I have been able to independently set up and calibrate each load cell/HX711 combination using a 686 g test weight.

The load cell amplifiers were connected (one at a time) as follows:

LC1 Dout – GPIO21 Sclk GPIO20
then
LC2 Dout – GPIO11 Sclk GPIO10

Aaron (Core Electronics) has suggested that I modify the Core sample code as follows to use both LC1 and LC2 concurrently.

from machine import Pin
from Makerverse_hx710c import Makerverse_hx710c
from time import sleep_ms

LC1 = Makerverse_hx710c(dataPin = Pin(21), clkPin = Pin(20), calibration=0.001393792)
LC2 = Makerverse_hx710c(dataPin = Pin(11), clkPin = Pin(10), calibration=0.001417685)

while True:
Data1 = LC1.read_hx710_calibrated()
print(“{:+.3f} g1”.format(Data1))

Data2 = LC2.read_hx710_calibrated()
print("{:+.3f} g2".format(Data2))

sleep_ms(90)

Using the 686g test weight I get the following results.

Actual Weight on Load Cell Reported Weight
LC1 LC2 LC1 LC2
0 0 -161 0
686 0 -161 0
0 686 +513 +686

LC2 is working correctly but LC1 is not. If I subsequently disable each HX711 in turn (remove Vcc and Grd connections) the other one again works correctly.

Help is requested to get both load cells reporting correctly.

2 Likes

My results table lost its formatting when posted. It should look more like the following.

Results

The problem I am having seems to be that experienced in the following post.

Any help to resolve this would be appreciated.

Fred

2 Likes

Hi Fred,

Awesome project!

The Makerverse Load cell uses the Picos PIO behind the scenes.
You’ll have to specify a different state machine for each:

from machine import Pin
from Makerverse_hx710c import Makerverse_hx710c
from time import sleep_ms

LC1 = Makerverse_hx710c(dataPin = Pin(21), clkPin = Pin(20), calibration=0.001393792)
LC2 = Makerverse_hx710c(dataPin = Pin(11), clkPin = Pin(10),stateMachine = 1,  calibration=0.001417685)

The code above should work.

3 Likes

Liam,

Yes that’s all it needed. Now working perfectly.
Thanks very much for your help.
What a great forum!

Regards,

Fred

4 Likes

Hi Fred,

Great to hear! No worries at all :smiley:

Keen to see what you make!

1 Like

Why are you using two HX711s? Are the two load cells supporting the same platform? If so then you can just connect both load cells to the same HX711.

John,

I am wanting to measure two independent loads so believe I have to use two HX711s.

Regards,

Fred

1 Like