STD
Homemade. TURBO BOOST / RPM Meter - Printable Version

+- STD (https://www.superturbodiesel.com/std)
+-- Forum: Tuning (https://www.superturbodiesel.com/std/forumdisplay.php?fid=6)
+--- Forum: Engine (https://www.superturbodiesel.com/std/forumdisplay.php?fid=7)
+--- Thread: Homemade. TURBO BOOST / RPM Meter (/showthread.php?tid=2112)

Pages: 1 2


Homemade. TURBO BOOST / RPM Meter - olefejer - 01-03-2011

Just got my homemade Boost and RPM meter to work.
I made it because i Want a very small meter to fit in the sunglasses compartment in the R129.

Here is a list of what part i used

Audrino Board
http://www.arduino.cc
http://cgi.ebay.de/ws/eBayISAPI.dll?ViewItem&item=280542822337&ssPageName=STRK:MEWNX:IT#ht_2847wt_905

LCD (importent is that it is serial, only takes 2 pin on the board.)
http://cgi.ebay.de/ws/eBayISAPI.dll?ViewItem&item=130447724258&ssPageName=STRK:MEWNX:IT

2 X "3 Bar boost/MAP sensor, Boost Pressure Map Sensor Apexi AVC-R HKS EVC-S Greddy
"
http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=120580140996&ssPageName=ADME:X:RTQ:GB:1123#ht_1701wt_905

Turbo RPM (HE351VE it need to have a sensor 2 wire)
The 2 Wire from the Turbo RPM sensor is attatched to Ground and the other to a digital input directly.
Then i messure the time it takes before the turbo has rotatet 100 times. by 90,000 RPM it took 66 mS. i the calculate the RPM 6000,000 / 66 = 90,000

Boost
The MapSensor is connectet to 2 X analog input 0.5 V is -1 bar, 4,5 V is 3 bar = 45 PSI.
And it also saves MAX EGP and Boost.

Motor RPM
Also working, same as Turbo RPM

I now also have a Fuel-flow sensor to give me instant MPG

Next project is to have one of the PWM output on the board control my vacuum valve witch is controlling the turbo.


RE: Homemade. TURBO BOOST / RPM Meter - tomnik - 01-04-2011

"Next project is to have one of the PWM output on the board control my vacuum valve witch is controlling the turbo. "

why?
I understood that you already control the VTG with you big controller.
If you can manage to control the VTG with the Arduino, I am interested in one.
Some guys here already worked on a controller based on Arduino...

Tom


RE: Homemade. TURBO BOOST / RPM Meter - E300TSC - 01-04-2011

Nice job!


RE: Homemade. TURBO BOOST / RPM Meter - olefejer - 01-04-2011

(01-04-2011, 05:59 AM)tomnik "Next project is to have one of the PWM output on the board control my vacuum valve witch is controlling the turbo. "

why?
I understood that you already control the VTG with you big controller.
If you can manage to control the VTG with the Arduino, I am interested in one.
Some guys here already worked on a controller based on Arduino...

Tom
Today i use 2 vacuum valve one to control the difference pressure to around 0,5 bar, i newer want the EGP to go higher then 0,5 bar higher then boost. the other valve to control max boost.

Width the Arduino board it is possible to only use one valve and control the boost, regarding TPS, RPM it is much more flexible.
The other controllers has been width a stepper motor.
I simply use a 0 - 100% PWM signal to drive the vacuum valve.
The code is not secret but nut pretty :-)



RE: Homemade. TURBO BOOST / RPM Meter - winmutt - 01-04-2011

I am confused about the boost sensor, you say its measuring EGP, how is it measuring both intake and manifold pressure?


RE: Homemade. TURBO BOOST / RPM Meter - olefejer - 01-04-2011

(01-04-2011, 12:50 PM)winmutt I am confused about the boost sensor, you say its measuring EGP, how is it measuring both intake and manifold pressure?
I have 2 X boost sensor, the one messure Boost and one messure EGP (Exhaust Gas Pressure)



RE: Homemade. TURBO BOOST / RPM Meter - winmutt - 01-04-2011

AH!.. How did you mount the EGP sensor without melting it? Seems like measuring EGP is way easier/cheaper than EGT


RE: Homemade. TURBO BOOST / RPM Meter - ForcedInduction - 01-04-2011

(01-04-2011, 02:49 PM)winmutt How did you mount the EGP sensor without melting it?

Same as everyone does mounting a gauge, at least two feet of tube between the manifold and sensor.

Cummins makes a good pressure differential sensor for their DPF. I don't know what pressure range its capable of but if you're controlling boost based on EGP:boost ratio that would be an easy way to measure the differential directly.


RE: Homemade. TURBO BOOST / RPM Meter - winmutt - 01-04-2011

So 2ft is far enough to keep the sensor from melting? I mean isn't the air temp inside the tube 1200F or whatever?


RE: Homemade. TURBO BOOST / RPM Meter - ForcedInduction - 01-04-2011

Gauges and sensors have no flow, the air in the tube is only compressed by the pressure in the manifold.


RE: Homemade. TURBO BOOST / RPM Meter - aaa - 01-04-2011

I don't think so, it's not like there's exhaust continuously flowing thru it to the other side. Without flow, heat would have to move very slowly, and presumably be dispersed before it reaches the sensor.


RE: Homemade. TURBO BOOST / RPM Meter - jeemu - 01-05-2011

Looking nice. Here JTY make s also that kind gauges


RE: Homemade. TURBO BOOST / RPM Meter - winmutt - 01-05-2011

Where are you placing this LCD? I was thinking last night that there are not a lot of places to put it and make it look good. I had planned on building my own A pod gauge cluster but and LCD, well that would be way cleaner...


RE: Homemade. TURBO BOOST / RPM Meter - olefejer - 01-05-2011

(01-04-2011, 05:16 PM)aaa I don't think so, it's not like there's exhaust continuously flowing thru it to the other side. Without flow, heat would have to move very slowly, and presumably be dispersed before it reaches the sensor.
Exactly i have first metal pipe, the rubber hose then a tiny fuelfilter at the lowest place width a 1,5 mm hole to drain water, and then some more hose, if water gets in the sensor it is gone.

(01-05-2011, 09:53 AM)winmutt Where are you placing this LCD? I was thinking last night that there are not a lot of places to put it and make it look good. I had planned on building my own A pod gauge cluster but and LCD, well that would be way cleaner...
In the R129 SL there is a Sunglass box on the top of the dasch board, The nice thing is its a perfect place for extra instruments, and you can close it when you want all to look stock :-)




RE: Homemade. TURBO BOOST / RPM Meter - winmutt - 01-07-2011

Wow that is pretty cool. Wish I had known that when I replaced my dash.


RE: Homemade. TURBO BOOST / RPM Meter - olefejer - 01-10-2011

Now the VNT / Boost controller works, i can now control Differential pressure EGP - Boost to what i want, and max boost to what i want.
If TPS is less then 40% then i let EGP go to 0,15 bar over boost.
IF TPS is more then 40% the EGP is 0,5 bar over boost.

The Controller controls a Vacuum valve 100% PWM is 100% Wacuum vanes closed.

Here is how to build it.



RE: Homemade. TURBO BOOST / RPM Meter - ForcedInduction - 01-11-2011

Very nice. Consider making a kit?


RE: Homemade. TURBO BOOST / RPM Meter - tomnik - 01-11-2011

no we are getting closer....

Is it possible to determine set boost with a poti giving pedal position?
The more you press the pedal the higher the set boost.
Then move the vanes to "close" until the set boost is reached.
PID control.
The curve "set boost over pedal position" could be linear in first step but later can have any shape to achieve smokeless harmonic power development.

If you guide me I will buy such a board and start but I have absolutely no idea how to do it.
Or following the idea of FI you offer a kit or the code.

Tom


RE: Homemade. TURBO BOOST / RPM Meter - ForcedInduction - 01-11-2011

(01-11-2011, 01:15 AM)tomnik The more you press the pedal the higher the set boost.

That is what I'm looking for.


RE: Homemade. TURBO BOOST / RPM Meter - 300D50 - 01-11-2011

Makes me wish I had a turbo engine and a vnt, I likely could knock the entire thing out, including an egt gauge in there, in under a week...
Le Sigh...

Looks good so far, are you planing to condense it down to an atmega on a custom board once it's fully working?




RE: Homemade. TURBO BOOST / RPM Meter - winmutt - 01-11-2011

(01-11-2011, 01:20 AM)ForcedInduction
(01-11-2011, 01:15 AM)tomnik The more you press the pedal the higher the set boost.

That is what I'm looking for.

There is only one OEM solution for this and its an ON/OFF switch on WOT on the 87 linkage for the automatic.

Wouldnt the rack sensor provide what you want?


RE: Homemade. TURBO BOOST / RPM Meter - winmutt - 01-11-2011

You are using the Garrett turbo with the Hella actuator? PWM @ 140hz? Interesting and easy solution with the mosfet. This makes me want to dig up my board and actuator and get to work even though I dont have a turbo!

Like I said using EGP is way easier than working with EGT. Also I have everything I need to do EGT now. Also, the voltage regulator on board is good for 14v but anything past that and you have a blown board. If there was ever a alternator regulator failure you would need a new board. Good that you have a solution for that.

(01-10-2011, 05:15 PM)olefejer Now the VNT / Boost controller works, i can now control Differential pressure EGP - Boost to what i want, and max boost to what i want.
If TPS is less then 40% then i let EGP go to 0,15 bar over boost.
IF TPS is more then 40% the EGP is 0,5 bar over boost.

The Controller controls a Vacuum valve 100% PWM is 100% Wacuum vanes closed.

Here is how to build it.




RE: Homemade. TURBO BOOST / RPM Meter - tomnik - 01-11-2011

the VW TDIs do it like this.
Just put a poti on the linkage or use the VCV signal to the auto tranny with a vacuum converter (vac- 0-5V).

If you don't need this because you don't have a turbo then get one and do it or just do it for the community!

Tom

(01-11-2011, 10:13 AM)winmutt
(01-11-2011, 01:15 AM)tomnik The more you press the pedal the higher the set boost.

That is what I'm looking for.

There is only one OEM solution for this and its an ON/OFF switch on WOT on the 87 linkage for the automatic.

Wouldnt the rack sensor provide what you want?
[/quote]

btw. what is this ON/OFF switch on the tranny linkage for?


RE: Homemade. TURBO BOOST / RPM Meter - winmutt - 01-11-2011

(01-11-2011, 11:22 AM)tomnik the VW TDIs do it like this.
Just put a poti on the linkage or use the VCV signal to the auto tranny with a vacuum converter (vac- 0-5V).

If you don't need this because you don't have a turbo then get one and do it or just do it for the community!

Tom

(01-11-2011, 10:13 AM)winmutt
(01-11-2011, 01:15 AM)tomnik The more you press the pedal the higher the set boost.

That is what I'm looking for.

There is only one OEM solution for this and its an ON/OFF switch on WOT on the 87 linkage for the automatic.

Wouldnt the rack sensor provide what you want?

btw. what is this ON/OFF switch on the tranny linkage for?
[/quote]

Im assuming EGR/ARV info. It sits where the 3/2 valves usually are on the cover.


RE: Homemade. TURBO BOOST / RPM Meter - olefejer - 01-11-2011

(01-11-2011, 01:20 AM)ForcedInduction
(01-11-2011, 01:15 AM)tomnik The more you press the pedal the higher the set boost.

That is what I'm looking for.

Thats not a big problem width the HE351 it build a bit slow :-),
But did it anyway, this is a part of the code. where the Turbo is controlled.


