@@ -29,7 +29,7 @@ This translates roughly to 4 or max 5 significant digits in a single measurement
29
29
That's why multiple measurements are advised to average and reduce the noise.
30
30
31
31
32
- #### Breaking change 0.3.0
32
+ ### Breaking change 0.3.0
33
33
34
34
In issue #11 it became clear that the timing of the default ** shiftIn()** function to
35
35
read the value of the internal ADC was too fast on some processor boards for the HX711.
@@ -44,7 +44,7 @@ Drawback is that reading the HX711 takes an extra 50-55 microseconds.
44
44
How much this affects performance is to be investigated.
45
45
46
46
47
- #### HX711_MP
47
+ ### HX711_MP
48
48
49
49
- https://github.com/RobTillaart/HX711_MP
50
50
@@ -61,7 +61,7 @@ This multi-point calibration allows to compensate for non-linear behaviour
61
61
in the sensor readings.
62
62
63
63
64
- #### 10 or 80 SPS
64
+ ### 10 or 80 SPS
65
65
66
66
The datasheet mentions that the HX711 can run at 80 samples per second SPS.
67
67
To select this mode connect the ** RATE** pin(15) of the chip to VCC (HIGH).
@@ -75,12 +75,17 @@ If there is a need (issue) I will implement this in the library.
75
75
For now one can add an IOpin for this and use ** digitalWrite()** .
76
76
77
77
78
- #### Related
78
+ ### Related
79
79
80
80
- https://github.com/bogde/HX711
81
81
- https://github.com/RobTillaart/weight (conversions kg <> stone etc.)
82
82
- https://github.com/RobTillaart/HX711
83
- - https://github.com/RobTillaart/HX711_MP
83
+ - https://github.com/RobTillaart/HX711_MP multipoint calibration version.
84
+
85
+
86
+ ### Faulty boards
87
+
88
+ - https://forum.arduino.cc/t/load-cell-amplifier-hx711-wrong-ground/1046075
84
89
85
90
86
91
## Main flow
@@ -107,14 +112,18 @@ Steps to take for calibration
107
112
#include " HX711.h"
108
113
```
109
114
110
- #### Base
115
+ ### Constructor
111
116
112
117
- ** HX711()** constructor.
113
118
- ** ~ HX711()**
114
119
- ** void begin(uint8_t dataPin, uint8_t clockPin, bool fastProcessor)** sets a fixed gain 128 for now.
115
120
The fastProcessor option adds a 1 uS delay for each clock half-cycle to keep the time greater than 200 nS.
116
121
- ** void reset()** set internal state to start condition.
117
122
Since 0.3.4 reset also does a power down / up cycle.
123
+
124
+
125
+ ### Read
126
+
118
127
- ** bool is_ready()** checks if load cell is ready to read.
119
128
- ** void wait_ready(uint32_t ms = 0)** wait until ready, check every ms.
120
129
- ** bool wait_ready_retry(uint8_t retries = 3, uint32_t ms = 0)** wait max retries.
@@ -130,7 +139,7 @@ The weight alpha can be set to any value between 0 and 1, times >= 1.
130
139
- ** uint32_t last_read()** returns timestamp in milliseconds of last read.
131
140
132
141
133
- #### Gain + channel
142
+ ### Gain + channel
134
143
135
144
Use with care as it is not 100% reliable - see issue #27 . (solutions welcome).
136
145
@@ -169,13 +178,13 @@ as the datasheet states it should be. So use with care. (feedback welcome)
169
178
See discussion #27 .
170
179
171
180
172
- #### Mode
181
+ ### Read mode
173
182
174
183
Get and set the operational mode for ** get_value()** and indirect ** get_units()** .
175
184
176
185
Constants (see .h file)
177
186
178
- - ** HX711_RAW_MODE** new in 0.3.3
187
+ - ** HX711_RAW_MODE**
179
188
- ** HX711_AVERAGE_MODE**
180
189
- ** HX711_MEDIAN_MODE**
181
190
- ** HX711_MEDAVG_MODE**
@@ -193,7 +202,7 @@ to keep memory footprint relative low.
193
202
- ** uint8_t get_mode()** returns current set mode. Default is ** HX711_AVERAGE_MODE** .
194
203
195
204
196
- #### Get values
205
+ ### Get values
197
206
198
207
Get values from the HX711 corrected for offset and scale.
199
208
Note that in ** HX711_RAW_MODE** the times parameter will be ignored => just call ** read()** once.
@@ -203,11 +212,11 @@ Note that in **HX711_RAW_MODE** the times parameter will be ignored => just call
203
212
- ** bool set_scale(float scale = 1.0)** set scale factor which is normally a positive number larger than 50. Depends on load-cell used.
204
213
Returns false if scale == 0.
205
214
- ** float get_scale()** returns set scale factor.
206
- - ** void set_offset(long offset = 0)** idem.
207
- - ** long get_offset()** idem.
215
+ - ** void set_offset(int32_t offset = 0)** idem.
216
+ - ** int32_t get_offset()** idem.
208
217
209
218
210
- #### Tare & calibration I
219
+ ### Tare & calibration I
211
220
212
221
Steps to take for calibration
213
222
1 . clear the scale.
@@ -227,7 +236,7 @@ Assumes offset is not zero, which is true for all load cells tested.
227
236
- ** void calibrate_scale(uint16_t weight, uint8_t times = 10)** idem.
228
237
229
238
230
- #### Tare & calibration II
239
+ ### Tare & calibration II
231
240
232
241
A load cell + HX711 module without weight gives a raw value, mostly not equal to zero.
233
242
The function ** get_tare()** is used to measure this raw value and allows the user
@@ -248,7 +257,7 @@ Furthermore it is also important to do the calibration at the temperature you
248
257
expect to do the weight measurements. See temperature section below.
249
258
250
259
251
- #### Inner formula
260
+ ### Inner formula
252
261
253
262
Weight = ** get_scale()** x raw + ** get_tare()** .
254
263
@@ -258,7 +267,7 @@ This can be compared with actual values to get an indication
258
267
of the accuracy of the load cell.
259
268
260
269
261
- #### Power management
270
+ ### Power management
262
271
263
272
- ** void power_down()** idem. Explicitly blocks for 64 microseconds.
264
273
(See Page 5 datasheet).
@@ -267,7 +276,7 @@ It should reset the HX711 to defaults but this is not always seen.
267
276
See discussion issue #27 GitHub. Needs more testing.
268
277
269
278
270
- #### Pricing
279
+ ### Pricing
271
280
272
281
Some price functions were added to make it easy to use this library
273
282
for pricing goods or for educational purposes.
@@ -279,10 +288,31 @@ For weight conversion functions see https://github.com/RobTillaart/weight
279
288
- ** float get_unit_price()** idem.
280
289
281
290
291
+ ### Millivolts
292
+
293
+ ** Experimental**
294
+
295
+ To be verified in a test setup.
296
+
297
+ In issue #53 , a question was asked to convert the input of the HX711 to milivolts.
298
+ Thinking about this question resulted in a simple and imho an elegant idea:
299
+
300
+ - Apply 0.000 mV to the system.
301
+ - Call ** tare(times)** to calibrate the zero point.
302
+ - Then apply 20.000 mV to the system.
303
+ - Call ** calibrate_scale(20000)** to map the raw reading to 20000 µV = 20 mV.
304
+
305
+ Assuming the scale is linear, the HX711 now works like a millivolt meter.
306
+ And the ** float get_units(uint8_t times = 1)** will return microvolts.
307
+
308
+ In fact, one could map any linear unit this way, e.g. if the voltage applied
309
+ is linear with temperature, humidity or windspeed one can map this directly.
310
+
311
+
282
312
## Notes
283
313
284
314
285
- #### Scale values for load cells
315
+ ### Scale values for load cells
286
316
287
317
These scale values worked pretty well with a set of load cells I have,
288
318
Use calibrate to find your favourite values.
@@ -291,7 +321,7 @@ Use calibrate to find your favourite values.
291
321
- 20 KG load cell scale.set_scale(127.15);
292
322
293
323
294
- #### Connections HX711
324
+ ### Connections HX711
295
325
296
326
- A+/A- uses gain of 128 or 64
297
327
- B+/B- uses gain of 32
@@ -308,7 +338,7 @@ Colour scheme wires of two devices.
308
338
| B+ | not connected | not connected |
309
339
310
340
311
- #### Temperature
341
+ ### Temperature
312
342
313
343
Load cells do have a temperature related error. (see datasheet load cell)
314
344
This can be reduced by doing the calibration and take the tare
@@ -322,20 +352,20 @@ differences in your code.
322
352
## Multiple HX711
323
353
324
354
325
- #### Separate lines
355
+ ### Separate lines
326
356
327
357
Simplest way to control multiple HX711's is to have a separate ** DOUT** and ** CLK**
328
358
line for every HX711 connected.
329
359
330
360
331
- #### Multiplexer
361
+ ### Multiplexer
332
362
333
363
Alternative one could use a multiplexer like the https://github.com/RobTillaart/HC4052
334
364
or possibly an https://github.com/RobTillaart/TCA9548 .
335
365
Although to control the multiplexer one need some extra lines and code.
336
366
337
367
338
- #### Share CLOCK line
368
+ ### Share CLOCK line
339
369
340
370
See ** HX_loadcell_array.ino**
341
371
@@ -368,7 +398,6 @@ See https://github.com/RobTillaart/HX711/issues/40
368
398
- update documentation HX711
369
399
- keep in sync with HX711_MP
370
400
371
-
372
401
#### Should
373
402
374
403
- test B channel explicitly.
@@ -377,7 +406,6 @@ See https://github.com/RobTillaart/HX711/issues/40
377
406
- investigate the need of yield after interrupts
378
407
- investigate blocking loop at begin => less yield() calls ?
379
408
380
-
381
409
#### Could
382
410
383
411
- test different load cells
@@ -389,7 +417,6 @@ See https://github.com/RobTillaart/HX711/issues/40
389
417
- add ** setRate()** and ** getRate()** - sample rate 10/80 SPS
390
418
- optional?
391
419
392
-
393
420
#### Wont
394
421
395
422
- why store the gain as \_ gain while the iterations m = 1..3 is used most
0 commit comments