Need to trick vehicle ECU - need specific output based on input trigger Or how to multiply frequency

Hi all,

Totally new to Arduino. I have an problem and have been advised Arduino might be my solution.
I've recently installed an air suspension into a vehicle. This system has a ECU which taps into an ABS wheel speed sensor. At 50km/hr the system returns the suspension to normal. I need to trick the system to drop the suspension back to normal at 20km/hr. As such i'm hoping someone could give me guidance on how I can use an Arduino to read the signal, increase it's frequency by 2.5x. It's a 1V digital signal.

Signal at 50km/hr

You're help is appreciated.

Do you have any experience at all with microcontrollers ?

What you suggest is likley to be possible, but this is a very ambitious project for a complete beginner, given the potential safety and insurance issues with modifying a vehicle.

1 Like

Very little experience with microcontrollers. I'm an experienced automotive tech and understand vehicle systems. All i'm after is for the Arduino to output the incoming frequency at 2.5X the rate.

On second thought. All I need is for the Adruino to send a specific output once it see's a specific input. Anyone have a code for that?

It shouldn't be much trouble to accomplish.

The output can either be 2.5 times the input or output 50km/hr at any speed above 20km/hr.

First it would be good for you to know the signals you are working with are very slow compared to what the Arduino is capable of.

Your biggest problem will be "hardening" the Arduino to survive in the automotive electrical environment. Not that difficult but needs to be considered when you start to plan your packaging.

I'm assuming absolute time is not critical. By that I mean if the Arduino senses 20km/hr and 1 second later, this would be acceptable.

You probably also want some hysteresis so if the vehicle is going from 19 to 20 to 19 etc the suspension doesn't try to follow. Perhaps going to normal at 20 km/hr and reverting at 15 or 18 kmh.

I think the easiest way is to count the incoming signal using one of the Arduino pins that runs a specific bit of code when the input pin changes from low to high. This is called an interrupt and may sound daunting but is real easy.

Then next step is to create your output signal. This can be done in code with a function called millis() to toggle an output pin on and off.

You also might want to set an LED output on or off when the suspension changes.

First step is to purchase an Arduino. Any version will work. If you get one with a USB input it will make programming it easier.

But please, not a UNO! Very inconvenient mount and connect. A Nano for frequent re-programming, a Pro Mini - for wchih you need a separate USB interface module - for compactness.

You could do this pretty easily with an Arduino, but it seems like overkill - you can do much the same thing with discrete components - search for a frequency doubler circuit.

Thanks John,

I have an Uno. I was going to power the Arduino with a 9V battery for the time being as I've heard the units don't like vehicle voltage. 12v-14v.

The suspension only looks for a single trigger to deactivate, after that you need to manually activate it again, so no worries there.

Now, in regards to the code... I have no experience with this, and i'm hoping someone can help. :slight_smile:

Here is a program that measures frequency. It also has an LCD which you won't need.

//#include <LiquidCrystal.h>

//LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
#define pulse_ip 7
int ontime,offtime,duty;
float freq,period;
   
void setup()
{
  pinMode(pulse_ip,INPUT);
 /*
 lcd.begin(16, 4);
  lcd.clear();
  lcd.print("Freq:");
  lcd.setCursor(0,1);
  lcd.print("Ton:");
  lcd.setCursor(0,2);
  lcd.print("Toff:");  
  lcd.setCursor(0,3);
  lcd.print("Duty:");  
*/
}
void loop()
{
   ontime = pulseIn(pulse_ip,HIGH);
   offtime = pulseIn(pulse_ip,LOW);
   period = ontime+offtime;
   freq = 1000000.0/period;
   duty = (ontime/period)*100; 
  
/*
 lcd.setCursor(4,1);
   lcd.print(ontime);
   lcd.print("us");
   lcd.setCursor(5,2);
   lcd.print(offtime); 
   lcd.print("us");   
   lcd.setCursor(5,0); 
   lcd.print(freq);
   lcd.print("Hz");
   lcd.setCursor(6,3);
   lcd.print(duty); 
   lcd.print('%');
*/
   delay(1000);
}

Hey John,

Any chance you can walk me through this?

These are the key functions. The syntax is explained here.

If you know the input waveform is a Square wave you need only measure the ontime and multiply by 2 to get the frequency. If it is not a square wave yo must measure the on time and the off time then add them together.

The output frequency could be generated by tone