Mini Weight Unit (HX711)

via M5Stack
$7.57
SKU M5-U030
Description

WEIGHT intergrates an 24 bits A/D chip HX711 that is specifically designed for electronic weighing device.

The input multiplexer selects either Channel A or B differential input to the low-noise programmable gain amplifier (PGA). Channel A can be programmed with a gain of 128 or 64, corresponding to a full-scale differential input voltage of ±20mV or ±40mV respectively, when a 5V supply is connected to AVDD analog power supply pin. Channel B has a fixed gain of 32. There is no programming needed for the internal registers. All controls to the HX711 are through the pins.

In the test, we have this Unit channel A to connect a pressure sensor. Then use M5Core screen to display the weight data.

Product Features

  • Two selectable differential input channels
  • On-chip active low noise PGA with selectable gain of 32, 64 and 128
  • On-chip power supply regulator for load-cell and ADC analog power supply
  • On-chip oscillator requiring no external component with optional external crystal
  • On-chip power-on-reset
  • Simple digital control and serial interface: pin-driven controls, no programming needed
  • Selectable 10SPS or 80SPS output data rate
  • Simultaneous 50 and 60Hz supply rejection
  • Current consumption including on-chip analog power supply regulator: normal operation < 1.5mA, power down < 1uA
  • Operation supply voltage range: 2.6 ~ 5.5V
  • Operation temperature range: -40 ~ +85℃
  • 16 pin SOP-16 package
  • Program Platform: Arduino, UIFlow(Blockly, Python)
  • Two Lego-compatible holes

Kit includes

  • 1x WEIGHT Unit
  • 1x Grove Cable

Application

  • Micro weight meter
  • Kitchen Scale
Documents

Learn

Example

1. Arduino IDE

We used a pressure sensor(10kg) in this experiment. (Unit: gram)

To get complete code, please click here

/*
  This Unit connects to GRVOE B on M5Core.
*/

#include <M5Stack.h>
#include "hx711.h"

HX711 scale(36, 26);// GROVE B

void setup() {
  M5.begin();
  M5.Lcd.clear(BLACK);
  M5.Lcd.setTextSize(2);
  M5.Lcd.setTextColor(YELLOW);
  M5.Lcd.setCursor(50, 10);
  M5.Lcd.print("UNIT_WEIGHT EXAMPLE\n");
  M5.Lcd.setCursor(15, 50);
  M5.Lcd.print("Connect Unit to GROVE B");
  Serial.begin(115200);

  scale.setOffset(125184);
  scale.setScale(67.4);

  M5.Lcd.setCursor(0, 90);
  M5.Lcd.print("The weight: ");
}

void loop(){
  // Serial.println(scale.averageValue());
  float weight;
  weight = ((float)((int)((scale.getGram()+0.005)*100)))/100;
  // sprintf(&weight, "%0.2f", scale.getGram());
  Serial.print("The weight: ");
  Serial.print(weight);
  M5.Lcd.fillRect(150, 90, 100, 20, BLACK);
  M5.Lcd.setCursor(150, 90);
  M5.Lcd.print(weight);
  Serial.println(" g");
  delay(100);
}

2. UIFlow

To get complete code, please click here

More information

Schematic

Pinmap

If WEIGHT was connected to GROVE A

M5Core(GROVE A) GPIO22 GPIO21 5V GND
WEIGHT Unit DATA Pin (DAT) CLOCK Pin (CLK) 5V GND

If WEIGHT was connected to GROVE B

M5Core(GROVE B) GPIO36 GPIO26 5V GND
WEIGHT Unit DATA Pin (DAT) CLOCK Pin (CLK) 5V GND

If WEIGHT was connected to GROVE C

M5Core(GROVE C) GPIO16 GPIO17 5V GND
WEIGHT Unit DATA Pin (DAT) CLOCK Pin (CLK) 5V GND