VW A/C Compressor
-
- Posts: 85
- Joined: Thu Jan 28, 2021 6:15 pm
- Has thanked: 1 time
- Been thanked: 10 times
Re: VW A/C Compressor
Great plot @pete9008
the data should be very accurate as i emulated the pressure sensor and read the values of a factory climate control module via diagnostic.
its a shame i don't know what byte 3 and 4 do as i couldn't see any values on diagnostic change.
I was trying to do the same with sending the compressor data but the climate control wasnt happy with that one.
i will get round to the humidity and temp sensor next.
the data should be very accurate as i emulated the pressure sensor and read the values of a factory climate control module via diagnostic.
its a shame i don't know what byte 3 and 4 do as i couldn't see any values on diagnostic change.
I was trying to do the same with sending the compressor data but the climate control wasnt happy with that one.
i will get round to the humidity and temp sensor next.
- EV_Builder
- Posts: 1205
- Joined: Tue Apr 28, 2020 3:50 pm
- Location: The Netherlands
- Has thanked: 18 times
- Been thanked: 37 times
- Contact:
Re: VW A/C Compressor
its possible that the the other 2 bytes are fine value. Like 0-4bar representation. and that the other 2 bytes are course.
So to get the total pressure you calculate the 0-4bar values and the course value and sum them up.
I came across a current sensor who did this with 2 analog outputs.
So to get the total pressure you calculate the 0-4bar values and the course value and sum them up.
I came across a current sensor who did this with 2 analog outputs.
Converting an Porsche Panamera
see http://www.wdrautomatisering.nl for bespoke BMS modules.
see http://www.wdrautomatisering.nl for bespoke BMS modules.
-
- Posts: 85
- Joined: Thu Jan 28, 2021 6:15 pm
- Has thanked: 1 time
- Been thanked: 10 times
Re: VW A/C Compressor
i will give it a try tomorrow but when i applied pressure the the sensor (in a previous attemp to get some readings) i didnt see those values changeEV_Builder wrote: ↑Mon Sep 19, 2022 10:08 pm its possible that the the other 2 bytes are fine value. Like 0-4bar representation. and that the other 2 bytes are course.
So to get the total pressure you calculate the 0-4bar values and the course value and sum them up.
I came across a current sensor who did this with 2 analog outputs.
-
- Posts: 85
- Joined: Thu Jan 28, 2021 6:15 pm
- Has thanked: 1 time
- Been thanked: 10 times
Re: VW A/C Compressor
I just simulated the AC pump to the climate control and got some values. They seem very different from muehlpower results but these are from VCDS so i trust them. i didnt not go thru all the error and status options but i will in the future.
byte 1 errors
to do later
byte 2 status inverter temp
01 overheat pre warm stage
02 overheat shutdown active
03 error temo sensor
04 ok
80 inverter status active
byte 3 status
01 compressor off
20 compressor on
40 rpm limitation active
80 self protect shutdown stage 3 active
aa self protect shutdown stage 2
byte 4 rpm
01 50rpm
02 100rpm
30 2400rpm
60 4800rpm
aa 8500rpm
bb err
cc err
ee err
fe err
ff err
byte 5 compressor motor current
01 0.25a
02 0.50a
60 24.00a
aa 42.50a
bb 46.75a
ee 59.50a
fe 63.50a
ff error
byte 6 ac compressoer power con KW
01 0.04kw
02 0.08kw
60 3.84kw
aa 6.80kw
bb 7.48kw
ee 9.52kw
fe 10.16kw
ff error
byte 7 compressor temp
val temp
01 -126
02 -125
aa 43
bb 60
ee 111
fe 127
ff error
byte 8 high voltage supply
01 2v
02 4v
60 192v
aa 340v
bb 374v
ee 476v
fe 508v
ff error
byte 1 errors
to do later
byte 2 status inverter temp
01 overheat pre warm stage
02 overheat shutdown active
03 error temo sensor
04 ok
80 inverter status active
byte 3 status
01 compressor off
20 compressor on
40 rpm limitation active
80 self protect shutdown stage 3 active
aa self protect shutdown stage 2
byte 4 rpm
01 50rpm
02 100rpm
30 2400rpm
60 4800rpm
aa 8500rpm
bb err
cc err
ee err
fe err
ff err
byte 5 compressor motor current
01 0.25a
02 0.50a
60 24.00a
aa 42.50a
bb 46.75a
ee 59.50a
fe 63.50a
ff error
byte 6 ac compressoer power con KW
01 0.04kw
02 0.08kw
60 3.84kw
aa 6.80kw
bb 7.48kw
ee 9.52kw
fe 10.16kw
ff error
byte 7 compressor temp
val temp
01 -126
02 -125
aa 43
bb 60
ee 111
fe 127
ff error
byte 8 high voltage supply
01 2v
02 4v
60 192v
aa 340v
bb 374v
ee 476v
fe 508v
ff error
- EV_Builder
- Posts: 1205
- Joined: Tue Apr 28, 2020 3:50 pm
- Location: The Netherlands
- Has thanked: 18 times
- Been thanked: 37 times
- Contact:
Re: VW A/C Compressor
This looks like CANBus, Muehlpower = LIN bus.golfdubcrazy wrote: ↑Mon Sep 19, 2022 11:26 pm They seem very different from muehlpower results but these are from VCDS so i trust them. i didnt not go thru all the error and status options but i will in the future..
Converting an Porsche Panamera
see http://www.wdrautomatisering.nl for bespoke BMS modules.
see http://www.wdrautomatisering.nl for bespoke BMS modules.
-
- Posts: 85
- Joined: Thu Jan 28, 2021 6:15 pm
- Has thanked: 1 time
- Been thanked: 10 times
- EV_Builder
- Posts: 1205
- Joined: Tue Apr 28, 2020 3:50 pm
- Location: The Netherlands
- Has thanked: 18 times
- Been thanked: 37 times
- Contact:
Re: VW A/C Compressor
Then it's time to compare nameplates on the compressor and or the device between the compressor and vcds interface.golfdubcrazy wrote: ↑Tue Sep 20, 2022 7:55 am no this is definitely the linbus data from the compressor
Converting an Porsche Panamera
see http://www.wdrautomatisering.nl for bespoke BMS modules.
see http://www.wdrautomatisering.nl for bespoke BMS modules.
-
- Posts: 1801
- Joined: Sun Apr 03, 2022 1:57 pm
- Has thanked: 102 times
- Been thanked: 350 times
Re: VW A/C Compressor
Nice work 
Those look pretty close to me, well within the uncertainty that's to be expected when reverse engineering something. Interesting to see that you have motor power and current while muehlpower doesn't. Is it possible that the controller is sending something to the compressor that 'wakes up' those fields? Are you able to do a capture of the data being sent to the compressor from the controller? Alternatively it could be model dependant as EV_Builder suggests.
Muehlpower's 112 value (hex 0x70) for byte 1 looks like a combination of your compressor on and rpm limitation active flags and suggests that there is another flag on 0x10.