//TPS in %
tps_raw = analogRead(3); //reads tps from 0 - 5 V sensor 0 - 1024
tps_raw = constrain(tps_raw, 100, 614); //limits range of sensor values to between 100, 614 messure 0,5 - 3 Volt, 0, 1024 messure from 0 - 5 V specific to my sensor
tps = map(tps_raw, 100, 614, 0, 100); //start 0% at 0,5 V and says 100% at 614 = 3 V

//Here we read the EGP sensor and conwert it to Bar 1 bar = 15 PSi, (0.5 volt = - 1 bar 4.5 volt = 3 bar )
egp_raw_avg = analogRead(1);
tjekker = analogRead(1);
egp_raw = (egp_raw_avg + egp_raw * 10) / 11; //filter, spikes are supressed
egp_raw = constrain(egp_raw, 300, 1024); // limits range of sensor values to between 0 - 3,5 bar the 307 is = atmosfaric pressure on this sensor
egp = map(egp_raw, 300, 1024, 0, 350); // map the 0 - 1024 input to 0 - 350 milibar
if(egp > egp_max) {egp_max = egp;} //Constantly keep track of max pressure

//Here we read the BOOST sensor and conwert it to MiliBar 100 milibar = 15 PSi, (0.5 volt = - 1 bar 4.5 volt = 3 bar )
boost_raw_avg = analogRead(2); //reads boost 3 Bar 0 Volt = -1,5 bar 5 volt + 3,5 bar
boost_raw = (boost_raw_avg + boost_raw * 10) / 11; //filter
boost_raw = constrain(boost_raw, 300, 1024); // limits range of sensor values to between 0 - 3,5 bar the 307 is = atmosfaric pressure on this sensor
boost = map(boost_raw, 300, 1024, 0, 350); // map the 0 - 1024 input to 0 - 350 milibar
if(boost > boost_max) {boost_max = boost;}

