Hi guys im trying to solve a problem i dont have enough knowledge about.
Im fairly new to arduino and programming in general but i do have some experience with arduino. My experience comes from an old BMW with a turbo controlled by speeduino.
But thats not really the topic i need help with. Ive been building a van with a modified engine and now i need more diesel at certain moments in time. Ive been trying to solve this and i have some things going on.
The situation is like this:
The amount of diesel injected is being determined by fuel pressure and the duty cycle of the injectors. Best way to reach what i want is to remap the car but these ECUs are not that easy. Thats why i would like to 'piggyback' the fuel pressure sensor with a ' tuning box'.
The pressure sensor receives ground and 5v from the cars regulated 5v source. i would like to power the arduino from this but i dont think thats going to give problems.
The fuel pressure is being measured in 0-5v (0/4,6 in reality) where 0 = 0 bar and 4,5 about 1600.
This gives a 40 bar increase if i could trim the signal back 0,1V to the ecu. I need to alter the voltage above a certain point and then for safety reasons trim it back to the original value around 4,5V.
Right now i purchased a Arduino Uno R3 and a MCP4725 12bit DAC. I've spent yesterday to try and come up with some code and it seems to work for what i would like to see happening. i can output the incoming voltage minus what I program in the forumula.
Im using a pot meter to simulate the 0/5v signal where blue is the incoming singal and green the modifyed PWM generated signal from the dac.
So put this setup into the signal line and everything is golden? i dont think so i guess the impedance of the circuit is to low so if i place my arduino in between the signal line it will probally burn the in and outputs? The ecu is kinda a black box for me regarding thins like amount of current flowing in the circuit. This is were i need help.
Ive been reading up into op amps to be able to flow more current or is it better to use a digitally controlled potentiometer on the signal line with a feedback to see what te actual voltage going out is?
If things work out and more diesel is injected the next thing woud probally be rescaling and clamping the MAP voltage so the ecu wont go into overboost. But thats another topic and maybe my conrods are already laying on the ground by then.
this is the code i came up with:
#include <Wire.h>
#include <Adafruit_MCP4725.h>
Adafruit_MCP4725 dac;
// Set this value to 9, 8, 7, 6 or 5 to adjust the resolution
#define DAC_RESOLUTION (9)
int value = 0;
float voltage;
float voltage2;
float state;
void setup(void) {
Serial.begin(9600);
Serial.println("MCP4725A1 Test");
// MCP4725A1 address is 0x62 (default)
// MCP4725A1 address is 0x63 (ADDR pin tied to VCC)
// MCP4725A1 address is 0x60 (ADDR pin tied to GND)
dac.begin(0x60); //I have my ADDR pin connected to GND so address is 0x60
}
void loop(void) {
dac.setVoltage((voltage2*4095)/5, false); //Set voltage to 1V
delay(0);
value = analogRead(A0);
voltage = value * 5.0/1023;
Serial.print("Voltage = ");
Serial.println(voltage);
delay(0);
state = voltage; // initial state
if (value >= 300 && value < 1050) // treshold set
state = voltage - 0.3 +(voltage*0.05); // 2nd state / parameters om curve af te stellen
voltage2 = state;
Serial.print("Voltage2 out = ");
Serial.println(voltage2);
delay(0);
}
I think this isnt rocket science and some of u probally have the answer im tryin to get to on my own.
Thanks in advance!