> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/wokwi/wokwi-docs/llms.txt
> Use this file to discover all available pages before exploring further.

# HX711 Load Cell Amplifier

> HX711 Load Cell Amplifier for reading load cells and strain gauges

HX711 Load Cell Amplifier.

## Pins

<ParamField path="VCC" type="power">
  Voltage supply (5V)
</ParamField>

<ParamField path="DT" type="data">
  Serial data
</ParamField>

<ParamField path="SCK" type="clock">
  Serial clock
</ParamField>

<ParamField path="GND" type="ground">
  Ground
</ParamField>

<Note>
  The `E+`/`E-`/`A+`/`A-`/`B+`/`B-` pins are non-interactive and rendered based on attributes.
</Note>

## Attributes

<ParamField path="type" type="string" default="50kg">
  Either "50kg" (default), "5kg", or "gauge"
</ParamField>

### Examples

| Result     | Attrs                 |
| ---------- | --------------------- |
| 5kg scale  | `{ "type": "5kg" }`   |
| 50kg scale | `{ "type": "50kg" }`  |
| Gauge only | `{ "type": "gauge" }` |

## Operation

The HX711 amplifier allows you to easily read load cells and evaluate changes in resistance. A Wheatstone bridge is used to connect load cells to the IC, which is in turn connected to the microcontroller via `VCC`, `DT`, `SCK`, and `GND`. Use `begin()` to initialize the scale and `set_scale()` and `tare()` to calibrate it. `power_down()` and `power_up()` can be used to bring the ADC into and out of low power mode. `get_value()` and `get_units()` are used to read the ADC minus tare and divided, passing an optional integer value to obtain that number of values, averaged. Refer to the [`HX711` Arduino library](https://github.com/bogde/HX711#features) for more details on features and calibration.

<Note>
  This chip does not implement channel B or gain settings of 32/64/128. The raw readings are from `0-2100` for the `"type":"5kg"` type, and `0-21000` for the `"type":"50kg"`.
</Note>

## Arduino code example

```cpp theme={null}
#include "HX711.h"

HX711 scale;

void setup() {
  Serial.begin(9600);
  Serial.println("Initializing the scale");
  scale.begin(A1, A0);
}

void loop() {
  Serial.println(scale.get_units(), 1);
  delay(1000);
}
```

Try [this example on Wokwi](https://wokwi.com/projects/345134808605655636)

## Automation controls

The HX711 can be controlled using [Automation Scenarios](/wokwi-ci/automation-scenarios). It exposes the following controls:

| Control | Type  | Description                             |
| ------- | ----- | --------------------------------------- |
| load    | float | Set the load value of the scale (in kg) |

## Simulator examples

* [HX711 demo](https://wokwi.com/projects/344192176616374868)
* [Digital scale](https://wokwi.com/projects/336613701830312531)
* [HX711\_ADC Calibration demo](https://wokwi.com/projects/407626388355231745)