//Controlling Delta pressure between EGP and Boost, And Max boost regarding TPS we dont want the EGP to go to higt widthout also Boost rising
if( tps > 0) {max_dif_pressure = 10; max_boost = 50;}
if( tps > 10) {max_dif_pressure = 15; max_boost = 60;}
if( tps > 20) {max_dif_pressure = 20; max_boost = 70;}
if( tps > 30) {max_dif_pressure = 25; max_boost = 80;}
if( tps > 40) {max_dif_pressure = 30; max_boost = 90;} //if TPS bigger then 40%, max_dif_pressure 40 = 0,20 bar, (Crusing low EGP)
if( tps > 50) {max_dif_pressure = 35; max_boost = 100;}
if( tps > 60) {max_dif_pressure = 40; max_boost = 110;}
if( tps > 70) {max_dif_pressure = 40; max_boost = 130;}
if( tps > 80) {max_dif_pressure = 40; max_boost = 160;}
if( tps > 90) {max_dif_pressure = 40; max_boost = 200;}

//IF differential pressure to high wastegate starts open or VNT opens
boost_reg = 255 - (((egp - ( max_dif_pressure + boost ))) * delta_p_sloope) ;

//Max boost control.
if (boost > max_boost) {boost_reg = 255- (boost - max_boost)*10 ; } //254 -(100-90)*10 = boostreg = 150
if (boost_reg > 255) {boost_reg =255;}
if (boost_reg < 1) {boost_reg =0;}

//Controlling the vacuum valve on the Turbo
analogWrite(11,boost_reg); //This makes the PWM signal out to pin 11. connectet to the mosfet

(01-11-2011, 12:47 AM)ForcedInduction Very nice. Consider making a kit?

Not really but it is not that defficult. you can download the software for free to program the board, you can have the code from me. for free
It will newer be a big buisness anyway. :-)
http://arduino.cc/en/Main/Software

(01-11-2011, 04:55 AM)300D50 Makes me wish I had a turbo engine and a vnt, I likely could knock the entire thing out, including an egt gauge in there, in under a week...
Le Sigh...

Looks good so far, are you planing to condense it down to an atmega on a custom board once it's fully working?
See what you mean, that would be nice but iam not into making PCB. I just use whats out there, and the god thing width the arduino board is that anybody width a PC, USB, Cable and the code can change all parameters to the exact need.


RE: Homemade. TURBO BOOST / RPM Meter - ForcedInduction - 01-11-2011

(01-11-2011, 10:13 AM)winmutt There is only one OEM solution for this and its an ON/OFF switch on WOT on the 87 linkage for the automatic.

Wouldnt the rack sensor provide what you want?

There are many solutions. A potentiometer is not difficult to install and the TPS on the 96-97 E300 is external with a bowden cable ball.
http://www.youtube.com/watch?v=js4AsFm9plk
   


RE: Homemade. TURBO BOOST / RPM Meter - Spaceraver - 01-13-2011

Holy.. I might steal that part Ole.. Or at least the code... I have two Arduino's laying in my window doing nothing. Could you post the whole code to pastebin or somewhere that keeps the indentation right?


RE: Homemade. TURBO BOOST / RPM Meter - tomnik - 01-14-2011

could we do the following:

-we discuss what we want
-we discuss the necessary parts
the ones who know how to program this will create the code (the others follow up)
-at the end of the day the group has identical hardware and code and we can discuss the fine tuning on our cars
-it would be great to do this as a common project with homework step by step

I tried hard to find a plug and play solution but without result.
As a newbie I am now at the point where I will buy an Arduino and start.
I will get it working but it will be easier and faster if we do it together.

Tom


RE: Homemade. TURBO BOOST / RPM Meter - olefejer - 01-14-2011

(01-13-2011, 09:58 PM)Spaceraver Holy.. I might steal that part Ole.. Or at least the code... I have two Arduino's laying in my window doing nothing. Could you post the whole code to pastebin or somewhere that keeps the indentation right?
No problem just steal, but share if you have any great idea.
I know the code is not nice. but it does work.
Code:

#include <Wire.h>
#include <LiquidCrystal_I2C.h> // 2 wirecumminication width the display
#include <EEPROM.h> //used to store total fuel and total km
LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display


long interval = 1000; //updating display every this numbers millisecond
int eeprom_10;
float totalL = 0;        //total Liter Fuel used
float kmprL =0;          //instant uses km / Liter
float Lprhr =0;          // Liter fuel / hour
int tps =0;              // Trottle position Sensor in %
int tps_raw =0;          // 0 to 1024
float tps_gear =0;

float boost =0;            //boost in bar
int boost_raw=0;
int boost_raw_avg=0;       //Boost in raw 0 - 1024 analog read
float boost_max =0;        //MAx Boost in raw 0 - 1024 analog read
float egp =0;              //EGP in Bar Exhaustgas pressure
int egp_raw=0;             //EGP in 0 - 1024 analog read  
int egp_raw_avg=0;         //EGP_avg in 0 - 1024 analog read  
float egp_max =0;          //Max egp in bar
int boost_reg =255;        //this is uset to regulate the wanes in the turbo 0 = fully åben 255 = fully closed
int delta_p_sloope =2;     //  0,1 bar to mutch dif pressure gives PWM=155 (255 is max closing vanes.)
int max_dif_pressure = 75; //100=0,5 bar 50=0,25 bar
int max_boost = 90;       // 90 = 0,9 bar  


