I tried multiple values and i found that b5=25 is the best overall value to accelerate compressor to 4000rpm. Then i had to reduce b5 to 20 to get it to run continuously in the region of 3800rpm. And still it would run up and down. That got me thinking and i created additional else if conditional with a streach from 3500rpm to 4200rpm. That way it would create a kind of hysteresis too keep rpm in.
And it works! if rpm would drop under 3800rpm b5=25 would pickup and taje it up to 4000rpm where it would steadily run with b5=20.
I will have to wait for summer so i can test the AC on full load...
I post my AC signal CAN function here so you can observe how i command compressor.
Also I posted CAN xls file with values of my bus.
Dont forget reading from 2 bytes requires 16bit intiger!
Code: Select all
void sendCANframeE() { //AC compressor
outframe.id = 0x185; // 0x185 0B 00 1D 00 00 08 00 03
outframe.length = 8; // Data payload 8 bytes
outframe.extended = 0; // Extended addresses - 0=11-bit 1=29bit
outframe.rtr=1; //No request
if(digitalRead(AC_pin) == LOW) { //AC pin is active
outframe.data.bytes[0]=0x0B; // status command 08 stbd, 0B start
}
else {
outframe.data.bytes[0]=0x08; //if we sense LOW we go to standby
}
outframe.data.bytes[1]=0x00; //
outframe.data.bytes[2]=0x1D; // 1D works
outframe.data.bytes[3]=0x00; //
outframe.data.bytes[4]=0x00; //
if(digitalRead(AC_pin) == LOW) { // AC is active
if (ACrpm <= 3800) { // Power for spinup
outframe.data.bytes[5]=0x25; // RPM command 08 to 54
}
else if ((ACrpm > 3500) && (ACrpm <= 4200)) { // power is reduced
outframe.data.bytes[5]=0x20; // RPM command 08 to 54
}
}
else {
outframe.data.bytes[5]=0x08; //AC pin is inactive
}
outframe.data.bytes[6]=0x00;
outframe.data.bytes[7]=0x03; // can be 00 or 03, it does not differentiate
if(debug) {printFrame(&outframe,1);} //If the debug variable is set, show our transmitted frame
if(myVars.CANport==0) Can0.sendFrame(outframe); //Mail it
else Can1.sendFrame(outframe);