Those look pretty close to me, well within the uncertainty that's to be expected when reverse engineering something. Interesting to see that you have motor power and current while muehlpower doesn't. Is it possible that the controller is sending something to the compressor that 'wakes up' those fields? Are you able to do a capture of the data being sent to the compressor from the controller? Alternatively it could be model dependant as EV_Builder suggests.
Muehlpower's 112 value (hex 0x70) for byte 1 looks like a combination of your compressor on and rpm limitation active flags and suggests that there is another flag on 0x10.
-
- Posts: 85
- Joined: Thu Jan 28, 2021 6:15 pm
- Has thanked: 1 time
- Been thanked: 10 times
Re: VW A/C Compressor
as these are the values the control unit are giving I would say they are right. I'm assuming Muehlpower did some very accurate guess work. also just realized what's in his original post lines up with my results and theres a few mistakes in the wiki.
as i am emulating the pump and the values are clear on the screen doesn't leave any guessing
i just done the HV heater this was my results.
byte 1 current (n*0.25)
01 0.25a
02 0.50a
30 12.00a
byte 2 high voltage status
01 hv too low
02 hv too high
04 hv ok
byte 3 status
01 ptc degraded by sw
02 malfunction
08 ok
byte 4 ?
byte 5 supply voltage (n*0.1)
01 0.1v
02 0.2v
99 15.3
fb 25.1
fe initialzation
byte 6 temp control module (n-50)
10 -34c
11 -33c
30 -2
31 -1
60 46
88 86
87 85
99 103
byte 7 inlet temp (n-50)
10 -34c
11 -33c
30 -2
31 -1
60 46c
88 86
87 85
99 103
byte 8 exh heat (n-50)
10 -34c
11 -33c
30 -2
31 -1
60 46c
88 86
87 85
99 103c
as i am emulating the pump and the values are clear on the screen doesn't leave any guessing
i just done the HV heater this was my results.
byte 1 current (n*0.25)
01 0.25a
02 0.50a
30 12.00a
byte 2 high voltage status
01 hv too low
02 hv too high
04 hv ok
byte 3 status
01 ptc degraded by sw
02 malfunction
08 ok
byte 4 ?
byte 5 supply voltage (n*0.1)
01 0.1v
02 0.2v
99 15.3
fb 25.1
fe initialzation
byte 6 temp control module (n-50)
10 -34c
11 -33c
30 -2
31 -1
60 46
88 86
87 85
99 103
byte 7 inlet temp (n-50)
10 -34c
11 -33c
30 -2
31 -1
60 46c
88 86
87 85
99 103
byte 8 exh heat (n-50)
10 -34c
11 -33c
30 -2
31 -1
60 46c
88 86
87 85
99 103c
Re: VW A/C Compressor
Does anyone have a working code for heater control they are willing to share? still trying to get my head around lin bus and would love to see how others have implemented it, Thanks
- 7yatna
- Posts: 77
- Joined: Wed Jul 06, 2022 2:49 am
- Location: San Diego, CA
- Has thanked: 4 times
- Been thanked: 7 times
Re: VW A/C Compressor
muehlpower wrote: ↑Sun Mar 28, 2021 11:59 am I managed to get my VW / Audi air conditioning compressor running today. It works with a nominal 352V and is controlled with a LIN bus.
So far I haven't read much about the LIN bus here. But it's easier than CAN. There is a master (my controller) that sends headers, followed by 2 to 8 bytes of data and a checksum. Or only the header is sent and a slave (A/C kompressor) replies with 2 to 8 data bytes and a checksum.
In my case I have to send commands on ID 32 and get measured values and status messages back on ID33. I have to send the desired speed, an activation bit and a start bit, then it runs and receives the current HV voltage, the actual speed and a temperature.
connectors are:
HVA 280 KEY_D from TE +HV left side (near to the 12V conn.), -HV right side (far from the 12V conn)
1J0973714 8= +12V , 5= GND, 2= LIN
to control the A/C
ID 32 (0x20)
length 6 Byte / ENHANCED Checksum
Byte 0 =RPM (dec 20-250)
Byte 1 bit 2 = aktivate
Byte 1 bit 0 = start
Byte 2-5 = 0
back message:
ID 31 (0x61)
length 8 Byte / ENHANCED Checksum
Byte 0 =1 at HV voltage under 200V, =0 above 200V (below 200V it want work, so its a kinde of HV OK)
Byte 1 =112, always, i dont know why
Byte 3 =RPM as set via PID=32 in Byte 0
Byte 4 =110 below 200V, =14 above 200V, =46 when er running.
Byte 4,5,6 =0, always, i dont know why
Byte 6 =temperature 160 at 24°C, i don't know the scaling and what themperature that is til now
Byte 7 =54 at 109V, =28 at 56V =83 at166V scaling: Voltage/2
Hi Guys,
i got one of those ac compressor to mess around with
im trying to make it spin and got the LIN HW and making a sketch to make the compressor spin.
i see the message should have this structure.
to control the A/C
ID 32 (0x20)
length 6 Byte / ENHANCED Checksum
Byte 0 =RPM (dec 20-250)
Byte 1 bit 2 = aktivate
Byte 1 bit 0 = start
Byte 2-5 = 0
on Byte 1 , what is akitvate and what is start ? are they 0 and 1 sorta of thing ?
and byte 1 is 4 bits excuse the Noob here. Canbus and Lin are new and working on them. and how about the checksum do i need to calculate that everytime i send a message or not required ? and if required which bit should i pass the calculations ?
so if i want to run the compressor at lets say 200RPM
Id = 0x32
Byte 0 = 0xC8
Byte 1 = 0x20 ?? 2 and 0 (not sure about this one )
Byte 2 = 0x00
Byte 3 = 0x00
Byte 4 = 0x00
Byte 5 = 0x00
and where the checksum fits ? i dont see any need/ place for it so why there is a function to calculate checksum.
thanks in advance but trying to understand this new thing.
Best
Karim
Hammer, Duct tape, WD-40 that`s it 
1973 Beetle with SDU swap.

1973 Beetle with SDU swap.
- EV_Builder
- Posts: 1205
- Joined: Tue Apr 28, 2020 3:50 pm
- Location: The Netherlands
- Has thanked: 18 times
- Been thanked: 37 times
- Contact:
Re: VW A/C Compressor
A byte = 8 bits always.
Bits not in use = 0 / reset.
Bits in use and active a 1.
So to start do:
byte 1 |= 1; //bit 0
To activate
Byte 1 |= 4; // bit 2
For the checksum I recommend finding a sketch with an example.
Bits not in use = 0 / reset.
Bits in use and active a 1.
So to start do:
byte 1 |= 1; //bit 0
To activate
Byte 1 |= 4; // bit 2
For the checksum I recommend finding a sketch with an example.
Converting an Porsche Panamera
see http://www.wdrautomatisering.nl for bespoke BMS modules.
see http://www.wdrautomatisering.nl for bespoke BMS modules.
- 7yatna
- Posts: 77
- Joined: Wed Jul 06, 2022 2:49 am
- Location: San Diego, CA
- Has thanked: 4 times
- Been thanked: 7 times
Re: VW A/C Compressor
thank you for your comment.EV_Builder wrote: ↑Fri Mar 31, 2023 11:18 pm A byte = 8 bits always.
Bits not in use = 0 / reset.
Bits in use and active a 1.
So to start do:
byte 1 |= 1; //bit 0
To activate
Byte 1 |= 4; // bit 2
For the checksum I recommend finding a sketch with an example.
i do know how to write code and i did write and modified bunch of sketches but i didnt understand this part.
i know that bytes are 8 bits
and bits not in use is 0
byte 1 which is the start and activate here.
it is 8 bits (Binary)
my question is what is start and what is activate ?
what binary goes in the bits ?
0 or 1s
and byte 1 is 8 bits
back again to what i mentioned in my previous comment
how byte 1 looks like if i want to command the compressor to run at 200 Rpm ??
and i will look for a working sketch if you have one will be great but does the checksum needs to be calculated and sent in the command message ? like data verification?
if so which bytes are the checksum ? Byte 1 ??
so Byte one consist of 8 bits which contains start, activate and checksum ??
i know i sound like imp completely lost but i have done coding and i just worked out a can bus shifter to work from a BMW.
appreciate your help.
Karim
Hammer, Duct tape, WD-40 that`s it 
1973 Beetle with SDU swap.