//int c =0;                   //temp to analog pin 0

int j =0;                   //testing
int j_2 =0;                 //testing
int dd = 33;

int side=1;
int tid=0;
int secounds =0;
int minuts =0;
int timer =0;

int tester = 134;
int g =0;  
int h =0;
int kk=0;


//--------------------------------------------------------To control Slow loop-------
long previousMillis = 0;
long previousMillis_2 = 0;

//All we need to-------------------------------------------Display shift button----------
int buttonstate3 = 0;
int lastbuttonstate3 = 0;
int btre =0;

//All we need to-------------------------------------------Km/hr Sensor-------------------
int buttonstate2 = 0;
int lastbuttonstate2 = 0;
long kmcounts =0;
int bto =0;
int deltaTkm =0;
unsigned long kmtid1 =0; //tid
unsigned long kmtid2 =0; //tid

int totalkm =0;
float KmCountScale = 5400; //counts pr km
int KmPrHr=10;

//All we need to-------------------------------------------Fuel Sensor---------------------
int fuelsensorscale = 4843; //Fuesflow sensor this sensor gives 4844 counts / liter
int buttonstate = 0;
int lastbuttonstate = 0;
int fuelcounts =0;          //Antal fuel COUNTS
float fuelcounts2 =0;
int b =0;
float deltaTfuel = 1;       //times between a fuelcount used for Liter / hour
unsigned long d =0;         //tid
unsigned long e =0;         //tid

//All we need to count ------------------------------------Turbo RPM------------------------
int buttonstate4 =0;
int lastbuttonstate4 =0;
int turbo_counts =0;
int b_4 =0;
float deltaT_turbo=60000;
unsigned long turbo_t1=0;
unsigned long turbo_t2=0;
long RPM_turbo =0;
long RPM_turbo_max =0;

//All we need to count-------------------------------------Motor RPM------------------------
int buttonstate5 =0;
int lastbuttonstate5 =0;
long rpm_motor =0;
int b_5 =0;
int rpmT_motor=1;
unsigned long rpm_t1=0;
unsigned long rpm_t2=0;
//------------------------------------------------------------------------------------------

int addr = 0; //EEPROM adresse
int eepromgem =0; //used as a constant, when to save in EEprom

//----disse herunder er midlertidige til speed kontrol
int time_1 = 0;
int time_2 = 0;
int delta_time =0;

void setup()
{
  lcd.init();                      // initialize the lcd
  lcd.backlight();
  
  pinMode (4,INPUT); //RPM
  pinMode (5,INPUT); //Shift display
  pinMode (6,INPUT); //KM input
  pinMode (7,INPUT); //Turbo RPM
  pinMode (8,INPUT); //ikke i brug skal bruges til fuel
  
//if (c==0) {EEPROM.write(0,0); EEPROM.write(1,0); } //Slet EEPROM
  fuelcounts = EEPROM.read(0) * 256 + EEPROM.read(1); //TACHO count total fra EEPROM
  kmcounts   = EEPROM.read(2) * 256 + EEPROM.read(3);
  secounds   = EEPROM.read(4);  minuts = EEPROM.read(5); timer = EEPROM.read(6);

  eeprom_10 = EEPROM.read(10) * 256 + EEPROM.read(11);
  digitalWrite(4, LOW); // use internel pullup resistor on shift buttom
  digitalWrite(5, HIGH); // use  internel pullup on page shift
  digitalWrite(6, HIGH); // use  internel pullup resistor on fuel sensor
  digitalWrite(7, HIGH);  // Holset RPM sensor pull down is used
  digitalWrite(8, LOW);  // Brug intern pullup modstand på fuel sensor


  
  //fuelcounts2 = fuelcounts *100;
  lcd.begin(16, 2);
  pinMode(11, OUTPUT);   // sets the pin as output
  pinMode(10, OUTPUT);   // sets the pin as output
}

