# How to use the HX711 24 bit ADC for weight scales?

**URL:** <https://www.thethingsnetwork.org/forum/t/how-to-use-the-hx711-24-bit-adc-for-weight-scales/5850>\
**Category:** End Devices (Nodes)\
**Created:** [March 5, 2017, 12:14pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-use-the-hx711-24-bit-adc-for-weight-scales/5850 "2017-03-05T12:14:48Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [March 5, 2017, 3:52pm UTC](https://www.thethingsnetwork.org/forum/t/how-to-use-the-hx711-24-bit-adc-for-weight-scales/5850/7 "2017-03-05T15:52:51Z")

</div>

> Max. 150kg &nbsp; &nbsp; d = 100g

For this, it would probably suffice to multiply a reading in kilograms by 10, hence preserving 1 decimal, as the accuracy is just 100 gram or 0.1 kg anyway.

But multiplying by 10 would allow an unsigned 16 bits integer to hold a maximum of 6553.5 kg, which is way above the scale’s maximum. So, if the float reading is in kilograms, one could still preserve 2 decimals (multiply by 100, just like in the code above), yielding a maximum of 655.35 kg which is still way above the scale’s maximum. A single 8 bits byte, with a maximum of 255, would be too small to hold the maximum of 149.9 kg with one decimal though.

To detect negative weight values (probably indicating a calibration error), it’s even better to send a 16 bits _signed_ integer (`int16_t`), which supports -32768 up to 32767, hence a maximum of 327.67 kg with two decimals. Like noted earlier, that needs [sign extension when decoding negative values](https://www.thethingsnetwork.org/forum/t/decrypting-messages-for-dummies/4894/4) in a payload function.

---

_[View the full topic](https://www.thethingsnetwork.org/forum/t/how-to-use-the-hx711-24-bit-adc-for-weight-scales/5850)._
