Im doing a sim racing pedal project with Ardunio leo and the Bodge HX711 lib and joystick lib. Ive checked out HX711-multi lib but from what i can tell (im a noob) you can sample 3 load cell amps but only read them all at the same time? What i need is to be able to have each input to a separate axis. Would there be any chance of doing this or will i need 3 Leo's
Thanks!
This is my current setup for 2 analog and a load cell using the default hx711
#include <HX711.h>
#define calibration_factor -640.0 // Do your calibration first.
#define DOUT 3
#define CLK 2
#include <Joystick.h>
HX711 scale;
/*
For the true false flags, use this list. Its all in Joystick.h
bool includeXAxis = true,
bool includeYAxis = true,
bool includeZAxis = true,
bool includeRxAxis = true,
bool includeRyAxis = true,
bool includeRzAxis = true,
bool includeRudder = true,
bool includeThrottle = true,
bool includeAccelerator = true,
bool includeBrake = true,
bool includeSteering = true);
*/
Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,
JOYSTICK_TYPE_MULTI_AXIS, 4, 3,
false, false, false, false, false, false,
false, false, true, true, false);
// Variable
int throttle = A0;
// int brake = 2; / no need for this as we read directly from scale
int clutch = A2;
// init joystick libary
void setup() {
// Ranges are 1023 by default
// Joystick.setBrakeRange(0, 1023);
//Joystick.setThrottleRange(0, 1023);
//Joystick.setZAxisRange(0, 255);
Joystick.begin();
Serial.begin(38400);
scale.begin(DOUT, CLK);
scale.set_scale(calibration_factor);
scale.tare();
}
void loop() {
Joystick.setThrottle(analogRead(throttle));
delay(1);
Joystick.setBrake(scale.get_units());
delay(1);
Joystick.setZAxis(analogRead(clutch));
delay(1);
}
DrDiettrich:
Search for "load cell amplifier" returns HX711 alternatives with better interfaces.
If your library allows to query multiple HX711, what's not okay with reading all at the same time?
Reading them all is fine and what I want. Let me be clear. if I can't get 3 seperate readouts to assign each axis it's not usable. That's the question I am asking about the hx711 multi library . Can it be done? To me it looks like it can only output/read their combined values and not seperate which I can assign to 3 variables
MorganS:
For 3 pedals you would need 3 HX711 chips.
On the pedal itself you need 4 strain gauges. But if you are using commercial load cells, they already have the 4 gauges inside.
Have them i a bridge setup yes. No issues with the hardware, just need them as seperate inputs for the axis.
The HX711-multi library read function returns an array of long data type with an element for each channel that you set up for. The example in that library show how to read 3 load cells. The sendRawData funtion uses a for loop to separate the elements.
groundFungus:
The HX711-multi library read function returns an array of long data type with an element for each channel that you set up for. The example in that library show how to read 3 load cells. The sendRawData funtion uses a for loop to separate the elements.
I see, thanks! Then it should be easy enough. gonna have to keep my noob programming skills better as i used to know this basic stuff at some point /shame