void loop()
{
      //The next 4 lines counts from the Fuel-sensor inputs
        buttonstate = digitalRead(6); //
        if (buttonstate != lastbuttonstate) { if (buttonstate == HIGH){ fuelcounts2++; b++; } lastbuttonstate = buttonstate; } //digital input fuel Sensor
        if (b==1) {e=d; d = millis(); deltaTfuel=(d-e); b=0;} //tid mellem counts afhængig af b>10 eller 100
        if (deltaTfuel > 1000) {deltaTfuel =1000;}

      //The next 4 lines counts from the  KM-sensor inputs
        buttonstate2 = digitalRead(6); //Digital pin 6 Speed input
        if (buttonstate2 != lastbuttonstate2) { if (buttonstate2 == HIGH){ kmcounts++; bto++; } lastbuttonstate2 = buttonstate2; }
        if (bto==1) {kmtid2=kmtid1; kmtid1 = millis(); deltaTkm=(kmtid1-kmtid2); bto=0;} //tid between counts afhængig af b>10 eller 100
        if (deltaTkm > 1000) {deltaTkm =1000;}

     //The next 4 lines counts from the  Turbo-RPM-sensor inputs
        buttonstate4 = digitalRead(4); //Digital Pin 7
        if (buttonstate4 != lastbuttonstate4) { if (buttonstate4 == HIGH){ b_4++; } lastbuttonstate4 = buttonstate4; } //digital input RPM TURBO Sensor
        if (b_4==100) {turbo_t2=turbo_t1; turbo_t1 = millis(); deltaT_turbo=(turbo_t1-turbo_t2); b_4=0;} //deltaT_turbo = time between 100 rotation, IF 90909 rpm it is 66 mS
        //if (deltaT_turbo > 1000) {deltaT_turbo =60000;}

     //The next 4 lines counts from the  Motor-RPM-sensor inputs
        buttonstate5 = digitalRead(7); //Read RPM motor on digital pin 5
        if (buttonstate5 != lastbuttonstate5) { if (buttonstate5 == HIGH){ b_5++; } lastbuttonstate5 = buttonstate5; } //Motor RPM Sensor
        if (b_5==100) {rpm_t2=rpm_t1; rpm_t1 = millis(); rpmT_motor=(rpm_t1-rpm_t2); b_5=0;} //time between 100 rotation
        //if (rpmT_motor > 100) {rpmT_motor =6000;}


       //testing how fast i can run a loop it took 28 mikro secondes  --------------------------To be deleted ------------------------------------------
        //time_1 = micros();
        //delta_time = time_1 - time_2;
        //time_2 = time_1;
                    
//--------------------------------From here on we run a loop every 10 mS------------------------------------------------------------------------------
                unsigned long currentMillis_2 = millis(); if(currentMillis_2 - previousMillis_2 > 10)
                {
                    previousMillis_2 = currentMillis_2; //Vi opdatere display efter hvad der står i interval  
                  
                  //If pin 5 is triggered i change what to show in the display, change between 5 screens
                    buttonstate3 = digitalRead(5);
                    if (buttonstate3 != lastbuttonstate3) { if (buttonstate3 == LOW){  btre++; delay(1000);} lastbuttonstate3 = buttonstate3; } //digital input display page
                    if (btre==7) {btre=0;} //if we hit 7 go back to screen side 0
            
                  //TPS in %
                    tps_raw = analogRead(3);                 //reads tps from 0 - 5 V sensor 0 - 1024
                    tps_raw = constrain(tps_raw, 100, 614);  //limits range of sensor values to between 100, 614 messure 0,5 - 3 Volt,  0, 1024 messure from 0 - 5 V specific to my sensor
                    tps = map(tps_raw, 100, 614, 0, 100);    //start 0% at 0,5 V and says 100% at 614 = 3 V  
                                    
                  //Here we read the EGP sensor and conwert it to Bar 1 bar = 15 PSi, (0.5 volt = - 1 bar 4.5 volt = 3 bar )
                    egp_raw_avg = analogRead(1);                      
                    egp_raw = (egp_raw_avg + egp_raw * 10) / 11;       //filter, spikes are supressed
                    egp_raw = constrain(egp_raw, 300, 1024);           // limits range of sensor values to between 0 - 3,5 bar the 307 is = atmosfaric pressure on this sensor
                    egp = map(egp_raw, 300, 1024, 0, 350);             // map the 0 - 1024 input to 0 - 350 milibar  
                    if(egp > egp_max) {egp_max = egp;}                 //Constantly keep track of max pressure
                                          
                  //Here we read the BOOST sensor and conwert it to MiliBar 100 milibar = 15 PSi, (0.5 volt = - 1 bar 4.5 volt = 3 bar )
                    boost_raw_avg = analogRead(2);                     //reads boost 3 Bar 0 Volt = -1,5 bar 5 volt + 3,5 bar
                    boost_raw = (boost_raw_avg + boost_raw * 10) / 11; //filter
                    boost_raw = constrain(boost_raw, 300, 1024);       // limits range of sensor values to between 0 - 3,5 bar the 307 is = atmosfaric pressure on this sensor
                    boost = map(boost_raw, 300, 1024, 0, 350);         // map the 0 - 1024 input to 0 - 350 milibar  
                    if(boost > boost_max) {boost_max = boost;}
                
                  //Controlling Delta pressure between EGP and Boost, And Max boost regarding TPS we dont want the EGP to go to higt widthout also Boost rising            
                    if( tps >  0) {max_dif_pressure = 15; }  
                    //if( tps > 10) {max_dif_pressure = 15; max_boost = 60;}  
                    //if( tps > 20) {max_dif_pressure = 20; max_boost = 70;}
                    if( tps > 30) {max_dif_pressure = 35; }
                    //if( tps > 40) {max_dif_pressure = 30; max_boost = 90;}  //if TPS bigger then 40%, max_dif_pressure 40 = 0,20 bar, (Crusing low EGP)
                    //if( tps > 50) {max_dif_pressure = 35; max_boost = 100;}
                    //if( tps > 60) {max_dif_pressure = 40; max_boost = 110;}
                    //if( tps > 70) {max_dif_pressure = 40; max_boost = 130;}
                    //if( tps > 80) {max_dif_pressure = 40; max_boost = 160;}
                    //if( tps > 90) {max_dif_pressure = 40; max_boost = 200;}

                //Differential EGP - BOOST  pressure to high wastegate starts open or VNT opens
                    boost_reg = 255 - (((egp - ( max_dif_pressure + boost ))) * delta_p_sloope) ;  
                                                                          
                //Max boost control.
                    if (boost > max_boost) {boost_reg = 255- (boost - max_boost)*10 ;  } //254 -(100-90)*10 = boostreg = 150
                    if (boost_reg > 255) {boost_reg =255;}
                    if (boost_reg < 1) {boost_reg =0;}
                  
                //Controlling the vacuum valve on the Turbo
                    analogWrite(11,boost_reg);  //This makes the PWM signal out to pin 11. connectet to the mosfet
                  
                    
                    if(tps_gear > tps) {tps_gear = tps;}           //IF tps is let of tps_gear is lovered also instant.
                    if(tps >tps_gear) {tps_gear = tps_gear + 0.5;}   //If Tps goes quick up the tps gear takes 1 sec to rice, to have a smooth kickdown in the gearbox
        
                
                    analogWrite(10,(tps_gear + boost/2)); //A PWM signal is put out on pin 10 it add TPS + Boost/2 0 - 255, to give a 0 - 5 Volt This is a prasentation of engine momentum of the engine, a resistor and a condensator is also needet
                                        
                 //Calculation for RPM turbo
                    RPM_turbo = (6000000 / deltaT_turbo) ; // RPM X 1000 = 60 / tid i mS * 100
                    if(RPM_turbo > RPM_turbo_max) { RPM_turbo_max = RPM_turbo;  }
                    if(RPM_turbo < 0){RPM_turbo = 0;}
                    
                    rpm_motor = (10000 /rpmT_motor)*10;
                    if (rpm_motor > 7000) { rpm_motor = 7000;}
        
                } //Here the 10 mS loop stops
      //---------------------------------------------------slow loop from here on the loop is only run every second or what ---------------------------------------------------------------------------------------------------------  
        unsigned long currentMillis = millis();

        if(currentMillis - previousMillis > interval) {
        previousMillis = currentMillis; //if (h == 0) h = 1; else h = 0; //Vi opdatere display efter hvad der står i interval
      
       //Calculation for fuel usage
            fuelcounts = fuelcounts2/100;
            totalL = fuelcounts2/fuelsensorscale;              // 4844 count on one liter
            Lprhr = (360000 / fuelsensorscale) / deltaTfuel;
            KmPrHr = (3600 / deltaTkm) *(1000 / KmCountScale); //5400 counts pr km   60 km/hr= 1 km på 60 sec = 90 counts pr sec = 11 ms kmCountScale = 5.5
            if(deltaTkm >= 900) {KmPrHr =0;}
            totalkm = (kmcounts/KmCountScale);                 //her skal divideres med et stort tal efter km test
            
            kmprL = KmPrHr/Lprhr;                              //her skal der divideres med speedometer signal.
    
    
            tid++;
            secounds++;
            if (secounds ==59) {minuts++; secounds =0;}
            if (minuts ==59) {timer++; minuts =0;}

      //----------------------------------------------------From here on LCD Display relevant-------------------------------------------------------------------------
       if(btre==0) {  
                    interval = 700;
                    //if (dd != 8) {dd=8; lcd.clear();  lcd.print("TOT:L Km/L  L/hr"); }
                    if (dd != 8) {dd=8; lcd.clear(); } //lcd.print("TPS+B TPS-G  TPS"); }
                    //lcd.setCursor(0, 0);  lcd.print("                ");
                    //lcd.setCursor(0, 1);  lcd.print("                ");
                    //lcd.setCursor(0, 1); lcd.print(totalL);
                    lcd.setCursor(6, 1);  lcd.print(kmprL);  lcd.setCursor(12, 1);  lcd.print(Lprhr);  
                    //lcd.setCursor(0, 1); lcd.print(tps_gear + boost/2); lcd.setCursor(6, 1);  lcd.print(tps_gear);  lcd.setCursor(12, 1);  lcd.print(tps);  
                    //lcd.setCursor(0, 0);  lcd.print("                ");
                    lcd.setCursor(1, 0);  lcd.print(" "); lcd.setCursor(3, 1);  lcd.print(" "); lcd.setCursor(12, 0);  lcd.print(" "); lcd.setCursor(12, 1);  lcd.print(" ");
                    lcd.setCursor(0, 0); lcd.print(tps); lcd.setCursor(3, 0);  lcd.print(boost_reg); lcd.setCursor(7, 0);  lcd.print(egp_max/100);  lcd.setCursor(12, 0); lcd.print(egp/100);  
                    lcd.setCursor(4, 1);  lcd.print("    ");
                    lcd.setCursor(0, 1); lcd.print(rpm_motor);      lcd.setCursor(7, 1);  lcd.print(boost_max/100);  lcd.setCursor(12, 1);  lcd.print(boost/100);  
                    
                    //33 244 0.55 0.23
                    //120099 0.55:0.23
                    //boost_reg
                   }

       if(btre==1) {
                    interval = 500;
                    if (dd != 9) { dd =9; lcd.clear(); lcd.print("Turbo RPM"); lcd.setCursor(0, 1); lcd.print("Turbo MAX");  }
                    lcd.setCursor(10, 0);  lcd.print("     ");  lcd.setCursor(10, 1);  lcd.print("     ");
                    lcd.setCursor(10, 0);  lcd.print(RPM_turbo);  lcd.setCursor(10, 1);  lcd.print(RPM_turbo_max);
                   }
              
       if(btre==2) {
                    if (dd != 1) { dd =1; lcd.clear(); lcd.print("BOOST"); lcd.setCursor(0, 1); lcd.print("EGP");  }
                    interval = 500;
                    if (boost <=0) {boost =0;  }
                    if (egp <=0) {egp =0;  }
                    lcd.setCursor(6, 0);  lcd.print(boost/100);  lcd.setCursor(6, 1);  lcd.print(egp/100);
                    lcd.setCursor(11, 0);  lcd.print(boost_max/100); lcd.setCursor(11, 1);  lcd.print(egp_max/100);
                    interval = 500;
                   }
      
       if(btre==3) {
                    interval = 1000;
                    if (dd != 2) {dd =2; lcd.clear(); lcd.print("Km/h"); lcd.setCursor(9, 0); lcd.print("km"); }
                    lcd.setCursor(5, 0);  lcd.print("   "); lcd.setCursor(5, 0); lcd.print(KmPrHr);  
                    lcd.setCursor(12, 0);  lcd.print("   "); lcd.setCursor(12, 0); lcd.print(totalkm);
                    //lcd.setCursor(0, 1); lcd.print(c);//lcd.print(kmcounts);
                    //lcd.setCursor(8, 1); lcd.print(timer); lcd.setCursor(10, 1); lcd.print(":");  

                    if(timer <10) {lcd.setCursor(8, 1);  lcd.print("0"); lcd.print(timer); }
                    if(timer >=10) {lcd.setCursor(8, 1);  lcd.print(timer); }
                    if(minuts <10) {lcd.setCursor(10, 1);  lcd.print(":"); lcd.setCursor(11, 1);  lcd.print("0"); lcd.print(minuts); }
                    if(minuts >=10) {lcd.setCursor(10, 1);  lcd.print(":"); lcd.setCursor(11, 1);  lcd.print(minuts); }
                    if(secounds <10) {lcd.setCursor(13, 1);  lcd.print(":"); lcd.setCursor(14, 1);  lcd.print("0"); lcd.print(secounds); }
                    if(secounds >=10) {lcd.setCursor(13, 1);  lcd.print(":"); lcd.setCursor(14, 1);  lcd.print(secounds); }
                  }    
            
       if(btre==4) {
              interval = 1000;
              if (dd != 3) { dd =3; lcd.clear(); lcd.setCursor(0, 0); lcd.print("Km"); lcd.setCursor(4, 0);  lcd.print("Km/L");      lcd.setCursor(9, 0);  lcd.print("L/100km");   }
              lcd.setCursor(0, 1); lcd.print("                "); lcd.setCursor(0, 1); lcd.print(totalkm); lcd.setCursor(4, 1);  lcd.print(totalkm/totalL);  lcd.setCursor(10, 1);  lcd.print(totalL/totalkm*100); }
    
       if(btre==5) {
                   interval = 1000;            
                   if (dd != 5) { dd =5; lcd.clear(); lcd.setCursor(0, 0);  lcd.print("TPS  RPM    KM/h");   }
                   //lcd.clear();
                   lcd.setCursor(0, 1);  lcd.print("                ");
                   lcd.setCursor(0, 1); lcd.print(tps );lcd.setCursor(2, 1); lcd.print("%");   lcd.setCursor(5, 1);  lcd.print(rpm_motor); lcd.setCursor(12, 1);  lcd.print(KmPrHr);
                  //lcd.print((char)223);  
                  }
      
    //   if(btre==5) {
    //               if (dd != 6) {dd =6; lcd.clear(); lcd.setCursor(0, 0); lcd.print("Gear  Oil  Inter");   }
    //        lcd.setCursor(0, 1); lcd.print(c); lcd.print((char)223); lcd.setCursor(6, 1);  lcd.print("130"); lcd.print((char)223); lcd.setCursor(11, 1); lcd.print("153"); lcd.print((char)223);
    //             }

//--------------------------------------------LCD Things ends here----------------------------------------------------------------------------------------
       eepromgem++;  
            if (eepromgem>120) {eepromgem=0; EEPROM.write(0, highByte(fuelcounts)); EEPROM.write(1, lowByte(fuelcounts));
                                            EEPROM.write(2, highByte(kmcounts));   EEPROM.write(3, lowByte(kmcounts));
                                            //lcd.setCursor(1, 0); lcd.print("SAVE EEPROM ");
                                            //EEPROM.write(4, highByte(tid));       EEPROM.write(5, lowByte(tid));
                                            EEPROM.write(4,(secounds)); EEPROM.write(5,(minuts)); EEPROM.write(6,(timer));
                                          }  
            
            //Erase EEprom RESET When you fill up the tank  
            if (btre<6) {j=0;}
            if (btre==6) {
                          interval = 1000;
                          j++;            
                           lcd.clear();  lcd.setCursor(1, 0); lcd.print("Reset in sec ");  lcd.setCursor(14, 0); lcd.print(11-j);
                           if (j>=3 ) {if (j<4 ){RPM_turbo_max = 0; lcd.clear(); lcd.print("RPM Turbo max RESET");}}                            
                           if (j>=4 ) {if (j<5 ){egp_max = 0; boost_max =0; lcd.clear(); lcd.print("Boost max RESET");}}                            
                           if (j>=6 ) {if (j<7 ){max_boost = 200; lcd.clear(); lcd.print("      :-)");}}
                           if (j>=12) {
                                       j=0;
                                       kmcounts =0; fuelcounts2=0; tid=0; secounds=0; minuts =0; timer=0;
                                       EEPROM.write(0, highByte(0)); EEPROM.write(1, lowByte(0));
                                       EEPROM.write(2, highByte(0)); EEPROM.write(3, lowByte(0));
                                       EEPROM.write(4, highByte(0)); EEPROM.write(5, lowByte(0));
                                       EEPROM.write(6,0); EEPROM.write(7,0); EEPROM.write(8,0);
                                       kmcounts =0; fuelcounts2=0; tid=0;
                                       lcd.clear(); lcd.setCursor(0, 0); lcd.print("You data is gone :-) ");
                                       btre=1;  
                                      }
                         }

             if (btre<7) {j_2=0;}
             if (btre==7) {
                          j_2++;            
                          lcd.clear();  lcd.setCursor(1, 0); lcd.print("SETUP: ");  lcd.setCursor(12, 0); lcd.print(j_2);
                          if (j_2 == 1 )  {
                                          EEPROM.write(10, highByte(eeprom_10)); EEPROM.write(11, lowByte(eeprom_10));              
                                          lcd.setCursor(1, 1); lcd.print("Motor RPM:"); eeprom_10 = EEPROM.read(10) * 256 + EEPROM.read(11); lcd.setCursor(12, 1); lcd.print(eeprom_10);
                                          eeprom_10 = 5;
                                          }
                          
                           if (j_2 == 2 )  { lcd.setCursor(1, 1); lcd.print("Fuel K:");}
                           if (j_2 == 3 )  { lcd.setCursor(1, 1); lcd.print(btre);}
                           if (j_2 == 4 )  { j_2 = 0;}                        
                          }
    }    // end slow loop
}        // end fast loop