1973 Beetle with SDU swap.
- EV_Builder
- Posts: 1205
- Joined: Tue Apr 28, 2020 3:50 pm
- Location: The Netherlands
- Has thanked: 18 times
- Been thanked: 37 times
- Contact:
Re: VW A/C Compressor
my question is what is start and what is activate ?
Only the writer of the text knows... But i think both need to be one.
First start and in the second message you set activate too.
what binary goes in the bits ?
0 or 1s
Both but often when the assignation needs to be activated it's done with a 1. 0 = false.
and byte 1 is 8 bits
back again to what i mentioned in my previous comment
how byte 1 looks like if i want to command the compressor to run at 200 Rpm ??
What i typed byte 1 : 0000 0101 = 0x05;
The rest of your questions find a LIM SKETCH first. Then analyse it.
It depends hugely on the library i think. That's why I don't answer.
Only the writer of the text knows... But i think both need to be one.
First start and in the second message you set activate too.
what binary goes in the bits ?
0 or 1s
Both but often when the assignation needs to be activated it's done with a 1. 0 = false.
and byte 1 is 8 bits
back again to what i mentioned in my previous comment
how byte 1 looks like if i want to command the compressor to run at 200 Rpm ??
What i typed byte 1 : 0000 0101 = 0x05;
The rest of your questions find a LIM SKETCH first. Then analyse it.
It depends hugely on the library i think. That's why I don't answer.
Converting an Porsche Panamera
see http://www.wdrautomatisering.nl for bespoke BMS modules.
see http://www.wdrautomatisering.nl for bespoke BMS modules.
- 7yatna
- Posts: 77
- Joined: Wed Jul 06, 2022 2:49 am
- Location: San Diego, CA
- Has thanked: 4 times
- Been thanked: 7 times
Re: VW A/C Compressor
Again, thank you so much for your help. your explanation is excellent.EV_Builder wrote: ↑Sat Apr 01, 2023 5:01 am my question is what is start and what is activate ?
Only the writer of the text knows... But i think both need to be one.
First start and in the second message you set activate too.
what binary goes in the bits ?
0 or 1s
Both but often when the assignation needs to be activated it's done with a 1. 0 = false.
and byte 1 is 8 bits
back again to what i mentioned in my previous comment
how byte 1 looks like if i want to command the compressor to run at 200 Rpm ??
What i typed byte 1 : 0000 0101 = 0x05;
The rest of your questions find a LIM SKETCH first. Then analyse it.
It depends hugely on the library i think. That's why I don't answer.
i think both of us are confued due to Start and Activate are not know what binary or hex is the actual data.
will try to find a sketch to see what is needed i will share back if i figure it out
thanks again i appreciate your help.
Hammer, Duct tape, WD-40 that`s it 
1973 Beetle with SDU swap.

1973 Beetle with SDU swap.
- EV_Builder
- Posts: 1205
- Joined: Tue Apr 28, 2020 3:50 pm
- Location: The Netherlands
- Has thanked: 18 times
- Been thanked: 37 times
- Contact:
Re: VW A/C Compressor
If you want to only send start it's byte1= 0x01;
If you want to only activate it's 0x04;
If you want to combo it's 0x05;
Now what and when is up for you to test. I think start needs tobe high and activate sets the new speed.
If you want to only activate it's 0x04;
If you want to combo it's 0x05;
Now what and when is up for you to test. I think start needs tobe high and activate sets the new speed.
Converting an Porsche Panamera
see http://www.wdrautomatisering.nl for bespoke BMS modules.
see http://www.wdrautomatisering.nl for bespoke BMS modules.
- 7yatna
- Posts: 77
- Joined: Wed Jul 06, 2022 2:49 am
- Location: San Diego, CA
- Has thanked: 4 times
- Been thanked: 7 times
Re: VW A/C Compressor
Ok that makes sense which bytes to send for whichEV_Builder wrote: ↑Sat Apr 01, 2023 12:26 pm If you want to only send start it's byte1= 0x01;
If you want to only activate it's 0x04;
If you want to combo it's 0x05;
Now what and when is up for you to test. I think start needs to be high and activate sets the new speed.
now whets the difference between start and Activate ?
and there is a different byte for the RPM (speed) Byte 0
I'm making the HW ready and have a compressor laying around
will try to send it at low RPM and see what happens since it isnt connected in a system. i dont want to damage the valves
if any body has an actual working sketch this will be great.
thanks Again
Hammer, Duct tape, WD-40 that`s it 
1973 Beetle with SDU swap.

