The HX711 is a precision 24-bit analog-to-digital converter (ADC) designed for weigh scales and industrial control applications to interface directly with a bridge sensor. It offers high-accuracy and low-cost solutions for applications requiring precise weight measurements. This module typically finds use in projects involving load cells, strain gauges, and force sensors.
Features of hx711
- High Resolution: The HX711 ADC provides 24-bit resolution, allowing for precise measurements of small changes in weight or force.
- Bridge Sensor Interface: It is specifically designed to interface with bridge sensors such as load cells and strain gauges. These sensors typically generate a small electrical signal proportional to the applied force or weight, and the HX711 amplifies and digitizes this signal for processing.
- Two-Channel Differential Input: The HX711 has two differential input channels, allowing it to read signals from two sensors simultaneously or to implement differential measurements for improved noise rejection.
- Programmable Gain Amplifier (PGA): The module includes a programmable gain amplifier with selectable gain settings, allowing users to adjust the amplification factor according to the specific requirements of their application.
- Serial Interface: Communication with the HX711 is typically done via a simple serial interface, such as SPI (Serial Peripheral Interface) or a custom protocol. This makes it easy to interface with microcontrollers and other digital devices.
- Low Noise Amplification: The HX711 incorporates low noise amplification circuitry to ensure accurate measurements even in noisy environments.
- Applications: Apart from weigh scales and industrial control applications, the HX711 can be used in various projects requiring precise analog-to-digital conversion, such as data logging, process control, and instrumentation.
- Availability: The HX711 is widely available as a small module that can be easily integrated into electronic projects. It is often sold with breakout boards for convenient connection and usage.
Pinouts for HX 711
Weighing scale using HX711 and ESP32
ESP32:The ESP32 is a powerful and versatile microcontroller developed by Espressif Systems. It features a dual-core processor, Wi-Fi and Bluetooth connectivity, numerous I/O pins, and a wide range of peripherals, making it suitable for a variety of IoT (Internet of Things) and embedded projects.
Hardware Setup
- Connect the HX711 module to the ESP32. The HX711 typically communicates via Serial protocol, so connect its data (DT) and clock (SCK) pins to suitable GPIO pins on the ESP32.
- Connect the load cell or strain gauge to the HX711. The load cell typically has four wires (red, black, green, white) where red and black are power and ground, and green and white are signal wires. Connect these to the appropriate pins on the HX711 module.
- Interface LCD with ESP32 and display the weight on it
- Connect pushbutton to tare the weight.
Schematic for hx711 and ESP32 based Weigh Scale
Code for hx711 and ESP32 based Weigh Scale
Include the HX711_ADC and liquidCrystal Library in the Project.
#include "HX711_ADC.h"
#include <LiquidCrystal.h>
LiquidCrystal lcd(23, 22, 5, 17, 16, 4);
HX711_ADC LoadCell(19, 18);
int tare = 25;
const float overload = 4500.0;
void setup()
{
Serial.begin(9600);
pinMode (tare, INPUT_PULLUP);
LoadCell.begin();
LoadCell.start(1000);
LoadCell.setCalFactor(0.42);
lcd.begin(16, 2);
lcd.clear();
lcd.print("Weighing Scale");
}
void loop() {
LoadCell.update();
float i = LoadCell.getData();
Serial.println(i);
if ( i < overload)
{
lcd.setCursor(1, 1);
lcd.print(i,0);
lcd.print(" g ");
}
else
{
lcd.setCursor(1, 1);
lcd.print("Over Load");
}
if (digitalRead (tare) == LOW)
{
lcd.clear();
lcd.setCursor(3, 0);
lcd.print("Taring----");
LoadCell.start(1000);
delay(200);
lcd.clear();
lcd.print("Weighing Scale");
}
delay(100);
}
YouTube Video :