RE: Homemade. TURBO BOOST / RPM Meter - aaa - 01-14-2011

I'm eying the Arduino Nano


RE: Homemade. TURBO BOOST / RPM Meter - tomnik - 01-15-2011

this is nearly double the price over here and on top not available at the moment.
What is your reason choosing this one?

Tom

(01-14-2011, 04:52 PM)aaa I'm eying the Arduino Nano




RE: Homemade. TURBO BOOST / RPM Meter - aaa - 01-15-2011

Just because it's smaller and only $5 more. Unless the Duemilanove can be found for $15 or something - oh wait. Now I see what you're talking about.


RE: Homemade. TURBO BOOST / RPM Meter - 300D50 - 01-15-2011

Smallest option would be to get an atmega with the arduino boottloader burned in, a 7805 regulator, 2 capacitors, a diode for reverse polarity protection, and a cheap usb to ttl level serial adapter to talk with the bootloader.



RE: Homemade. TURBO BOOST / RPM Meter - winmutt - 01-15-2011

(01-11-2011, 09:32 PM)ForcedInduction
(01-11-2011, 10:13 AM)winmutt There is only one OEM solution for this and its an ON/OFF switch on WOT on the 87 linkage for the automatic.

Wouldnt the rack sensor provide what you want?

There are many solutions. A potentiometer is not difficult to install and the TPS on the 96-97 E300 is external with a bowden cable ball.
http://www.youtube.com/watch?v=js4AsFm9plk
Is that you doing the voice talent?



