Hyundai Genesis Forum banner

2013 haltech AC fix DIY

1 reading
28K views 74 replies 22 participants last post by  Boribk2  
#1 ·
Will start the tread unless something explode on version 3 should be running soon lol

Yes it does work

first testing phase









was hiding the project in a magarine bucket oh yeah




it did work fine for a while but arduino doesn't like to work that much over 12V

but it did work fine on my earlier use for other project

next build as a dc-to dc converter

i called some part for Version 2




but while waiting for it i saw much better so order version 3 lol




i built a plug and play extension to do the jobs outside the car and just plug it once in the car

first try was in 20 AWG but it doesn't do a good job
so redid the work in 22 AWG
Car wire is 28 AWG



you can only find one connector with pins the other gender only exist to fit on a board..so i had to improvise





 
#2 · (Edited)
the difference between BK1 and BK2 AC circuit


BK1 when you push the AC button it's hard wire to the pcm that when all condition are met will engage AC clutch


BK2 when you push the AC button ...to module send it request to the pcm via CAN BUS

when the pcm say it's ok hey send the info thru can bus

then the AC module will send a pulsed signal to the AC solenoid to start AC
 
#3 · (Edited)
CAN BUS info

sent by AC module

350 XX 10 XX XX XX XX XX XX : all off
350 XX 18 XX XX XX XX XX XX : AC off Fan on at low
350 XX 58 XX XX XX XX XX XX : AC off Fan on at high
350 XX 1B XX XX XX XX XX XX : AC on Fan on at low
350 XX 5B XX XX XX XX XX XX : AC on Fan on at high

for some reason the pcm read fan setting ...haven't seen any change about it in the haltech so will just get rid of that signal

the pcm reply with

316 05 XX XX XX XX XX XX XX : stop AC
316 45 XX XX XX XX XX XX XX : start AC

i saw one time 75 instead of 45 but 45,55,65,75 will start it anyway

but for some reason the ac module will not start AC with only the 316 45 XX XX XX XX XX XX XX : start AC

it need to have adress 329 and 18F present on the CAN BUS present whatever the data...probably a safety thing
but all this is irrelevant for the fix




Fix how does it work

the arduino read the can bus...if 350 adress data become 1B or 5B is change an output state ...to tell the haltech holla AC request

when AC is ok to start haltech will switch his output to advise arduino

arduino then start his pulsed output and drive the AC solenoid
 
#5 ·
having fun again

removing version 1



installing Version 3



but for some weird reason digital input don't activate AC request $%^* but they dont work for some other stuff

tried all input

finnaly endend trying the pulsed input....seem's to be working ...most of the time...talked to haltech about it will see what they say


that was the original idea...now wire have been moved a bit




like i said this work..





but not this

arggghh


 
#6 ·
Current arduino program



/***************************************************************************
Sebastien Moreau at s_moreau72@hotmail.com

used

Hobbytronics Leonardo CAN-BUS board

Receive Test Data and set filters on ID
Send output data via serial port

Leonardo CAN BUS product page Leonardo CAN BUS board | L-CANBUS | HobbyTronics

Hobbytronics.co.uk

For mcp_can use this library https://github.com/reeedstudio/CAN_BUS_Shield
download the ZIP at the right of the screen
and insert what IN the zip folder into the library
rebbot arduino software
****************************************************************************/
#include <mcp_can.h>
#include <mcp_can_dfs.h>
#include <SPI.h>

unsigned int rxId;
unsigned char rxLen = 0;
unsigned char rxBuf[8];
volatile unsigned char canData = 0;
int AcReq = LOW;
int AcInputValue = LOW;
int Pulse=0;
int AcMem = LOW;
MCP_CAN CAN0(17); // Set CS to pin 17



