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

I'll have to look over the code in the morning when I can see what I'm looking at lol.

 

If the value you're trying to constrain is outside of the minimum or maximum border you have set, it will be set to the value of the border it crossed.

 

So;

tmp = Constrain(40, 83, 920);//tmp is now 83 

tmp = Constrain(1000, 83, 920);//tmp is now 920 

Link to comment
Share on other sites

If I'm looking at it correctly, than I think you need to make "int index = 0;" and "int readings[numReadings]; " global, otherwise every time you enter your "readExhaustPressure()" function, it sets it to "0".

 

Also, I'm not sure what you're doing with this:

    for (int thisReading = 0; thisReading < numReadings; thisReading++)
    readings[thisReading] = 0;

Are you wanting to check the DP once everytime you enter the function, add it to the array, and then average it with the previous times?  Or are you trying to get 5 readings all in the same call to the function?

Link to comment
Share on other sites

Try this, I think it accomplishes what you're wanting. I tried to simplify it a little.

int ReadExhaustPressure(){
const int AverageNum = 5; // how many reads you want to average.
int tmp = 0;

for(int x = 0; x < AverageNum; x++){
int num = analogRead( ExhaustPressurePin );// reading the value of the sensor
num = constrain(num, 83, 920);//constrain it for negative values
num = map(num,  83, 920, 0, 100);//converting our readings to psi.
num = consrain(num, BoostPressure, (BoostPressure * 3));//making sure the value we received is a plausible reading
tmp = tmp + num;//add the current reading to tmp for averaging later.
delay(analogDelay);// waiting between readings
}
return (tmp/AverageNum); // Averaging the values.
}

Link to comment
Share on other sites

I will throw that in and test along with the others I have written today haha.

 

I also have one method written to add to an array and average on the fly.  

 

not sure what I will like better.

Link to comment
Share on other sites

Alright here is what I have and it working pretty dang good for reading the boost and exhaust.  It creates an array of reads from the sensors then replaces the oldest with the newest read to create a rolling average of boost and drive pressure.  Readings are VERY stable now.

int ReadBoostPressure(){    //Works good but seems to be slower.
  Bsttotal = Bsttotal - Bstreadings[Bstindex]; // subtract the last reading:        
  Bstreadings[Bstindex] = analogRead(BoostPressurePin); // read from the sensor:
  Bsttotal= Bsttotal + Bstreadings[Bstindex];   // add the reading to the total:    
  Bstindex = Bstindex + 1;    // advance to the next position in the array:                 
  if (Bstindex >= BstnumReadings)    // if we're at the end of the array...          
    Bstindex = 0;    // ...wrap around to the beginning:                        
  Bstaverage = Bsttotal / BstnumReadings;    // calculate the average:      
  return map( Bstaverage, 83, 920, 0, 100); // Last two values are the psi range of the chosen sensor
  delay(1);        // delay in between reads for stability
}


int ReadExhaustPressure(){    //Works good but seems to be slower.
  Exttotal = Exttotal - Extreadings[Extindex]; // subtract the last reading:        
  Extreadings[Extindex] = analogRead(ExhaustPressurePin); // read from the sensor:
  Exttotal = Exttotal + Extreadings[Extindex];   // add the reading to the total:    
  Extindex = Extindex + 1;    // advance to the next position in the array:                 
  if (Extindex >= ExtnumReadings)    // if we're at the end of the array...          
    Extindex = 0;    // ...wrap around to the beginning:                        
  Extaverage = Exttotal / ExtnumReadings;    // calculate the average:      
  return map( Extaverage, 83, 920, 0, 100); // Last two values are the psi range of the chosen sensor
  delay(1);        // delay in between reads for stability
}

There is some new stuff in the main and setup that you can see in the first post.  

 

It reads values a little slower and seems to be a little more slugglish, but I don't think it is enough to matter.

Link to comment
Share on other sites

I am going to plug in the turbo today and verify that it still adjusts the veins nicely.  If it does I will be trying to install it this weekend.  

 

Only thing I am unsure of is the hot side to intercooler boot.  I THINK a 45 reducing elbow will make it work if i clock the turbo right.  

 

Pretty excited.

Link to comment
Share on other sites

Well I pulled the injectors last night to find this

 

20150604_182016_zpsf5zfjzzc.jpeg

 

Called Chris at DFI for some new 100's 

 

New cover for the he351 is coming in that will allow me to run and OEM setup.  I "think" it is a cover from a he431 but I won't know until I get it.  It will be a good option for guys that want to leave the oem intake in place.

_57_zpswkxa2dy7.jpg

 

 

As for how to control the exhaust brake, I am talking with a friend of mine who has a rapid prototype machine and I am going to have him make a larger gear shifter handle that will support more buttons.  I will drill out the metal shifter rod to handle more wires.  I might talk with him about making a few extras.  I think it would be nice to have everything on the shifter handle. 

  • Like 1
Link to comment
Share on other sites

I also got the compressor cover in and it turned out to be a he300vg cover not a 351. I knew it wasn't a 351 but oh well. I will talk to a machine shop. Hopefully without too much cost I can get it enlarged to the 351 size and keep the all oem intake track.

Link to comment
Share on other sites

Well I screwed something up somehow

The turbo cycles rapidly when using the pot to update turbo pos.

Gonna take some time to figure out why.

Might be interference or something.

 

Maybe i dont want a vgt after all...........................,sorry! just me.

I do hope you nail this thing down tite!! you must enjoy this kind of thing.......

Link to comment
Share on other sites

I like to tinker with stuff.  It was benchtested and working well, but I broke the #1 rule of coding, Test after making a change.  I made some changes to help the display read more accurate, but the turbo wasn't connected.  Something with that change caused the issues.  

 

 

I am guessing that I am getting overlapping commands to the turbo IE commanded 600 position, but by the time the turbo reads the command another one is coming in causing the turbo to cycle as it tried to hit the commanded position.  

 

 

Gonna take a good bit of work to figure out for sure though.

Link to comment
Share on other sites

 

 

 

I am guessing that I am getting overlapping commands to the turbo IE commanded 600 position, but by the time the turbo reads the command another one is coming in causing the turbo to cycle as it tried to hit the commanded position.  

 

 

 

 

Kinda like when we have WAY to much coffee w/ choc.           :ahhh:                :)

Edited by organicfarmer
Link to comment
Share on other sites

  • Owner

I'll have to warn you Me78569 and Cowboy this thread is gain popularity and you guy better get one put together and running on a truck. I got a few guys that now been asking when its for sale. I just had one last night that's P-pumping a 6.7L and look for this turbo to put on the truck. 

Link to comment
Share on other sites

×
×
  • Create New...