1973 Beetle with SDU swap.
-
- Posts: 85
- Joined: Thu Jan 28, 2021 6:15 pm
- Has thanked: 1 time
- Been thanked: 10 times
Re: VW A/C Compressor
After making lots of adaptors and brackets im ready to start testing my AC setup. I decided to use a watercooled condenser and evaporator.
ESP32 for commutation. once i know its reliable and wont try to blow up anything I will put the code on my GitHub.
I have also found the actual datasheet for the pressure sensor will add it shortly needless to say the error i had from my data was 0.0001


-
- Posts: 85
- Joined: Thu Jan 28, 2021 6:15 pm
- Has thanked: 1 time
- Been thanked: 10 times
Re: VW A/C Compressor
7yatna wrote: ↑Sun Apr 02, 2023 8:47 am Ok that makes sense which bytes to send for which
now whets the difference between start and Activate ?
and there is a different byte for the RPM (speed) Byte 0
I'm making the HW ready and have a compressor laying around
will try to send it at low RPM and see what happens since it isnt connected in a system. i dont want to damage the valves
if any body has an actual working sketch this will be great.
thanks Again
When you send "activate" it wakes up the compressor/inverter and it starts sending data like RPM, VOLTAGE, AMPS, ERRORS.
You need to send activate, then the "Start" to tell the compressor to get the motor spinning.
if you get the RPM value you want and divide by 50 will give you the DEC value you need to transmit. eg (8000rpm / 50 = 160DEC) which is A0 in hex
every message has to have a corrected checksum sent (in the case of the compressor an enhanced) otherwise the controller will ignore the message.
- 7yatna
- Posts: 77
- Joined: Wed Jul 06, 2022 2:49 am
- Location: San Diego, CA
- Has thanked: 4 times
- Been thanked: 7 times
Re: VW A/C Compressor
Thank you for the clarification,golfdubcrazy wrote: ↑Sun Apr 02, 2023 7:19 pm When you send "activate" it wakes up the compressor/inverter and it starts sending data like RPM, VOLTAGE, AMPS, ERRORS.
You need to send activate, then the "Start" to tell the compressor to get the motor spinning.
if you get the RPM value you want and divide by 50 will give you the DEC value you need to transmit. eg (8000rpm / 50 = 160DEC) which is A0 in hex
every message has to have a corrected checksum sent (in the case of the compressor an enhanced) otherwise the controller will ignore the message.
that now Makes more sense. the original comments were vague a little bit.
final question, where is the checksum is sent or how is it implemented ? the original comments only shows the message structure and data.
I saw the function of calculating the checksum but it isn't really complete.
another note: if you have a sketch that tested/should have the correct message structure, would share it here ? i will take a go at it. as i have the compressor and i just received my heater today as well,
so i might go at the heater first as it is easier and can be run without worrying too much about damaging the compressor valves.
thanks,
Karim
Hammer, Duct tape, WD-40 that`s it 
1973 Beetle with SDU swap.

1973 Beetle with SDU swap.
- muehlpower
- Posts: 679
- Joined: Fri Oct 11, 2019 10:51 am
- Location: Germany Fürstenfeldbruck
- Has thanked: 14 times
- Been thanked: 133 times
Re: VW A/C Compressor
I don't know why, but parts of the program disappear when uploaded to the forum!? i can not write an "i" in "[]" how it should be behind "data" and "pdata"
here is my code again to determine the checksum and how to send for arduino. The compressor can be tested individually at low speed for a short time if it is not completely dry. There must be more than 200V.
"
void Lin (uint8_t msg[10],uint8_t len)
{
Serial1.begin(LIN_baud*10/16,SERIAL_8N1);
Serial1.write((byte)0); // 16 bit time low
Serial1.end(); // UART off
Serial1.begin(LIN_baud,SERIAL_8N1);
Serial1.write(0b01010101); //send syncrobyte
for (uint8_t i=0; i<=len; ++i)
{
Serial1.write(data); //send data
}
if (len > 0) Serial1.write(data[9]); //send checksum
}
uint8_t checksum (uint8_t * pdata, uint8_t len, uint8_t mode)
{
uint16_t tmp;
if (mode == CLASSIC) tmp = 0;
else tmp = pdata[0];
for (uint8_t i=1; i<=len; i++)
{
tmp = tmp + pdata;
if (tmp>255) tmp = tmp-255;
}
tmp = 255-tmp;
return tmp;
}
here is my code again to determine the checksum and how to send for arduino. The compressor can be tested individually at low speed for a short time if it is not completely dry. There must be more than 200V.
"
void Lin (uint8_t msg[10],uint8_t len)
{
Serial1.begin(LIN_baud*10/16,SERIAL_8N1);
Serial1.write((byte)0); // 16 bit time low
Serial1.end(); // UART off
Serial1.begin(LIN_baud,SERIAL_8N1);
Serial1.write(0b01010101); //send syncrobyte
for (uint8_t i=0; i<=len; ++i)
{
Serial1.write(data); //send data
}
if (len > 0) Serial1.write(data[9]); //send checksum
}
uint8_t checksum (uint8_t * pdata, uint8_t len, uint8_t mode)
{
uint16_t tmp;
if (mode == CLASSIC) tmp = 0;
else tmp = pdata[0];
for (uint8_t i=1; i<=len; i++)
{
tmp = tmp + pdata;
if (tmp>255) tmp = tmp-255;
}
tmp = 255-tmp;
return tmp;
}
- 7yatna
- Posts: 77
- Joined: Wed Jul 06, 2022 2:49 am
- Location: San Diego, CA
- Has thanked: 4 times
- Been thanked: 7 times
Re: VW A/C Compressor
muehlpower wrote: ↑Mon Apr 03, 2023 6:30 pm here is my code again to determine the checksum and how to send for arduino. The compressor can be tested individually at low speed for a short time if it is not completely dry. There must be more than 200V.
"
void Lin (uint8_t msg[10],uint8_t len)
{
Serial1.begin(LIN_baud*10/16,SERIAL_8N1);
Serial1.write((byte)0); // 16 bit time low
Serial1.end(); // UART off
Serial1.begin(LIN_baud,SERIAL_8N1);
Serial1.write(0b01010101); //send syncrobyte
for (uint8_t i=0; i<=len; ++i)
{
Serial1.write(data); //send data
}
if (len > 0) Serial1.write(data[9]); //send checksum
}
uint8_t checksum (uint8_t * pdata, uint8_t len, uint8_t mode)
{
uint16_t tmp;
if (mode == CLASSIC) tmp = 0;
else tmp = pdata[0];
for (uint8_t i=1; i<=len; i++)
{
tmp = tmp + pdata;
if (tmp>255) tmp = tmp-255;
}
tmp = 255-tmp;
return tmp;
}
Hey Muehl,
thanks for your code snips,
i will use them to make a code around it and will test the compressor and heater, there are no special libraries, technically this is Serial write and the Lin HW based on UART right ?
I will get experimenting with the HW and update back to this thread,
thanks all for your help.
Karim
Hammer, Duct tape, WD-40 that`s it 
1973 Beetle with SDU swap.