void setup() {
// put your setup code here, to run once:

Serial.begin(9600);
CAN0.begin(CAN_500KBPS); // init can bus : baudrate = 500k
attachInterrupt(4, can_receive, FALLING); // Pin D7 is Interrupt4 on Leonardo
Serial.println("MCP2515 Library Receive Example...");

pinMode(6, OUTPUT); // AC request status
pinMode(8, INPUT_PULLUP); // AC status input
pinMode(9, OUTPUT); // Variable output for AC solenoid
analogWrite(9,0);// AC solenoid to 0V
pinMode(23, OUTPUT); // Led output activation
// *********************************************************
// Basic Filtering on ID
// *********************************************************
// Bytes 1 and 2 of mask/filter apply to ID
// So the Mask and filter below will only allow ID 0x350 through
// ---- ID -----
CAN0.init_Mask(0, 0, 0xFFFF); // 1111 1111 1111 1111
CAN0.init_Filt(0, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(1, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Mask(1, 0, 0xFFFF); // 1111 1111 1111 1111
CAN0.init_Filt(2, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(3, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(4, 0, 0x0350); // 0000 0011 0101 0000 - ACCEPT
CAN0.init_Filt(5, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
}

void loop() {
// put your main code here, to run repeatedly:

if(canData)
{
canData=0;
CAN0.readMsgBuf(&rxLen, rxBuf); // Read data: len = data length, buf = data byte(s)
rxId = CAN0.getCanId(); // Get message ID
/**
Serial.print("ID: ");
Serial.print(rxId, HEX);
Serial.print(" Data: ");
for(int i = 0; i < rxLen; i++) // Print each byte of the data
{
if(rxBuf < 0x10) // If data byte is less than 0x10, add a leading zero
{
Serial.print("0");
}
Serial.print(rxBuf, HEX);
Serial.print(" ");
}
Serial.println();
**/
//Evaluate AC request status ON or OFF

switch (rxBuf[1]) {
case 0x10:
AcReq = LOW;
break;
case 0x18:
AcReq = LOW;
break;
case 0x58:
AcReq = LOW;
break;
case 0x1B:
AcReq = HIGH;
break;
case 0x5B:
AcReq = HIGH;
break;
}

if (AcReq != AcMem) {
AcMem = AcReq;
Serial.print(" AcReq ");Serial.println(AcReq);
}
digitalWrite(6, AcReq);
digitalWrite(23, AcReq);

} // end if

// Read Haltech output and put AC ON or OFF accordingly

if (AcInputValue != digitalRead(8)) {
AcInputValue = digitalRead(8);
Serial.print("ACInputValue ");Serial.println(AcInputValue);

if (AcInputValue == HIGH) {
for (Pulse=200 ; Pulse >=0; Pulse--){
analogWrite(9,Pulse);
delay (3);
}

}
else {
for (Pulse=0 ; Pulse <=200; Pulse++){
analogWrite(9,Pulse);
delay (10);
}
}
}




}

void can_receive()
{
// CAN Receive Interrupt
canData = 1;
}
 
#7 ·
Looks like youve figured out a way to make pretty much a plug and play solution?

Id definitely be interested if this lets 2013 guys dabble with Haltech with no negative connotations or loss in drivability (AC is a must here).
 
#8 ·
i will see what haltech will repond about these input not working with AC activation

my first setup was using a boomslang extension so it was using PCM pin ...but boomslang is pricy $$ around 500$ just for the extension

so i was looking for something that somebody without the extension could still work with

will see how this pulsed input behave on the long run
 
#10 ·
new version of code for computer wiz lol


/***************************************************************************
Sebastien Moreau at s_moreau72@hotmail.com

used

Hobbytronics Leonardo CAN-BUS board

Receive Test Data and set filters on ID
Send output data via serial port

Leonardo CAN BUS product page Leonardo CAN BUS board | L-CANBUS | HobbyTronics

Hobbytronics.co.uk

For mcp_can use this library https://github.com/reeedstudio/CAN_BUS_Shield
download the ZIP at the right of the screen
and insert what IN the zip folder into the library
rebbot arduino software
****************************************************************************/
#include <mcp_can.h>
#include <mcp_can_dfs.h>
#include <SPI.h>

unsigned int rxId;
unsigned char rxLen = 0;
unsigned char rxBuf[8];
volatile unsigned char canData = 0;
int AcReq = LOW;
int AcInputValue = LOW;
int Pulse=0;
int AcMem = LOW;
long CommCheck1 = 0; //check if communication is working if not do a reset
long CommCheck2 = 0;
MCP_CAN CAN0(17); // Set CS to pin 17



void setup() {
// put your setup code here, to run once:

Serial.begin(9600);
CAN0.begin(CAN_500KBPS); // init can bus : baudrate = 500k
attachInterrupt(4, can_receive, FALLING); // Pin D7 is Interrupt4 on Leonardo

pinMode(6, OUTPUT); // AC request status to send to haltech
pinMode(8, INPUT_PULLUP); // AC status input to read haltech AC confirmation
pinMode(9, OUTPUT); // Variable output for AC solenoid
analogWrite(9,0);// AC solenoid to 0V
pinMode(23, OUTPUT); // Led output activation mimic AC request



// *********************************************************
// Basic Filtering on ID
// *********************************************************
// Bytes 1 and 2 of mask/filter apply to ID
// So the Mask and filter below will only allow ID 0x350 through
// ---- ID -----
CAN0.init_Mask(0, 0, 0xFFFF); // 1111 1111 1111 1111
CAN0.init_Filt(0, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(1, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Mask(1, 0, 0xFFFF); // 1111 1111 1111 1111
CAN0.init_Filt(2, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(3, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(4, 0, 0x0350); // 0000 0011 0101 0000 - ACCEPT
CAN0.init_Filt(5, 0, 0x0001); // 0000 0000 0000 0001 - FAIL



}

void loop() {
// put your main code here, to run repeatedly:


//*****************Check if comm is operational if not do a reset***************************

++CommCheck1; //increase loop counter and check for comm fault if no comm then reset comm port

if (CommCheck1 == 200000) {
CommCheck1 = 0 ;
if (CommCheck2 == 0) {
CAN0.begin(CAN_500KBPS); // reset comm port
attachInterrupt(4, can_receive, FALLING); // Pin D7 is Interrupt4 on Leonardo

// *********************************************************
// Basic Filtering on ID
// *********************************************************
// Bytes 1 and 2 of mask/filter apply to ID
// So the Mask and filter below will only allow ID 0x350 through
// ---- ID -----
CAN0.init_Mask(0, 0, 0xFFFF); // 1111 1111 1111 1111
CAN0.init_Filt(0, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(1, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Mask(1, 0, 0xFFFF); // 1111 1111 1111 1111
CAN0.init_Filt(2, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(3, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(4, 0, 0x0350); // 0000 0011 0101 0000 - ACCEPT
CAN0.init_Filt(5, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
Serial.println("Had to reset comm port");
}
else {
Serial.print("Comm port is OK received X amount of data: "); Serial.println(CommCheck2);
CommCheck2 = 0 ;
}
}
//*************************End of comm check*****************************************


//************************If data is received treat it********************************

if(canData)
{
canData=0;
++CommCheck2; // increase if data is receive
CAN0.readMsgBuf(&rxLen, rxBuf); // Read data: len = data length, buf = data byte(s)
rxId = CAN0.getCanId(); // Get message ID
/**
Serial.print("ID: ");
Serial.print(rxId, HEX);
Serial.print(" Data: ");
for(int i = 0; i < rxLen; i++) // Print each byte of the data
{
if(rxBuf < 0x10) // If data byte is less than 0x10, add a leading zero
{
Serial.print("0");
}
Serial.print(rxBuf, HEX);
Serial.print(" ");
}
Serial.println();
**/
//Evaluate AC request status ON or OFF

switch (rxBuf[1]) {
case 0x10:
AcReq = LOW;
break;
case 0x18:
AcReq = LOW;
break;
case 0x58:
AcReq = LOW;
break;
case 0x1B:
AcReq = HIGH;
break;
case 0x5B:
AcReq = HIGH;
break;
}

if (AcReq != AcMem) {
AcMem = AcReq;
Serial.print("AC demand from car 0 NO, 1 YES: ");Serial.println(AcReq);
}
digitalWrite(6, AcReq);
digitalWrite(23, AcReq);

} // end if

//************************END of received data treatment***********************

//************* Read Haltech output and put AC ON or OFF accordingly************************
//*** max pulse is at 200 that give around 10V that is what i have seen on stock system***

if (AcInputValue != digitalRead(8)) {
AcInputValue = digitalRead(8);
Serial.print("AC confirmation from haltech 0 GO, 1 take a brake: ");Serial.println(AcInputValue);

if (AcInputValue == HIGH) {
for (Pulse=200 ; Pulse >=0; Pulse--){
analogWrite(9,Pulse);
delay (3);
}

}
else {
for (Pulse=0 ; Pulse <=200; Pulse++){
analogWrite(9,Pulse);
delay (10);
}
}
}

//************End of input and AC driving**********************************************


}

void can_receive()
{
// CAN Receive Interrupt
canData = 1;
}
 
#11 ·
I have been reading through your post and code (good work btw). This might be a dumb question, you are just creating a conversion of the signal to the Haltech to output to the A/C to turn on? Couldn't you just bypass PCM communication and have the A/C switch directly communicate to A/C with Arduino?
 
#15 ·
I am in the same boat wanting to reflash stock PCM. The custom tunes that are being offered are different PCM units? I'll probably get more serious about extracting the ROM off the PCM when I get full bolt ons etc.

Does the Haltech come with a base fuel map for the Gencoupe?

Every car is different and perhaps the 'safety margins' of the tune may cover all gencoupes, but I am not convinced that this is the way to maximize efficiency/tuning on these cars (although they have been somewhat proven, I like having control of what I am tweaking).
 
#16 ·
you can get a custom tune on stock pcm if you send your

but the ROM definition is not open source..i think el domino gave on that working on win OLS was not perfect but was a good beginning

after that you need the tool the write into the pcm via the BDM port

yes haltech as a base map...for 2012 ...

you have to rescale map and tip and injector

after that your good to go...

my biggest problem ..(i'm no tuner just a electrician) is idle on startup and when AC kick in and out

and at some point you just want to drive lol...so the issue at start up are there for a couple seconds on a cold engine the rest is fine so i said good enough..for now lol

in my case a bought an haltech O2 wide band ,,that kinda helped...it's not auto tune...but since it's always there it help to tune
 
#17 · (Edited)
here is some of the part

arduino case 10.23 can$ + shipping
Box for Arduino - RobotShop
was an arduino originally so stuck with it

digistump mosfet kit DSK-0007
newark/element 14 part 87W9363 7.03 can$ + shipping
DSK-00007 DIGISTUMP More Tools & Production Supplies | 87W9363 | Newark element14 Canada
or here
Mosfet Kit - Digistump
but they seem to be always out of stock at digistump

the brain leonardo can bus
34.52 euro + shipping
Leonardo CAN BUS board | L-CANBUS | HobbyTronics


pin for connector ..around 100 unit ...better have some spare lol
17.20 can$ for 100
1318143-1 TE Connectivity | Mouser

AC male connector
2.93 can$
1318389-1 TE Connectivity | Mouser

AC femel connector
9.68 can$
1376113-8 TE Connectivity / AMP | Mouser

Haltech aux connector
2.74 can $
1318386-1 TE Connectivity | Mouser

Wire ,, 20 awg a started with that but it's way to big for the connector
40.08 can$ for 100 feet
could probably all do it in 24
3053 BK005 Alpha Wire | Mouser

wire 24 awg neccessary for the connector... probably the only one needed...for a DIY
31.77 can$ for 100 feet
3050 BK005 Alpha Wire | Mouser

the dc to dc supply LM2596S
****ing cheap lol
http://www.ebay.ca/itm/1pcs-LM2596S...-Buck-Converter-Step-Down-Module-5V-3A-LM2596-/271351841796?hash=item3f2dd48404

and some 1/8 heat shrink with glue ...that i took locally

that about it for part
 
#18 ·
Ok building process

wire extender

you need 32 * 6 inch 24 awg jumper with pins on both end

you need some small needle nose plier to crunch pin flat..you can use the cutter of the plier to squiz it firmly...make sure it hold's firmly

then you insert all the wire except 34 and 35 than don't need to cross over (* indicate empty spot)

the pin need to be well crimp specialt side to side other wise it will be fun to insert into the connector





3 time 6 feet ddepending on your pcm location under hood it a bit short

WARNING this one show connector from back...previous was from front



you use tape/abrasion tape/loom or what ever



don't forget to mark you wire



you need 34* 1 1/4 (approx) heat shrink tube






insert the pin in the facing connector...start with the row with the most wire



make sur your connector is in the right position ...doh



push the shrink all the way, making sure not to cover the pin on the other side...



do the same thing on the other side and add the 2 solenoid wire (around 18 inch)



it should look like this




now heat gun time...do go to crazy and melt the connector



for extra safety i used a glue gun and jamm everything in there




after that use a sharp knive to remove 3,12,13,39 insulation....not your finger ....yes i did it ok ok




use 3 wire 18 inch and insert them in 12,13,39 and twist




i used the 34 solenoid wire and pass it thru and twist into wire 3 (power)



weld everything



use some real tape..not the cheap stuff..much better





mark the wire and tape them together

i you have 5 wire your good to go

 
#20 ·
time to start welding those wire

wire from the car
39-ground goes to gnd
3 hot in start (we used the wire into 34 and welded it to 3) goes into V In
35 goes into out

the P5 wire will go to D9 of the arduino



from car
12 (can low) goes to canL
13 (can high) geso to canH

for dc to dc regulator (adjusted at 5V)

out+ goes to V+
out- goes to 0V

from haltech connector

DPI1 (7)goes to D6
DSO1 (13)goes to D8
ground (12) goes to GND
the P5 from mosfet goes into D9



final welding

you need you weld theinput from the Dc to dc converter

in+ to Vin
in- to gnd

 
#21 ·
go crazy a do a testing harness lol

i had my first harness so i cut it in half and did some testing with it lol...not neccessary for only one



glue everything in the case..or use some tape and make sure no part will touch




now time to program the chip

download arduino software here

https://www.arduino.cc/en/Main/Software

install it

download library for the board download the zip file

https://github.com/reeedstudio/CAN_BUS_Shield

extract and insert into the arduino library folder

document/arduino/librairies and
document/arduino/arduino/librairies

you only need one but i gorgot wich one ...doh


in tools select
board:arduino leonardo
com: select the right one
and com


here is the program

/***************************************************************************
Sebastien Moreau at s_moreau72@hotmail.com

used

Hobbytronics Leonardo CAN-BUS board

Receive Test Data and set filters on ID
Send output data via serial port

Leonardo CAN BUS product page Leonardo CAN BUS board | L-CANBUS | HobbyTronics

Hobbytronics.co.uk

For mcp_can use this library https://github.com/reeedstudio/CAN_BUS_Shield
download the ZIP at the right of the screen
and insert what IN the zip folder into the library
rebbot arduino software
****************************************************************************/
#include <mcp_can.h>
#include <mcp_can_dfs.h>
#include <SPI.h>

unsigned int rxId;
unsigned char rxLen = 0;
unsigned char rxBuf[8];
volatile unsigned char canData = 0;
int AcReq = LOW;
int AcInputValue = LOW;
int Pulse=0;
int AcMem = LOW;
long CommCheck1 = 0; //check if communication is working if not do a reset
long CommCheck2 = 0;
MCP_CAN CAN0(17); // Set CS to pin 17



void setup() {
// put your setup code here, to run once:

delay (250); // wait a bit
Serial.begin(9600);
CAN0.begin(CAN_500KBPS); // init can bus : baudrate = 500k
attachInterrupt(4, can_receive, FALLING); // Pin D7 is Interrupt4 on Leonardo

pinMode(6, OUTPUT); // AC request status to send to haltech
pinMode(8, INPUT_PULLUP); // AC status input to read haltech AC confirmation
pinMode(9, OUTPUT); // Variable output for AC solenoid
analogWrite(9,0);// AC solenoid to 0V
pinMode(23, OUTPUT); // Led output activation mimic AC request


delay (250); //wait a bit
// *********************************************************
// Basic Filtering on ID
// *********************************************************
// Bytes 1 and 2 of mask/filter apply to ID
// So the Mask and filter below will only allow ID 0x350 through
// ---- ID -----
CAN0.init_Mask(0, 0, 0xFFFF); // 1111 1111 1111 1111
CAN0.init_Filt(0, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(1, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Mask(1, 0, 0xFFFF); // 1111 1111 1111 1111
CAN0.init_Filt(2, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(3, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(4, 0, 0x0350); // 0000 0011 0101 0000 - ACCEPT
CAN0.init_Filt(5, 0, 0x0001); // 0000 0000 0000 0001 - FAIL



}

void loop() {
// put your main code here, to run repeatedly:


//*****************Check if comm is operational if not do a reset***************************

++CommCheck1; //increase loop counter and check for comm fault if no comm then reset comm port

if (CommCheck1 == 200000) {
CommCheck1 = 0 ;

//if we didn't receive any message reset the port

if (CommCheck2 == 0) {
CAN0.begin(CAN_500KBPS); // reset comm port
attachInterrupt(4, can_receive, FALLING); // Pin D7 is Interrupt4 on Leonardo

// *********************************************************
// Basic Filtering on ID
// *********************************************************
// Bytes 1 and 2 of mask/filter apply to ID
// So the Mask and filter below will only allow ID 0x350 through
// ---- ID -----
CAN0.init_Mask(0, 0, 0xFFFF); // 1111 1111 1111 1111
CAN0.init_Filt(0, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(1, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Mask(1, 0, 0xFFFF); // 1111 1111 1111 1111
CAN0.init_Filt(2, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(3, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(4, 0, 0x0350); // 0000 0011 0101 0000 - ACCEPT
CAN0.init_Filt(5, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
Serial.println("Had to reset comm port, no communication!!");
}

//if we received to many message ...the filter didn't work...reset the port
else if (CommCheck2 > 1000) {

CAN0.begin(CAN_500KBPS); // reset comm port
attachInterrupt(4, can_receive, FALLING); // Pin D7 is Interrupt4 on Leonardo

// *********************************************************
// Basic Filtering on ID
// *********************************************************
// Bytes 1 and 2 of mask/filter apply to ID
// So the Mask and filter below will only allow ID 0x350 through
// ---- ID -----
CAN0.init_Mask(0, 0, 0xFFFF); // 1111 1111 1111 1111
CAN0.init_Filt(0, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(1, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Mask(1, 0, 0xFFFF); // 1111 1111 1111 1111
CAN0.init_Filt(2, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(3, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
CAN0.init_Filt(4, 0, 0x0350); // 0000 0011 0101 0000 - ACCEPT
CAN0.init_Filt(5, 0, 0x0001); // 0000 0000 0000 0001 - FAIL
Serial.print("Had to reset comm port, filter didn't work : ");Serial.println(CommCheck2);
CommCheck2 = 0 ;
}

//
else {
Serial.print("Comm port is OK received X amount of data: "); Serial.println(CommCheck2);
CommCheck2 = 0 ;
}
}
//*************************End of comm check*****************************************


//************************If data is received treat it********************************

if(canData)
{
canData=0;
++CommCheck2; // increase if data is receive
CAN0.readMsgBuf(&rxLen, rxBuf); // Read data: len = data length, buf = data byte(s)
rxId = CAN0.getCanId(); // Get message ID
/**
Serial.print("ID: ");
Serial.print(rxId, HEX);
Serial.print(" Data: ");
for(int i = 0; i < rxLen; i++) // Print each byte of the data
{
if(rxBuf < 0x10) // If data byte is less than 0x10, add a leading zero
{
Serial.print("0");
}
Serial.print(rxBuf, HEX);
Serial.print(" ");
}
Serial.println();
**/
//Evaluate AC request status ON or OFF

switch (rxBuf[1]) {
case 0x10:
AcReq = LOW;
break;
case 0x18:
AcReq = LOW;
break;
case 0x58:
AcReq = LOW;
break;
case 0x1B:
AcReq = HIGH;
break;
case 0x5B:
AcReq = HIGH;
break;
}

if (AcReq != AcMem) {
AcMem = AcReq;
Serial.print("AC demand from car 0 NO, 1 YES: ");Serial.println(AcReq);
}
digitalWrite(6, AcReq);
digitalWrite(23, AcReq);

} // end if

//************************END of received data treatment***********************

//************* Read Haltech output and put AC ON or OFF accordingly************************
//*** max pulse is at 200 that give around 10V that is what i have seen on stock system***

if (AcInputValue != digitalRead(8)) {
AcInputValue = digitalRead(8);
Serial.print("AC confirmation from haltech 0 GO, 1 take a brake: ");Serial.println(AcInputValue);

if (AcInputValue == HIGH) {
for (Pulse=200 ; Pulse >=0; Pulse--){
analogWrite(9,Pulse);
delay (3);
}

}
else {
for (Pulse=0 ; Pulse <=200; Pulse++){
analogWrite(9,Pulse);
delay (10);
}
}
}

//************End of input and AC driving**********************************************


}

void can_receive()
{
// CAN Receive Interrupt
canData = 1;
}


upload it to the device...click the arrow saying upload


do a quick check

and open the serial monitor window

tool / serial monitor

you will only see that there is no comm and port is reset

this is a normal exemple when connected to car





uncheck factory a/c input and program DPI1 as follow



and programs DSO1 as follow

 
#24 ·
Genius!!!