LilyGO/LilyGO-T-SIM7000G + HX711 or ADS1232 wiring

4gino4
Posts: 6
Joined: Wed Mar 10, 2021 7:31 am

LilyGO/LilyGO-T-SIM7000G + HX711 or ADS1232 wiring

Postby 4gino4 » Wed Mar 10, 2021 8:31 am

I'm new to the forum, first of all thanks!

I'm trying to connect a LilyGO/LilyGO-T-SIM7000G to a HX711 or ADS1232

https://github.com/Xinyuan-LilyGO/LilyGO-T-SIM7000G

you can find the img of the pinout here

https://github.com/Xinyuan-LilyGO/LilyG ... /README.MD

If I run an I2c scanner code i can find a one wire temp probe, a BME280, but I have no luck when I connect the HX711, the code scans all the I2C addresses but no device is found, can you please help?

Thanks

boarchuz
Posts: 611
Joined: Tue Aug 21, 2018 5:28 am

Re: LilyGO/LilyGO-T-SIM7000G + HX711 or ADS1232 wiring

Postby boarchuz » Wed Mar 10, 2021 6:12 pm

HX711 doesn't use I2C

4gino4
Posts: 6
Joined: Wed Mar 10, 2021 7:31 am

Re: LilyGO/LilyGO-T-SIM7000G + HX711 or ADS1232 wiring

Postby 4gino4 » Thu Mar 11, 2021 7:02 pm

Code: Select all

/**
 *
 * HX711 library for Arduino - example file
 * https://github.com/bogde/HX711
 *
 * MIT License
 * (c) 2018 Bogdan Necula
 *
**/
#include "HX711.h"


// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 21;
const int LOADCELL_SCK_PIN = 22;


HX711 scale;

void setup() {
  Serial.begin(38400);
  Serial.println("HX711 Demo");

  Serial.println("Initializing the scale");

  // Initialize library with data output pin, clock input pin and gain factor.
  // Channel selection is made by passing the appropriate gain:
  // - With a gain factor of 64 or 128, channel A is selected
  // - With a gain factor of 32, channel B is selected
  // By omitting the gain factor parameter, the library
  // default "128" (Channel A) is used here.
  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);

  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();
}

this is the code i'm using, i declare the pins and connect SDA to DT and SCL to SCK of the HX711 board, but i keep reading 0 weight and 0 average

what i'm doing wrong?

the pinout of the main borad is this
https://github.com/Xinyuan-LilyGO/LilyG ... /README.MD

thanks a lot

4gino4
Posts: 6
Joined: Wed Mar 10, 2021 7:31 am

Re: LilyGO/LilyGO-T-SIM7000G + HX711 or ADS1232 wiring

Postby 4gino4 » Sat Mar 13, 2021 6:11 am

Hi, using PIN 21,22 finally "worked", but esp frequency does not go well with hx711, so using the library from here and the example code did not end in the hoped way. (I keep reading 8388608 value)

https://github.com/bogde/HX711

Lowering the frequency of the esp32 seems to create new issues and other problems, so I hope someone here has a working library or code for connecting the two devices in the right way.

Thanks

4gino4
Posts: 6
Joined: Wed Mar 10, 2021 7:31 am

Re: LilyGO/LilyGO-T-SIM7000G + HX711 or ADS1232 wiring

Postby 4gino4 » Sun Mar 14, 2021 6:47 pm

I changed the library, I used this

https://github.com/olkal/HX711_ADC

If used with esp32 you have to enable the delay.

I get good and stable data.

Now I' trying to understand sleep mode, if I get It wright the esp32 can be shut down completely if you want minimum power drain, but i loose data, so when It wakes up I cannot tare or recalibrate, i use raw reading and then convert in "grams" in graphana, hoping I will obtain usable and a stable output. Cannot figure out other solutions if I want the battery to last some day in open field with a variabile weight over the scale.

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: LilyGO/LilyGO-T-SIM7000G + HX711 or ADS1232 wiring

Postby PeterR » Mon Mar 15, 2021 7:09 pm

Its not clear what you are asking.
I had a quick look at the HX711 reference manual (not the biggest manual!) & there is no mention of calibration parameters or indeed soft configuration.

What exactly stops you waking from sleep, wake and reading a value? Perhaps you need to use a GPIO to hold the HX711 in reset until the ESP is booted.
I cannot tare or recalibrate
tare?? What is the recalibrate procedure?
& I also believe that IDF CAN should be fixed.

Who is online

Users browsing this forum: No registered users and 76 guests