Hello,
I would like to pre-face this by saying, I have no coding experience. Other than copy/pasting whatever I find online. the end goal of this project is to make a Digital throttle body Sync tool out of a RPi Pico (I had an extra one laying around). and 4 HX710B/MPS20N0040D sensors. I am using the Arduino IDE with it because that is the only place I found more thorough material for this specific sensor (HX710b). I doubt this is the best set up, but I'm trying to do what I can with what I have.
So far I've had some luck getting some values with a couple of libraries I found here, and Github. I was able to use the HX710 library from Pablo Bernal. I couldn't get the array example to work, it would crash my PICO. The LED alternates between 4 slow and 4 fast blinks, and I would get a "cant connect" error. I don't have a USB>Serial adapter, so I'm not able to get the crash dump.
I was however able to use the other examples. I got some data from them on the Serial Monitor, using the code below.
#include "HX710.h"
////////////////////////////////////////////////////////////////
// PARAMETERS
////////////////////////////////////////////////////////////////
const int DOUT = 16;
const int PD_SCK = 14;
#define SERIAL_PLOTTER
////////////////////////////////////////////////////////////////
// SETUP
////////////////////////////////////////////////////////////////
HX710 ps;
void setup() {
Serial.begin( 115200 );
ps.initialize( PD_SCK , DOUT );
}
////////////////////////////////////////////////////////////////
// LOOP
////////////////////////////////////////////////////////////////
void loop() {
int32_t value;
while( !ps.isReady() );
ps.readAndSelectNextData( HX710_DIFFERENTIAL_INPUT_40HZ );
value = ps.getLastDifferentialInput();
#ifdef SERIAL_PLOTTER
Serial.println( value );
#else
Serial.print( "differential input (40 Hz): " );
Serial.println( value );
#endif
}
My question is, how can add three more sensors to this code? and how can I make a visual representation of the data? the PICO would be connected directly to my laptop. It would be nice to have actual Vacuum readings, but it wouldn't matter, since all I care about is the differences between the 4 different sensors, in some sort of graphical bar format. Maybe i could just use the serial plotter.
I've attached some pictures of my set up. one is how it was wired for the array example. The resistor you see on one of the sensors, is to allow more vacuum forces, and still get a reading. Thanks!!