RE: Homemade. TURBO BOOST / RPM Meter - winmutt - 01-15-2011

It appears that the om60x already come with atleast a boost pressure gauge built in. B5/1 in 87 which is also in newer models as part of P2.


RE: Homemade. TURBO BOOST / RPM Meter - Spaceraver - 01-16-2011

The Arduino Nano is cheap anyhow. Have 2 Arduino's here one Nano and a Duemilanove, One will be used for this project, the other one will hopefully control my shifter P R N D and display the current gear. Unless The TCM2000 can do that directly and rev my speedometer cable with a dc motor. One can only hope.

Ole. If you need it, i'll be happy to translate everything for you. Did a bit of proofreading on your code.
Still You are a better coder than I am.


RE: Homemade. TURBO BOOST / RPM Meter - winmutt - 01-16-2011

(01-15-2011, 08:46 PM)winmutt It appears that the om60x already come with atleast a boost pressure gauge built in. B5/1 in 87 which is also in newer models as part of P2.

B5/1 is not in the 87, however it is in my 91.... I am going to see about sourcing a few of these.


RE: Homemade. TURBO BOOST / RPM Meter - tomnik - 01-17-2011

what is the B5/1 ?

Tom


RE: Homemade. TURBO BOOST / RPM Meter - aaa - 01-17-2011

