Hi guys,
I’m having problems using the HX711 breakout with the XIAO Ble Sense.
I’m settled with non-mbed bsp, and using the library HX771 by Bogdan.
The HX711 is connected to D8 (SCK) and D9 (Dout), like I always used with esp32.
But it doesn’t respond.
Any suggestion?
Hi there,
post up the code.
So use those Code tags above “</>” and paste it in there, we can suggest the fix. Xiao is a little different. your close , you’ll get it.
HTH
GL PJ
#include "HX711.h"
int cnt = 0;
const uint8_t LOADCELL_DOUT_PIN = 4;
const uint8_t LOADCELL_SCK_PIN = 5;
const int LOADCELL_GAIN = 128;
HX711 scale;
void setup() {
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN, LOADCELL_GAIN);
delay(250);
scale.power_up();
delay(250);
if (scale.wait_ready_timeout(1000)) {
Serial.println("HX711 found");
} else {
Serial.println("HX711 not found.");
}
}
void loop() {
cnt++;
while(!scale.is_ready());
long reading = scale.read();
if(cnt > 160){
Serial.println(reading);
cnt = 0;
}
}
The setup is passed ok, “HX711 found”, but in loop is like is sampling at a higher rate than expected (80hz, should serial.print every 2sec)
Hi there,
So , I see on the data sheet you can set it to 80SPS or 10SPS
also you should try some other pins as well, Those pins 4 & 5 are the I2C pins on Xiao, The Bogdan lib will work with any GPIO pins try 2 & 3 also. Be sure its a 3.3v Device like the Xiao too, Or use a level shifter. If you want it as an SPI device then PINS 8 & 9 would do also.
Which BSP did you use to compile it with? 1.1.8 ? or most current
HTH
GL PJ
FYI Xiao is Active LOW outputs so be sure your polarity and logic agree.
Thanks. I changed to pins d8 d9 and worked
Hi there,
So , your welcome I provided the Solution, Should be marked as such.
You marked your own post mistakenly.
HTH
GL PJ
Often New users make this same mistake, When someone offers you a thing to try and it works, Then That would be the solution
you are right… sorry