Close

ACC / EDC Cruise Control Part 2

A project log for Real Scania Truck Home Simulator

The Scrapyard and Arduino make a great combination!

jeroen-van-der-veldenJeroen van der Velden 12/18/2015 at 13:380 Comments

Today I started where I left with the ACC (Cruise Control). Now my code for the Retarder is ready and working, I might be able to use bits and pieces from the Retarder code to get the Cruise Control going.

In the Retarder LOGS I showed you that we had a 3 wire connection to our Arduino Leonardo. The Retarder is basically a 5v powered potentiometer.

The ACC buttons are two wire so we cant just put power on the line and measure voltage like with the Retarder. Actually we could, but I`d rather go for a two wire "Ohm Meter" setup because we know all the resistance values from the Scania Multi software.

Below is our setup, I soldered a 10k ohm resistor to my little board as our "known" resistor. The "unknown" resistor is each ACC button press. The code from the "Ohm Meter" tutorial will be modified to Keyboard.print our desired letter of choice for ETS2.

Link to picture

Above:

1# Connect 5v from your Leonardo to the White cable of the ACC connector

2# Connect A0 from your Leonardo to the Black/Purple wire of the ACC connector

3# Connect GND to one pole of your 10K ohm resistor

4# Connect A0 of the Leonardo to the other pole of the 10k ohm resistor

5# Check the picture above to double-check if everything is wired correctly

6# Download the code below to your Leonardo with Arduino IDE to test if all is right:

int analogPin= 0;
int raw= 0;
int Vin= 5;
float Vout= 0;
float R1= 10000;
float R2= 0;
float buffer= 0;

void setup()
{
Serial.begin(9600);
}

void loop()
{
raw= analogRead(analogPin);
if(raw) 
{
buffer= raw * Vin;
Vout= (buffer)/1024.0;
buffer= (Vin/Vout) -1;
R2= R1 * buffer;
Serial.print("Vout: ");
Serial.println(Vout);
Serial.print("R2: ");
Serial.println(R2);
delay(1000);
}
}
// by Jeroen van der Velden
// https://hackaday.io/project/8448-real-dashboard-truck-simulator
7# Below should be your result on your Serial Monitor in the Arduino IDE software:

8# Next step will be modifying code, I will keep you posted!

Discussions