I'm working on a project that uses a load cell which gives canbus data, But unfortunately I can not find and data sheet reference to it's protocol but have manged to work out which bits to do what.
Byte 0&1 are the load cell values of cell 1
Byte 2&3 are the load cell values of cell 2
Byte 4 is the temperature reading of the load cell
Byte 5&6 is the load cell power supply value.
So with the power supply voltage set to 12.5 the reading are 0x48 & 0x1F.
I'm trying to get the reading converted to 12.5 so that I can display the values of them all but only looking at the power supply one first
The code above is what I'm trying but trying to adjust the values show that the float voltage macthes but cant get it quite right.
This is the output, I've switched the values around for POWER_SUPPLY1 just to try
POWER SIPPLY= 9.77539
POWER SUPPLY = 22.53784
temperature = 0.12
What would be the correct way to display the values so that they match the real data ?
This is the data that I've captured from the device on the canbus, I cannot find the data sheet or any reference for it has it only got the manufactures part no.
I have a PCAN-API which reads the data from it and this is how I got the value.
Highlighted yellow in the picture are the 2 values that change when I alter the power supply voltage
So BOb I've used the ESP32 twai to read the can bus data coming and I just created the array so that I could easily change the values to try and calculate the values using the WOKWI simulator saving uploading to the main board all the time I make a change.
I know it makes it harder without having the data sheet or information on the load cell.
But placing a known load on the cell the first 2 hex values relate to LC1_mV/V the next 2 hex values relate LC2_mV/V and the 4th hex is the temp looking as the picture above
Not sure this is the way I set up the code to read canbus from another project, but I may have got confused with alerts_to_enable using the TWAI library and the rx_frame is set by this twai_message_t rx_frame;
I can try the byte way and see if it works
I just like to say thank you all for your inputs and showing me the way I've ran some quick tests and they all seem to be good and reading the correct values. I've changed the float output to 1 decimal place and it reads the same.
Next I will look at the temperature reading, the hex value to that at the moment is 0XA0 (160 decimal value) and temp reading 34.5 degrees or I may tackle LC2_mV/V thats fluctuating between 0XD0,0X01 and 0XD4,0X01 with a voltage reading of 0.003500 which I will have to convert to display in kilograms
But what I will have to carry out some readings at different weights to work out the average where as the temperature will have to be done over time because I can't control that one unless I pop it in the freezer