I wanted to use HX711 24-bit adc standalone to measure voltage range of 2mv - 20mv.
Problem is:
- I cannot interpret the adc readings as it is in 2's compliment.
- What should I do in my code (code below) so that it prints voltages not decimal values.
Tried with different values of voltages (shared below), and I am totally confused with the readings I am getting. I don't know how to convert these values in voltage. What is the logic behind. Please help!
Readings:
0mv --- 5219,
1.1mv --- 5095,
2.3mv --- 4981,
2.5mv --- 4960,
2.9mv --- 4918,
5mv --- 4693,
10.6mv --- 4075,
15.1mv --- 3597,
22.7mv --- 2700,
40.7mv --- 562,
5volts --- -8388608,
-5volts --- -8388607.
Board is arduino leonardo, and a simple voltage divider is used for voltage generation(for testing only).
A bogde/HX711 library is used: https://github.com/bogde/HX711 Code:
/#include "HX711.h"
/#define DOUT 3
/#define CLK 2
HX711 scale(DOUT, CLK);
void setup() {
Serial.begin(115200);
}
void loop() {
long avg = scale.get_value(60);
Serial.print("Digital Code = ");
Serial.println(avg);
}