A pressure sensor for the EDS introduced in 90. It's a box on the second firewall in front of the battery, next to that rectangular diagnostic socket thingie. The 87 had a "altitude capsule" above the OVP instead, apparently only for atmospheric pressure.

Wouldn't an aftermarket one be simpler winmutt? Or at least smaller. Like one of these:
http://cgi.ebay.com/ebaymotors/XAVIAR-Map-Pressure-Boost-Sensor-HKS-V-Pro-F-Con-_W0QQcmdZViewItemQQhashZitem335dc6989eQQitemZ220616628382QQptZMotorsQ5fCarQ5fTruckQ5fPartsQ5fAccessories


RE: Homemade. TURBO BOOST / RPM Meter - winmutt - 01-17-2011

I like OEM solutions Big Grin


RE: Homemade. TURBO BOOST / RPM Meter - aaa - 01-17-2011

On the other hand I don't think there are any mounting holes for it on an 87.


RE: Homemade. TURBO BOOST / RPM Meter - casioqv - 01-20-2011

olefejer- this is very cool! What sort of flowmeter did you use, and where did you get it?

I've been wanting to collect some data on how various variables affect fuel consumption in my old diesels, but cannot find a flowmeter anywhere that is reasonably priced, diesel fuel compatible, and accurate at the flowrates our engines use.


RE: Homemade. TURBO BOOST / RPM Meter - olefejer - 01-23-2011

(01-20-2011, 03:58 PM)casioqv olefejer- this is very cool! What sort of flowmeter did you use, and where did you get it?

I've been wanting to collect some data on how various variables affect fuel consumption in my old diesels, but cannot find a flowmeter anywhere that is reasonably priced, diesel fuel compatible, and accurate at the flowrates our engines use.

Hi the flowSensor is from Ebay it was cheap around 25$, i have just emailed the seller if he has any more or where he got it from.
This was the name on ebay "IMPELLER Flow Sensor [Indicator/Meter/Switch Fuel/Water"


RE: Homemade. TURBO BOOST / RPM Meter - casioqv - 01-23-2011

(01-23-2011, 11:19 AM)olefejer Hi the flowSensor is from Ebay it was cheap around 25$, i have just emailed the seller if he has any more or where he got it from.
This was the name on ebay "IMPELLER Flow Sensor [Indicator/Meter/Switch Fuel/Water"

Can you provide a link to the auction?

Searching "IMPELLER Flow Sensor" on the global ebay (global.ebay.com), and US eBay for both current and completed auctions yielded no results.

The only flow sensors I've found compatible with diesel fuel that measure low flowrates (for engines, not diesel transfer pumps) cost over $1000.

I may instead just make a calibration table for my fuel level sender for calculating economy with my laptop and/or Arduino.



RE: Homemade. TURBO BOOST / RPM Meter - Aero83 - 01-23-2011

Thank you for sharing this stuff.


RE: Homemade. TURBO BOOST / RPM Meter - olefejer - 01-24-2011


Can you provide a link to the auction?

[/quote]
http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=220729530290#ht_2429wt_1139
You have to mail him to ask if he will put one up on ebay for you.



RE: Homemade. TURBO BOOST / RPM Meter - casioqv - 01-24-2011

(01-24-2011, 03:46 PM)olefejer You have to mail him to ask if he will put one up on ebay for you.

Thank you so much! I don't know why none of my Internet searches yielded anything like this. It has viton seals so should be biodiesel compatible, and it works at flowrates down to 0.04lpm which is about right for readings as high as 60mpg with the return line looped back into the suction line.


RE: Homemade. TURBO BOOST / RPM Meter - winmutt - 01-25-2011

About the flow sensor are you deducting the fuel that is sent back to the tank as well? Seems like you would need to have both in and out to calculate MPG accurately.


RE: Homemade. TURBO BOOST / RPM Meter - olefejer - 01-25-2011

(01-25-2011, 09:44 AM)winmutt About the flow sensor are you deducting the fuel that is sent back to the tank as well? Seems like you would need to have both in and out to calculate MPG accurately.
I dont know yet, but i think i will start width one sensor, and run the return line in to the forward line, but maybe air get in to the system, thats why i have just ordered a second sensor to measure both the forward and the returnline. time will show the best method.

I don't know why none of my Internet searches yielded anything like this. It has viton seals so should be biodiesel compatible, and it works at flowrates down to 0.04lpm which is about right for readings as high as 60mpg with the return line looped back into the suction line.
[/quote]

Because i have him put one up for sale to me. so that i now have 2 pcs, to messure both forward and returnline.
Just send him a mail i think he has a couple left.


RE: Homemade. TURBO BOOST / RPM Meter - casioqv - 01-25-2011

(01-25-2011, 09:44 AM)winmutt About the flow sensor are you deducting the fuel that is sent back to the tank as well? Seems like you would need to have both in and out to calculate MPG accurately.

You can just T the return line into the supply line, if you add some way to bleed out air for if you run out of fuel.