Open dazzlersa opened 2 years ago
Hi Daz,
Sorry to hear your so near but no cigar!
I do recall that the DAC stopped communicate with the Arduino board, having been ok on my very first test out the box. Thought I'd somehow fried the DAC - I kept double checking everything (not that there is much to check!!). Suddenly it started working again and never had a problem since.
You've done well to follow my ramblings (I struggle to!!), all started off as a blog and then turned into a detail wiki .
You could give this a try as a basic test for the DAC... https://www.youtube.com/watch?v=KcC3cCHDxVw
I've just dug out and uploaded an old .ino file I used originally when testing the LC & HX711, "SimPedal_Test5-Serial". You'll need to change the pins to suit
Thanks so much for the response Skidude.
I have wired up and tested the DAC with the info from the youtube vid you sent and all working perfectly. Do now I am going to wire up the HX711 from scratch and see if I can get it working. Got everything printed now, so keen to get it installed.
I am not sure what the normal behaviour of the serial console should look like, do you know what I should be seeing in the serial monitor that tells me its working well and I can go ahead and strip my pedals?
Cheers Daz
Gaaah.... tried everything I can think of, I have 3 load cells and 3 hx711's, tried all of them, no matter what I do, I only see 2701 in the serial log. Even if I disconnect the load cell. I can push down on it and values don't change a bit.
I am measuring the voltage from the DAC out and it just sits on 3.287v.
Any idea what else I can try? At this point, I don't know if it is the Hardware or Software that is causing the non-response.
Here is the raw code I am using:
`#include
//This is the I2C Address of the MCP4725, by default (A0 pulled to GND). //Please note that this breakout is for the MCP4725A0.
//For devices with A0 pulled HIGH, use 0x61 // MCP4725 is 12bit inout and output at default 100Kbps (also available 400Kbps mode)
// How many samples to take at initialization of the library to zero // out the offset of the load cell. const int BRAKE_PEDAL_LOAD_CELL_TARE_REPS = 10;
// Arbitary scaling 1100. Single Load Cell. // Testing with set at 1100, pressing hard - max brake_value is a value around 400 to 800 const int BRAKE_PEDAL_LOAD_CELL_SCALING = 1100;
// LOCAL VARIABLES
// HX711 circuit wiring const int LOADCELL_DOUT_PIN = 1; const int LOADCELL_SCK_PIN = 0;
const float brakemax = -500; //comfortably pressing hard on load cell, with single cell, inverted is -around 400. To Stiffen brake go down to -800 const float arduino_vcc = 4.7; //USB 5v Arduino const float G29BrakeFull_v = 1.9; const float G29BrakeOff_v = 3.1; const float dac_BrakeFullPerc = G29BrakeFull_v / arduino_vcc; const float dac_BrakeOffPerc = G29BrakeOff_v / arduino_vcc;
const int dac_BrakeFull = 4096 dac_BrakeFullPerc; // Lower Voltage const int dac_BrakeOff = 4096 dac_BrakeOffPerc; // Higher voltage const int dac_Range = dac_BrakeOff - dac_BrakeFull;
const float dac_step = arduino_vcc / 4096;
HX711 brake_pedal;
unsigned int dacValue; byte buffer[3];
void setup()
{ // Zero the pedal offset. This is is to compensate for the own weight // of the pedal. It is important not to apply any force to the pedal // While this is happening brake_pedal.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN); brake_pedal.tare(BRAKE_PEDAL_LOAD_CELL_TARE_REPS);
Wire.begin(); // Begins the I2C communication //TWBR = 12; // Seems OK at 100kbps, otherwise MCP4725 can run at 400KHz using TWBR=12 }
void loop()
{ int32_t brake_value ; float brakePercOn;
buffer[0] = 0b01000000; //Sets the buffer0 with control byte (010-Sets in Write mode)
// Turn off Tx & RX LEDS TXLED0; RXLED0;
brake_value = brake_pedal.get_value(1);
brake_value /= BRAKE_PEDAL_LOAD_CELL_SCALING; brake_value *= -1; // invert so off pedal is a higher value (0) than full pedal
if (brake_value > 0){
brake_value = 0;
}
// Serial.println (brake_value);
brakePercOn = brake_value/brakemax; // determine applied brake pedal percentage // Serial.println (brakePercOn);
dacValue = dac_BrakeOff - (dac_Range * brakePercOn);
// Check not supplying over voltage if (dacValue * dac_step > G29BrakeOff_v) { dacValue = G29BrakeOff_v; }
buffer[1] = dacValue >> 4; //Puts the most significant bit values buffer[2] = dacValue << 4; //Puts the Least significant bit values
Wire.beginTransmission(MCP4725_ADDR);
Wire.write(buffer[0]); //Sends the control byte to I2C
Wire.write(buffer[1]); //Sends the MSB to I2C
Wire.write(buffer[2]); //Sends the LSB to I2C
Wire.endTransmission();
//
Serial.println(dacValue);
} `
I have tried with 2 HX711 boards, 1 at 10Hz and 1 at 80Hz, with no difference. I testest the continuity of the track, and it is definitely cut through.
I am crossing my fingers you spot something silly I have done, lol.
Thanks so much for the response Skidude.
I have wired up and tested the DAC with the info from the youtube vid you sent and all working perfectly. Do now I am going to wire up the HX711 from scratch and see if I can get it working. Got everything printed now, so keen to get it installed.
I am not sure what the normal behaviour of the serial console should look like, do you know what I should be seeing in the serial monitor that tells me its working well and I can go ahead and strip my pedals?
Cheers Daz
The HX711 code I loaded last night , from the comments - Serial.println (analogWriteValue); should output value representing voltage that would then be hooked up to the DAC . If you comment that line out and uncomment Serial.println (brake_value); earlier on the script then output is a value between 0 and -900. You can view either as an integer using serial monitor or a graph with serial plotter.
Unfortunately I don't have a spare Arduino and hx711 I can play with to help.
I'll try to look through your images this evening to see if I can spot anything
Difficult to see pinouts for the Input of the HX711, but think your black and white cables are switched. My diagram has the "none resistor" black cable going to E+, I think you have it to E-.
Try switching the none resistor black and white cables over?
Ah, well spotted!!! It was the wrong way around.
So after correcting that I am still getting spammed 2701 in the serial logger.
So I connected my voltmeter to the GND and OUT on the ADC. I stripped and built the pedal with the 3D Printed parts and assembled it with the load cell in order to make testing easier.
The voltmeter is recording 3.275v when the pedal is at rest, and if I put almost all my weight on it, it goes does to 3.56v. So there seems to be some communication going through, but something definitely seems wrong, as my understanding of the script means that the code is reading the pedal as full depressed.
I'm stumped lol.
Using the script you uploaded last night and printing the brake_value to the console, it just stays on 0.
So I def have an issue.
Think I should just undo everything and start from scratch and see....
The wiring I took from the link in your readme, under Single Load Cell: https://www.instructables.com/Tutorial-to-Interface-HX711-With-Load-Cell-Straigh/
They have E+ going to white.
So I am now following your pic at the end of the readme.
Can you measure the voltage between A- and A+? This is the voltage that gets amplified so it's the important one. It will be in mV so check your meter is ok going that low
On Sat, Oct 23, 2021, 1:04 PM dazzlersa @.***> wrote:
The wiring I took from the link in your readme, under Single Load Cell: https://www.instructables.com/Tutorial-to-Interface-HX711-With-Load-Cell-Straigh/
They have E+ going to white.
So I am now following your pic at the end of the readme.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Skidude88/Skidude88-G29-PS4-LoadCell-Arduino/issues/2#issuecomment-950142536, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPHQKNG6HRRNTWFA4I634DUIKQF7ANCNFSM5GQQF7IA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Hey GeekDeaks! Dude, your 3D Prints are awesome, never had something print so well.
I will do that measurement now thanks.
I disconnected the HX711 completely and the voltage remained at 3.2v and the serial log stayed at 2701. So my logic says to me that interfacing between the HX711 and ADC is not working. Either Hardware or Software.
Oh and I realise (facepalm) I have the wrong size resistors in, so I changed them for the 1k ohm and not the voltage is remaining at 2,2.5v on the nose and the serial console is 158...
The voltage between A- and A+ is 0.66v
Sorry missed the mV part of your comment.
In mV it's 0.35mV
ok, that sounds much better. Can you do a quick test and see how much it changes when you press the load cell?
I forgot to note down the expected values across the bridge, but I just calculated that you should see about a 4-5mV change under heavy load. Be careful how you apply the load though. I recommend putting it in the 3D model so that it is supported correctly.
If that looks ok, then I think your bridge is working fine and you should be able to hook it back up to the HX711 and start troubleshooting from there
Ok just did a test
This time with no load it was at around 0.32mV with load I got it up to 0.82mV.
I think I may be confused though... I am measuring A- and A+ on the HX711 input side, am I measuring in the correct place? Because you are mentioning hooking it back up to the HX711?
yeah, that is fine to measure it on the input :D I just assumed you had kept it disconnected. The mV values look low, but I am guessing it might just be the scale and it's really 3.2 and 8.2 mV? The high initial value might be due to a few ohm difference in the two 1k resistors, but you should be fine anyway and I'd personally start looking at the values you are getting on the serial port
Thanks for responding so quick. :) The values are as they are displayed on the multimeter so not sure? When you say values on the serial port, do you mean the voltage on the OUT of the dac?
ah no, I mean the values you are receiving on the serial port of the arduino. I think @Skidude88 was storing it in brake_value
in his code
Oh right. Sorry.
It's not logging anything. For some reason it's stopped. Let me see if I can just reload from scratch and see if I get any thing other that the constant 2701 it's been giving me
This is the code:
`#include
//This is the I2C Address of the MCP4725, by default (A0 pulled to GND). //Please note that this breakout is for the MCP4725A0.
//For devices with A0 pulled HIGH, use 0x61 // MCP4725 is 12bit inout and output at default 100Kbps (also available 400Kbps mode)
// How many samples to take at initialization of the library to zero // out the offset of the load cell. const int BRAKE_PEDAL_LOAD_CELL_TARE_REPS = 10;
// Arbitary scaling 1100. Single Load Cell. // Testing with set at 1100, pressing hard - max brake_value is a value around 400 to 800 const int BRAKE_PEDAL_LOAD_CELL_SCALING = 1100;
// LOCAL VARIABLES
// HX711 circuit wiring const int LOADCELL_DOUT_PIN = 1; const int LOADCELL_SCK_PIN = 0;
const float brakemax = -500; //comfortably pressing hard on load cell, with single cell, inverted is -around 400. To Stiffen brake go down to -800 const float arduino_vcc = 4.7; //USB 5v Arduino const float G29BrakeFull_v = 1.9; const float G29BrakeOff_v = 3.1; const float dac_BrakeFullPerc = G29BrakeFull_v / arduino_vcc; const float dac_BrakeOffPerc = G29BrakeOff_v / arduino_vcc;
const int dac_BrakeFull = 4096 dac_BrakeFullPerc; // Lower Voltage const int dac_BrakeOff = 4096 dac_BrakeOffPerc; // Higher voltage const int dac_Range = dac_BrakeOff - dac_BrakeFull;
const float dac_step = arduino_vcc / 4096;
HX711 brake_pedal;
unsigned int dacValue; byte buffer[3];
void setup()
{ // Zero the pedal offset. This is is to compensate for the own weight // of the pedal. It is important not to apply any force to the pedal // While this is happening brake_pedal.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN); brake_pedal.tare(BRAKE_PEDAL_LOAD_CELL_TARE_REPS);
Wire.begin(); // Begins the I2C communication //TWBR = 12; // Seems OK at 100kbps, otherwise MCP4725 can run at 400KHz using TWBR=12 }
void loop()
{ int32_t brake_value ; float brakePercOn;
buffer[0] = 0b01000000; //Sets the buffer0 with control byte (010-Sets in Write mode)
// Turn off Tx & RX LEDS TXLED0; RXLED0;
brake_value = brake_pedal.get_value(1);
brake_value /= BRAKE_PEDAL_LOAD_CELL_SCALING; brake_value *= -1; // invert so off pedal is a higher value (0) than full pedal
if (brake_value > 0){
brake_value = 0;
}
Serial.println (brake_value);
brakePercOn = brake_value/brakemax; // determine applied brake pedal percentage //Serial.println (brakePercOn);
dacValue = dac_BrakeOff - (dac_Range * brakePercOn);
// Check not supplying over voltage if (dacValue * dac_step > G29BrakeOff_v) { dacValue = G29BrakeOff_v; }
buffer[1] = dacValue >> 4; //Puts the most significant bit values buffer[2] = dacValue << 4; //Puts the Least significant bit values
Wire.beginTransmission(MCP4725_ADDR);
Wire.write(buffer[0]); //Sends the control byte to I2C
Wire.write(buffer[1]); //Sends the MSB to I2C
Wire.write(buffer[2]); //Sends the LSB to I2C
Wire.endTransmission();
//Serial.println(dacValue);
} `
And this is the output, which is just constantly scrolling this:
-7 0 -6 0 -2 -3 0 -7 0 -7 0 -2 -3 0 -7 0 -7 0 -3 -2 0 -7 0 -7
Then with pressure I got it too about -1850
I'd suggests thats all running ok now. You're logging out the brake_value before the code that limits it.
As it is you should be in a position to setup to suit you....in that if you can rig it up in the pedal and apply the brake as hard as you think you'd like 100% max braking to be, then set that value as the brakemax value
I'm running with max set at -800, you might feel that you want more of a workout when braking, you say you got to -1850 was that with a lot of pressure?
Obviously pressing by hand is different to using foot (hence reason for saying test with the loadcell in the pedal)
Oh right thanks, Skiddude. Appreciate it, let me connect to the serial cable (just need to check the pinout quick'0 and assemble and test.
Got it all sorted!!
Crappy old breadboard after all of that.
Now I just need to work out the spacers and the min and max in the code and should be golden.
Thanks so much for all the help, really appreciate it!!
Well, I was almost there, lol.
The pedal is too easy to push to the max, is that something I should be changing with the spacers or the min max values in the sketch?
Sorry, hopfully this is it.
I think you can just modify the following line:
If you could get raw values as low as -1800 fairly comfortably, then you might need to make it even lower
Brilliant. Thanks so much. Will give it a shot in the morning.
Hi, firstly thanks for all the info and trouble you have been through.
I have copied your install directly using the exact same hardware, and running mine at 5v (USB powered).
Everything is wired between the DAC, HX711 and Micro with the resistors. Connected the load cell (single), and loaded the script onto the micro.
I uncommented some of your serial prints to get an output on the serial logger to see the response to putting pressure on the load cell.
When I initially load it, it streams the output of dacValue (very quickly) at around 980 then if I leave it without touching anything, within around a minute it rises and sits at 2701 indefinitely.
If I unplug power and start again with the low dacValue and press the loadcell quickly I can see it changing in the serial logger, but after a short amount of time it just goes to 2701 and then no response from pressing the loadcell.
I haven't connected to the pedals, as my 3d printer is still printer, just thought I would test the hardware on the serial port first to ensure everything is working.
Do you perhaps have any idea what I might be missing or what could be wrong?
Really appreciate the help.
TIA Daz