1973 Beetle with SDU swap.
- muehlpower
- Posts: 679
- Joined: Fri Oct 11, 2019 10:51 am
- Location: Germany Fürstenfeldbruck
- Has thanked: 14 times
- Been thanked: 133 times
Re: VW A/C Compressor
I don't know why, but parts of the program disappear when uploaded to the forum!? i can not write an "i" in "[]" how it should be behind "data" and "pdata"
it is correct, i only use the standard uart connected to a LIN transceiver. (TJA1021)
it is correct, i only use the standard uart connected to a LIN transceiver. (TJA1021)
- 7yatna
- Posts: 77
- Joined: Wed Jul 06, 2022 2:49 am
- Location: San Diego, CA
- Has thanked: 4 times
- Been thanked: 7 times
Re: VW A/C Compressor
I saw that comment previously i will take care of it while writing the code.muehlpower wrote: ↑Mon Apr 03, 2023 6:52 pm I don't know why, but parts of the program disappear when uploaded to the forum!? i can not write an "i" in "[]" how it should be behind "data" and "pdata"
it is correct, i only use the standard uart connected to a LIN transceiver. (TJA1021)
Thanks again for confirming
Hammer, Duct tape, WD-40 that`s it 
1973 Beetle with SDU swap.

1973 Beetle with SDU swap.
- crasbe
- Posts: 285
- Joined: Mon Jul 08, 2019 5:18 pm
- Location: Germany
- Has thanked: 47 times
- Been thanked: 145 times
Re: VW A/C Compressor
The [] are interpreted as BBCode. You can either click the option "Disable BBCode" below the "Submit" button in the extended view or even better put the Code into [ code ] [/ code ] (without the whitespaces) tags, so it's properly displayed as code with indentation and scrollablemuehlpower wrote: ↑Mon Apr 03, 2023 6:52 pm I don't know why, but parts of the program disappear when uploaded to the forum!? i can not write an "i" in "[]" how it should be behind "data" and "pdata"
