Jump to content
  • Welcome To Mopar1973Man.Com LLC

    We are a privately owned support forum for the Dodge Ram Cummins Diesels. All information is free to read for everyone. To interact or ask questions you must have a subscription plan to enable all other features beyond reading. Please go over to the Subscription Page and pick out a plan that fits you best. At any time you wish to cancel the subscription please go back over to the Subscription Page and hit the Cancel button and your subscription will be stopped. All subscriptions are auto-renewing. 

He351ve stand alone Arduino controller code for 2nd Gen Cummins


Recommended Posts

Double Edit:

 

spoke two soon, seems that I am only getting about half the movement in the veins when adjusting boost values up.

 

very odd.

 

You're adjusting the viens based on a 0-49 psi boost level, but have your pot mapped from 0-100 psi.  Would that cause the problem you're having?

 

Also, add this in the EBManage right below the first "if" but on top of the other "if else"

 

 

  else if (ExhaustPressure >= (MaxExhaustPressure + 10)) 
  DesiredPosition += ((ExhuastPressure - MaxExhaustPressure) * 5);//if Exhaust Pressure spikes, open the veins quick.

 

 

Another EDIT.

 

I'm happy to help,  I'll likely be going down this road shortly as well.

Link to comment
Share on other sites

I adjusted the boost map to read 0-100 with the different veins and I have the same results. 

 

Gonna dig into that in a bit.

 

 

 

Thoughts on this?    I haven't benchtested it yet, but I think it should work like I want.

    {
    if ( SwitchPosition == HIGH && EBSwitchPosition == HIGH)
      DesiredPosition = BoostVeinPosCalc( BoostPressure ); //set vein position based on boostmap
     
    else if ( ThrottlePosition < 300 && SwitchPosition != HIGH)
      DesiredPosition = PotentiometerValue; //vein position is pot value
 
    else if (EBSwitchPosition != HIGH && SwitchPosition == HIGH && ThrottlePosition < 15 )  
      EBManage ();//If below %1.5 then engage Exhaust brake and regulate the exhaust pressure.
           
    else DesiredPosition = BoostVeinPosCalc( BoostPressure );
    }
 
    // Set the Turbo Position
    SendTurboPosition( DesiredPosition );
 
    // Delay for Processor
    delay(2);
  }

 //Manages the apply of the EB
void EBManage(){
  
 
if (ExhaustPressure <= (MaxExhaustPressure - 10)) DesiredPosition -= 5;//these assume that the lower the number, the more restrictive the turbine housing is.

  else if (ExhaustPressure >= (MaxExhaustPressure + 10)) 
    DesiredPosition += ((ExhaustPressure - MaxExhaustPressure) * 5);//if Exhaust Pressure spikes, open the veins quick.

  else if (ExhaustPressure < MaxExhaustPressure) DesiredPosition--;  

  else if (ExhaustPressure > MaxExhaustPressure) DesiredPosition++;
    DesiredPosition = constrain(DesiredPosition, 140, 960);

}

Edit:

 

Benchtested the above code and it is doing what I want, other than the pot not working like the sensor would.

 

If you adjust tps it will kick you out of the eb loop and also the pot loop depending on what switches are on/off etc.

 

Calling it a night, I will tackel the pot issue later.

Link to comment
Share on other sites

Did you have to add this to get it to work?

 

if (ThrottlePosition > 15) loop(); //if throttle position is more than %1.5 then exit EBmanage

 
I'd have to see your code, but I didn't think it should be necessary.  Would you be able to attach your code to your post, for me to take a looky see?
 
Also, I don't want to mislead you, I am by no means good at programming.  Most my stuff is other peoples stuff spliced together.
If I say one thing, and Ed says another.  Screw me and listen to Ed lol.

 

 
Link to comment
Share on other sites

Try changing; 

 

 int ReadBoostPressure()

{
int BoostVal = analogRead( BoostPressurePin ); // read the value from the sensor
return map( BoostVal, 0, 1023, 0, 100 ); // Last two values are the psi range of the choosen sensor
}

 

To;

 

  int ReadBoostPressure()

{
int BoostVal = analogRead( BoostPressurePin ); // read the value from the sensor
return map( BoostVal, 0, 1023, 0, 50 ); // Last two values are the psi range of the choosen sensor
}

 

Or did you do that already?  The code in the first post still has the 100.  Which would cause your problem.

 

I find programming late at night sometimes has a negative effect. lol

And then other times I get on a roll and stay up till 6 am lol.

Link to comment
Share on other sites

Yea I have tired 0,50 at that point.

 

I have also done the boost map from 0-100psi range rather than 0-50psi ish.

 

 

Turning the pot( emulating the boost sensor 0-5v) less than half way works great, then when you pass the half way point it won't advance more.  so I only get 140-500ish from the boost sensor pot, but I am getting the full 0-5v range.

 

 

I need to spend time now that I have a good code the rest of the way and jsut test with the boost sensor and changes. 

Link to comment
Share on other sites

I can count 7 jumps in vein position to the 50psi mark, vein position at 50psi ( half the pot) is at about 500. then after half way on the pot the turbo doesn't do squat. 

 

If I reduce the range from 100 to 50 then it still does 7 jumps, but the pot is rotated almost all the way.

 

It is as if the map is looking at the boost psi, but assigning the vein position / 2

 

dunno

Link to comment
Share on other sites

Besides the Syntax on your array (sorry about that, I was in a hurry and a little short on words lol).

 

