@@ -38,12 +38,21 @@ If problems occur or there are questions, please open an issue at GitHub.
3838
3939### 10 or 80 SPS
4040
41- The datasheet mentions that the HX711 can run at 80 samples per second SPS.
41+ The datasheet mentions that the HX711 can run at 80 samples per second ( SPS) .
4242To select this mode connect the ** RATE** pin(15) of the chip to VCC (HIGH).
4343Connecting ** RATE** to GND (LOW) gives 10 SPS.
4444
45+ Having the RATE set to 10 or 80 SPS also changes the time to start up.
46+ At 10 SPS it takes 400 milliseconds, at 80 SPS it takes 50 milliseconds.
47+
4548All breakout boards I tested have ** RATE** connected to GND and offer no
4649pin to control this from the outside.
50+ Adafruit however has a breakout board with ** RATE** exposed.
51+ See https://www.adafruit.com/product/5974
52+ There might be more.
53+
54+ If you have the schema of your board you should be able to expose the ** RATE**
55+ pin, e.g. by removing the pull down resistor to GND.
4756
4857This library provide experimental means to control the ** RATE** , see below.
4958
@@ -71,6 +80,9 @@ Load cells go to very high weights, this side sells them up to 200 ton.
7180Never seen one and cannot tell if it will work with this library.
7281- https://stekon.nl/load-cells
7382
83+ Breakout with RATE exposed by ADAfruit
84+ - https://www.adafruit.com/product/5974
85+
7486
7587### Faulty boards
7688
@@ -111,17 +123,23 @@ is more math involved for converting raw data to weights.
111123- ** HX711_MP(uint8_t size)** constructor.
112124Parameter sets the size of for the calibration arrays.
113125Allowed range for size is 2..10.
114- - ** ~ HX711_MP()**
115- - ** void begin(uint8_t dataPin, uint8_t clockPin, bool fastProcessor = false)** sets a fixed gain 128 for now.
116- The fastProcessor option adds a 1 uS delay for each clock half-cycle to keep the time greater than 200 nS.
117- - ** void reset()** set internal state to start condition.
118- Reset also does a power down / up cycle.
119- It does not reset the calibration data.
126+ - ** ~ HX711_MP()** destructor.
127+ - ** void begin(uint8_t dataPin, uint8_t clockPin, bool fastProcessor = false, bool doReset = true)** sets a fixed gain 128 for now.
128+ - The parameter fastProcessor adds a 1 uS delay for each clock half-cycle to keep the time greater than 200 nS.
129+ - The parameter doReset is experimental in 0.6.3.
130+ It defaults to true (== backwards compatible) causing a call to reset(), taking extra time
131+ before the device is ready to make new measurements. See reset() below.
132+ Note that not calling reset() leaves the ADC in the previous or even an undefined state,
133+ so use with care. (needs testing)
134+ - ** void reset()** set internal state to the start condition.
135+ Reset() also does a power_down() / power_up() cycle.
136+ This cycle adds a delay of 400 (RATE = 10 SPS) or 50 (RATE = 80 SPS) milliseconds.
137+ Reset() does not reset the calibration data.
120138
121139
122140### isReady
123141
124- Different ways to wait for a new measurement.
142+ There are different ways to wait for a new measurement.
125143
126144- ** bool is_ready()** checks if load cell is ready to read.
127145- ** void wait_ready(uint32_t ms = 0)** wait until ready, check every ms.
@@ -131,7 +149,10 @@ Different ways to wait for a new measurement.
131149
132150### Read
133151
134- - ** float read()** raw read.
152+ Warning: the read calls are blocking calls, which can take up to 400 ms in the first read() call.
153+ Best practice is to check with isReady() before calling read().
154+
155+ - ** float read()** get a raw read.
135156- ** float read_average(uint8_t times = 10)** get average of times raw reads. times = 1 or more.
136157- ** float read_median(uint8_t times = 7)** get median of multiple raw reads.
137158times = 3..15 - odd numbers preferred.
@@ -253,6 +274,10 @@ This way of calibration allows:
253274It should reset the HX711 to defaults but this is not always seen.
254275See discussion issue #27 GitHub. Needs more testing.
255276
277+ Note: Having the RATE set to 10 or 80 SPS changes the time to start up.
278+ At 10 SPS it takes 400 milliseconds, at 80 SPS it takes 50 milliseconds.
279+ (See datasheet, Output settling time on page 3)
280+
256281
257282### Rate
258283
@@ -301,34 +326,70 @@ Another way to handle this is to add a good temperature sensor
301326differences in your code.
302327
303328
304- ## Future
329+ ## Multiple HX711
330+
331+
332+ ### Separate lines
333+
334+ Simplest way to control multiple HX711's is to have a separate ** DOUT** and ** CLK**
335+ line for every HX711 connected.
336+
337+
338+ ### Multiplexer
339+
340+ Alternative one could use a multiplexer like the https://github.com/RobTillaart/HC4052
341+ or possibly an https://github.com/RobTillaart/TCA9548 .
342+ Although to control the multiplexer one need some extra lines and code.
343+
344+
345+ ### Share CLOCK line
305346
306- Points from HX711 are not repeated here
347+ See ** HX_loadcell_array.ino **
307348
349+ Another way to control multiple HX711's is to share the ** CLK** line.
350+ This has a few side effects which might be acceptable or not.
351+
352+ Known side effects - page 4 and 5 datasheet.
353+
354+ - The ** CLK** is used to select channel and to select gain for the NEXT sample.
355+ - The ** CLK** is used for power down.
356+ - After wake up after power down all HX711's will reset to channel A and gain 128.
357+ ** WARNING:** if one of the objects does a ** powerDown()** or ** reset()** it resets its internal states.
358+ The other objects however won't reset their internal state, so a mismatch can occur.
359+
360+ So in short, sharing the ** CLK** line causes all HX711 modules share the same state.
361+ This can introduce extra complexity if one uses mixed gains or channels.
362+ If all HX711's use the same settings it should work, however extra care is needed for
363+ ** powerDown()** and ** reset()** .
364+
365+ ** WARNING: Sharing the data lines is NOT possible as it could cause short circuit.**
366+
367+ See https://github.com/RobTillaart/HX711/issues/40
368+
369+
370+ ## Future
371+
372+ Points from HX711 are not all repeated here
308373
309374#### Must
310375
311- - keep in sync with HX711 library where relevant.
312376- update documentation
377+ - keep in sync with HX711 library.
313378
314379#### Should
315380
316- - test a lot
317- - different load cells.
318381- investigate interpolation beyond calibration range.
319- - add examples
320- - runtime changing of the mapping.
321382- investigate malloc/free for the mapping arrays
322- - add performance figures
323383- Calibration
324384 - Returns 0 is index is out of range ==> NaN ?
325- - add rate example
326385
327386#### Could
328387
329388- add error handling?
330389 - HX711_INDEX_OUT_OF_RANGE
331- - ??
390+ - add examples
391+ - runtime changing of the mapping.
392+ - example for using rate functions.
332393- investigate temperature compensation.
333394
334395#### Wont
0 commit comments