Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HX710B Pressure Sensor #101

Open
arcostasi opened this issue Aug 2, 2021 · 2 comments
Open

HX710B Pressure Sensor #101

arcostasi opened this issue Aug 2, 2021 · 2 comments
Assignees
Labels
open for vote Vote at https://wokwi.com/features

Comments

@arcostasi
Copy link
Contributor

This HX710B air pressure sensor module uses a high-precision AD sampling chip, adopts a 0-40KPa air pressure sensor, can connect a 2.5mm hose, can detect water level, and other air pressure.

MPS20N0020D_Arduino_wiring

Technical Specifications

  • VIN: Module power supply – 3.3-5 V
  • GND: Ground
  • SLC: I2C Clock
  • OUT: Digital output data
  • Pressure: 0-40KPa
  • Gain: 32 / 64 / 128
  • Size: 19x18mm (2mm fixing hole)

Pinouts

MPS20N0040D-pin

Documents

Code

/* 
  Source: https://www.electroschematics.com/pressure-sensor-guide/
*/
#include "HX711.h"

HX711 scale;

void setup() {
  Serial.begin(9600);
  Serial.println("HX710B Demo with HX711 Library");
  Serial.println("Initializing the scale");

  // parameter "gain" is ommited; the default value 128 is used by the library
  // HX711.DOUT   - pin #A1
  // HX711.PD_SCK - pin #A0

  scale.begin(A1, A0);

  Serial.println("Before setting up the scale:");
  Serial.print("read: \t\t");
  Serial.println(scale.read());                  // print a raw reading from the ADC
  Serial.print("read average: \t\t");
  Serial.println(scale.read_average(20));        // print the average of 20 readings from the ADC
  Serial.print("get value: \t\t");
  Serial.println(scale.get_value(5));            // print the average of 5 readings from the ADC minus the tare weight (not set yet)
  Serial.print("get units: \t\t");
  Serial.println(scale.get_units(5), 1);         // print the average of 5 readings from the ADC minus tare weight (not set) divided

  // by the SCALE parameter (not set yet)
  scale.set_scale(2280.f);                       // this value is obtained by calibrating the scale with known weights; see the README for details
  scale.tare();                                  // reset the scale to 0

  Serial.println("After setting up the scale:");
  Serial.print("read: \t\t");
  Serial.println(scale.read());                  // print a raw reading from the ADC
  Serial.print("read average: \t\t");
  Serial.println(scale.read_average(20));        // print the average of 20 readings from the ADC
  Serial.print("get value: \t\t");
  Serial.println(scale.get_value(5));            // print the average of 5 readings from the ADC minus the tare weight, set with tare()
  Serial.print("get units: \t\t");
  Serial.println(scale.get_units(5), 1);         // print the average of 5 readings from the ADC minus tare weight, divided

  // by the SCALE parameter set with set_scale
  Serial.println("Readings:");
}

void loop() {
  Serial.print("one reading:\t");
  Serial.print(scale.get_units(), 1);
  Serial.print("\t| average:\t");
  Serial.println(scale.get_units(10), 1);
  scale.power_down();                            // put the ADC in sleep mode
  delay(5000);
  scale.power_up();
}
@urish urish added the open for vote Vote at https://wokwi.com/features label Sep 16, 2021
yepher pushed a commit to yepher/wokwi-elements that referenced this issue Jan 7, 2022
This was referenced Jan 7, 2022
urish pushed a commit that referenced this issue Jan 12, 2022
* Adds HX711 Issue #101

* Changes from PR comments

* Fixes more `Hx711Element` case to `HX711Element`

* Adds Load sensors and Gauge Pressure sensors to board HX711 board

* Updates HX711 so it resizes when different sensors are active

* HX711 Element, removes unused code and makes width and height not user selectable.

* HX711 Element changes text to not be selectable.

* HX711 Element, Removes more unused code

* HX711 Element, changed default type to 50kg

* HX711 Element changes width/height to number

* HX711 Element, extracts sensor type to function with default.

Co-authored-by: Chris Wilson <>
@nameiskittu
Copy link

how to convert this to a SI unit value

@shankar1435000
Copy link

how to scale value to get preesure value in mmhg for bp machine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open for vote Vote at https://wokwi.com/features
Projects
None yet
Development

No branches or pull requests

5 participants