Quería crear una escala de 10-200 lbs usando una celda de carga FX1901-200 lbs ( enlace ), un HX711 a prueba de chispas (solo el chip cableado en una placa) y un cero de frambuesa para que eso suceda. Así que lo conecté de esta manera (intenté conectar el amarillo a ylw, pero eso no funcionó en absoluto, pero también funciona en grn, también blanco entre la frambuesa y el chip se va al suelo, es un poco del centro) :
Ycorrióestecódigo:
#!/usr/bin/python3fromhx711importHX711importsysimportRPi.GPIOasGPIOimportmathimportstatisticsimportosimportdatetimetry:print("connecting")
hx711 = HX711(
dout_pin=23,
pd_sck_pin=24,
channel='A',
gain=64
)
print("resetting")
result =hx711.reset() # Before we start, reset the HX711 (not obligate)
if result:
print("success")
else:
print("failure")
raise ValueError("")
print("connected")
while(True):
measures = hx711.get_raw_data()
mea=sorted(measures)[2]/10000
mea=int(mea)
#val=math.floor( math.log(abs(measures[0]))*10.0 )
val=measures
print(str(mea) + "\t" + str(val) + "\t\t\t"+str(datetime.datetime.now()))
print("█"*(int(mea/5)))
finally:
GPIO.cleanup() # always do a GPIO cleanup in your scripts!
print("cleaning up")
Pero las lecturas que recibo son terriblemente inconsistentes y tan pronto como se aplican más de ~ 90 libras de presión, el tipo de celda se bloquea y solo da lecturas negativas sin importar la carga:
connecting
resetting
success
connected
15 [315807, 158020, 78229, 78288, 6541823] 2018-12-18 18:48:43.137149
███
WARNING:root:setting gain and channel took more than 60µs. Time elapsed: 0.00012506
31 [156657, 318123, 318723, 318713, 159441] 2018-12-18 18:48:45.787850
██████
20 [157779, 319793, 320439, 192117, 209145] 2018-12-18 18:48:48.011792
████
43 [437001, 258052, 7888895, 5570559, 154869] 2018-12-18 18:48:49.244843
████████
37 [1907415, 373321, 170746, 220077, 466669] 2018-12-18 18:48:51.051037
███████
28 [467875, 234919, 256529, 285642, 287557] 2018-12-18 18:48:52.676789
█████
35 [550539, 549965, 276906, 352081, 278266] 2018-12-18 18:48:54.303139
███████
12 [127284, 126625, 125814, 124966, -6553601] 2018-12-18 18:48:55.640389
██
23 [246439, 239414, 115064, 228829, 447631] 2018-12-18 18:48:57.266976
████
44 [445075, 442543, 440237, 219052, 105688] 2018-12-18 18:48:58.099545
████████
40 [211267, 411997, 410381, 408623, 407239] 2018-12-18 18:48:58.943753
████████
39 [406205, 809083, 98400, 196181, 390213] 2018-12-18 18:49:00.173517
███████
55 [194594, 240565, 550689, 553729, 555229] 2018-12-18 18:49:01.413470
███████████
28 [556783, 280107, 281821, 284658, 141996] 2018-12-18 18:49:03.029772
█████
28 [284305, 289232, 287863, 583893, 603753] 2018-12-18 18:49:05.147853
█████
WARNING:root:setting gain and channel took more than 60µs. Time elapsed: 0.00012802
-2 [607129, -24488, 1769471, -23315, -21833] 2018-12-18 18:49:08.060169
-1 [-14672, -16817, -16036, -12625, 16747] 2018-12-18 18:49:10.967555
0 [17259, 18535, -10735, -2043905, -9326] 2018-12-18 18:49:15.874284
0 [-9208, -8518, -8756, -9313, -11094] 2018-12-18 18:49:17.532877
-1 [-18885, -18693, -18598, -19075, -18987] 2018-12-18 18:49:19.369511
-1 [-19012, -19027, -18971, -18952, -18915] 2018-12-18 18:49:21.070971
-1 [-18902, -18862, -18876, -18984, -19028] 2018-12-18 18:49:22.059373
-1 [-19039, -19050, -19064, -19030, -19007] 2018-12-18 18:49:22.681170
-1 [-19078, -19127, -19118, -19085, -19022] 2018-12-18 18:49:24.025283
-1 [-19015, -19219, -19203, -19185, -19209] 2018-12-18 18:49:25.546960
-1 [-19212, -19233, -19203, -19213, -19266] 2018-12-18 18:49:27.237327
-1 [-19309, -19352, -19346, -19336, -19342] 2018-12-18 18:49:28.403525
-1 [-19392, -19407, -19307, -19265, -19180] 2018-12-18 18:49:29.571867
-2 [-4894, -8942, -23532, -23257, -22924] 2018-12-18 18:49:32.612460
-2 [-23036, -22834, -26684, -27857, -27999] 2018-12-18 18:49:34.123481
-2 [-28268, -28577, -28627, -28630, -28401] 2018-12-18 18:49:34.934208
-2 [-28107, -27639, -27481, -27301, -27442] 2018-12-18 18:49:35.733815
-2 [-30676, -29016, -28033, -27867, -27800] 2018-12-18 18:49:37.791934
¿Alguien tiene alguna idea de lo que podría estar haciendo mal? Hace una especie de trabajo con pequeñas fuerzas hasta alrededor de 70-80, pero a veces sigue siendo negativo total y aproximadamente la mitad de las lecturas son completamente aleatorias.