Hi all - I’m experiening a really strange thing that is slightly confusing me.
I have two load cell chips connected to a photon - I’m reading Load Cell data from them via an HX711 library (which seems to just bit bang the data in) over pins D2 & D3.
Thing is - they read perfectly stable over my web interface but as soon as I plug in a USB cable to read serial debug data from the photon, the Load Cell data goes completely haywire and jumps all over the place.
Has anyone experienced interference like this?
I have even tested it with printing no serial data over the usb wire and just having it plugged in - same behaviour.
I have a 12V PSU running through an off the shelf Vreg circuit which powers the photon - the GND rail is common.
The chip’s library reads the info from the chip as follows:
// pulse the clock pin 24 times to read the data
for (byte j = 3; j--;) {
for (char i = 8; i--;) {
digitalWrite(PD_SCK, HIGH);
bitWrite(data[j], i, digitalRead(DOUT));
digitalWrite(PD_SCK, LOW);
}
}
I’ve copied the Library I am using here (in my code above I have simplified it a bit as I was trying to ease explanation):
Apologies for being so vague before - theres is loads of the library I am not using so was trying to pin it down to the code I was using for ease of explanation.
Sounds like a grounding issue rather than firmware.
You could be forming a ground loop somewhere, which causes noise on hi-Z measurement inputs.
You could have a floating 12V PSU, but a earth grounded computer, futzing things up.
Easy way to test is with a laptop, try unplugging everything from it (monitor, power, any other devices) so it’s floating and then plug in the serial cable and see if it persists.