EDIT; cancel this last part, I was looking at it wrong.

 

Change;

 for(byte i=0;(BoostPressureVal > BoostMap[i][0]) && (i<NumEntries); i++) // what you have that's correct

   

To;

 for(byte i=0;(BoostPressureVal > BoostMap[i][0]) && (<= NumEntries); i++) // what I suggested that is wrong

 

 

  • Like 1
Link to comment
Share on other sites

Needed a break from the snow... brrr.

 

EDIT; couple bugs fixed.

 

Anyhow,  I came up with a little less.... Ify.  EBManage code.

 

This is stuff I just through together, You'll have to calibrate it a bit to make it so it doesn't lag, or overshoot.

 

The main changes were here;

 

void EBManage(){
  //Trying to avoid using floats as they are slower to do math with, change if need be.
  const int Calibration = 2; //This is how much the viens will move based off the pressure difference.
  
int Difference = (ExhaustPressure-MaxExhaustPressure)
 
Difference = ((Difference/5)* Calibration);
DesiredPosition -= min(Difference, -20);//This way it doesn't close the veins to fast
}
 
 
And then I mocked up a function to keep boost and DP at a x:1 ratio, could probably use some constraining for at low RPMs.
 
void BtoDPressureManage(){
  //Trying to avoid using floats as they are slower to do math with.
  const int Calibration = 2; //This is how much the viens will move based off the pressure difference.
  const int DesiredBDPRatio = 100; //this is percent, 100% means you want boot:DP 1:1. 90% = .9:1.  
  
int Difference = (((BoostPressure*100)/DesiredBDRatio)-ExhaustPressure);//actual difference in pressure. 15 = 1.5psi
 
DesiredPosition -= ((Difference/5)* Calibration);
}
 
 
And the last thing I did was instead of calibrating the pressure sensors to 0-100.  I changed it to 0-1000, so if gives you a decimal point of
precision.
 
The full code is attached, there is likely some new bugs now   :surrender: .
Link to comment
Share on other sites

Thanks, though I got to thinking about it, and thought the new way should be faster, and a little simpler.

 

I edited the above post, decided not to get to fancy, while adding the min() part.

 

What's going on is simple.  It's just calculating the difference in PSI to the desired pressure, and changing the desiredPosition based off that.

Link to comment
Share on other sites

You should be able to just buy what is listied in the first page and follow basic setup of the and arduino and sheild.

 

 

However if you aren't wanting to dable in the code, I am not sure this is the right choice for you. '

 

 

 

question for you turbo efficently guys.

 

 

I know drive pressure > Boost is bad, but is boost more than drive also bad? ( not that it is really possible is it??).  

 

in theory if my code only tries to keep drive pressure close to boost by opening the viens then I shouldn't have an issue right?  I should never have to watch for boost pressure being higher than drive? right??

Link to comment
Share on other sites

put this in place to try and manage the Drive Pressure.   Bench testing it the veins seem to follow the desired position unless drive pressure spikes then the veins open until drive pressure reduces or boost increase.

 

Down and dirty, but it works pretty welll.

{

    if ( SwitchPosition == HIGH && EBSwitchPosition == HIGH && ExhaustPressure <= (BoostPressure + 2))
      DesiredPosition = BoostVeinPosCalc( BoostPressure ); //set vein position based on boostmap
    
    else if ( SwitchPosition == HIGH && EBSwitchPosition == HIGH && ExhaustPressure > (BoostPressure + 2))
      DesiredPosition = BoostVeinPosCalc( BoostPressure ) - ((BoostPressure - ExhaustPressure) * (.25*(JumpSize))); //opens the veins if exhaust pressure is above max
    
    else if ( ThrottlePosition < 300 && SwitchPosition != HIGH)
      DesiredPosition = PotentiometerValue; //vein position is pot value
 
    else if (EBSwitchPosition != HIGH && SwitchPosition == HIGH && ThrottlePosition < 150 )  
      EBManage ();//If below %1.5 then engage Exhaust brake and regulate the exhaust pressure.
           
           
    else DesiredPosition = BoostVeinPosCalc( BoostPressure );
    }
Link to comment
Share on other sites

I don't mean to fill you full of my buggy code,  don't feel obligated to use it at all.  I just get this idea about how something could be done, and have to try it out!  honestly, it also gives me a break from my SPI issues haha.  I found the issue in the EBManage().  The min() should have been max().  So I got the new corrected code attached.  I also put the pressure mapped back to 0-100,  I was just being too much of an perfectionist before.  Did you try the BtoDPressureManage()?  did it work OK? EDIT, of course it didn't work lol, try that.

 

Also with this piece (.25*(JumpSize))    whenever you have decimal points, the arduino treats them as a float.  Which it doesn't do math with very fast.  So  (JumpSize/4) would be faster.  Probably doesn't matter, but I think it's just good practice.

 

VGT Code2.txt

Link to comment
Share on other sites

I am always up to benchtest an idea.

 

I like what you haha.  I will test it tell the cows come home.

 

I am like you, a little out of the box thinking breaks me out of GPO/Server maintence mode. 

 

edit:

 

Bad news on the code in your latest effort;  Doesn't seem to work well.

 

 

EB apply always goes full open.  I am dicking with it still.

 

The pressure 1:1 doesn't seem to do anything logical when testing. 

 

Thanks for hte tip on decimal.

Link to comment
Share on other sites

×
×
  • Create New...