2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
[![Arduino CI](https://github.com/RobTillaart/HX711/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
|
|
|
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/HX711/blob/master/LICENSE)
|
|
|
|
[![GitHub release](https://img.shields.io/github/release/RobTillaart/HX711.svg?maxAge=3600)](https://github.com/RobTillaart/HX711/releases)
|
|
|
|
|
|
|
|
|
|
|
|
# HX711
|
|
|
|
|
|
|
|
Arduino library for HX711 24 bit ADC used for load cells and scales.
|
|
|
|
|
2021-02-06 09:52:51 -05:00
|
|
|
|
|
|
|
## Description
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
This HX711 library has an interface which is a superset of a library made by bogde.
|
|
|
|
Some missing functions were added to get more info from the lib.
|
|
|
|
|
|
|
|
Another important difference is that this library uses floats. The 23 bits mantisse
|
|
|
|
of the IEE754 float matches the 24 bit ADC very well. Furthermore it gave a smaller
|
|
|
|
footprint.
|
|
|
|
|
|
|
|
|
2021-02-06 09:52:51 -05:00
|
|
|
## Main flow
|
|
|
|
|
|
|
|
First action is to call **begin(dataPin, clockPin)** to make connection to the **HX711**.
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
Second step is callibration for which a number of functions exist.
|
|
|
|
- **tare()** measures zero point
|
|
|
|
- **set_scale(factor)** set a known conversion factor e.g. from EEPROM.
|
|
|
|
- **callibrate_scale(WEIGHT, TIMES)** determines the scale factor based upon a known weight e.g. 1 Kg.
|
|
|
|
|
|
|
|
Steps to take for callibration
|
|
|
|
1. clear the scale
|
|
|
|
1. call tare() to set the zero offset
|
|
|
|
1. put a known weight on the scale
|
|
|
|
1. call callibrate_scale(weight)
|
|
|
|
1. scale is calculated.
|
|
|
|
1. save the offset and scale for later use e.g. EEPROM.
|
|
|
|
|
|
|
|
|
2021-02-06 09:52:51 -05:00
|
|
|
## Pricing
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
Some price functions were added to make it easy to use this library
|
|
|
|
for pricing goods or for educational purposes. These functions are under discussion
|
|
|
|
if they will stay. Another set of function to add weights together didn't make it in
|
|
|
|
the 0.2.0 release, it is on a todo list.
|
|
|
|
|
|
|
|
For weight conversion functions see https://github.com/RobTillaart/weight
|
|
|
|
|
2021-02-06 09:52:51 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
## Notes
|
|
|
|
|
2021-02-06 09:52:51 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
### Scale values for loadcells
|
|
|
|
|
|
|
|
These scale values worked pretty well with a set of loadcells,
|
|
|
|
Use callibrate to find your values.
|
|
|
|
|
|
|
|
- 5 KG loadcell scale.set_scale(420.52);
|
|
|
|
- 20 KG loadcell scale.set_scale(127.15);
|
|
|
|
|
2021-02-06 09:52:51 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
### Connections HX711
|
|
|
|
|
|
|
|
- A+/A- uses gain of 128 or 64
|
|
|
|
- B+/B- uses gain of 32
|
|
|
|
|
2021-02-06 09:52:51 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
### Connections
|
|
|
|
|
|
|
|
| HX711 Pin | Color |
|
|
|
|
|:----:|:----:|
|
|
|
|
| E+ | red |
|
|
|
|
| E- | black |
|
|
|
|
| A- | white |
|
|
|
|
| A+ | green |
|
|
|
|
| B- | not connected |
|
|
|
|
| B+ | not connected |
|
|
|
|
|
|
|
|
|
|
|
|
| HX711 Pin | Color |
|
|
|
|
|:----:|:----:|
|
|
|
|
| E+ | red |
|
|
|
|
| E- | black |
|
|
|
|
| A- | blue |
|
|
|
|
| A+ | white |
|
|
|
|
| B- | not connected |
|
|
|
|
| B+ | not connected |
|
|
|
|
|
2021-02-06 09:52:51 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
## Operation
|
|
|
|
|
|
|
|
See examples
|