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

Here's my pressure reading function in a different project, encase it's of help.

 

int PressureRead(int AnalogPin){
int AverageNum = 3;
int Val = 0;
 
 for (int i = 0; i < AverageNum; i++){
  Val += analogRead(AnalogPin);
}
  Val = constrain((Val/AverageNum), 103, 920);
  return map(Val, 103, 920, 0, 1000 );
}
 
Link to comment
Share on other sites

Ed,

 

Make sure that you use the updated code from today if you want the d to b ratio working on the lcd screen.  The ratio is limited to 9.99:1 and if there is no boost then you will see 0.00:1 rather than the NAN (X/0 != int)

Link to comment
Share on other sites

I've been trying to figure out the speed sensor as well.  from the math I've done, the VR sensor for the ABS in the rear fires at 1432 hz @ 60 MPH,  which is a little more than I was hoping for.  I was going to look into the VSS in the T-Case cause mines a 12 valve.

 

 

Here's my RPM sensing code, you'd have to tweak it some for the Uno and MPH.

 void RPMSetup(){
   pinMode(EngineRPMPin,INPUT);
   attachInterrupt(EngineRPMPin, RPMInterrupt, RISING);
 }
 
 void RPMInterrupt(){
   RPMTimeLast = micros(); 
   ++RPMPulses; 
 }
 
int ReadRPM(){
  if (RPMPulses >= 2 && (RPMTimeLast - RPMTimeStart) >= 100000){
 
noInterrupts();
  SensorValues[8][0] = ((30000000UL * RPMPulses)/(RPMTimeLast - RPMTimeStart));
RPMPulses = 0;
RPMTimeStart = RPMTimeLast; 
interrupts();
RPMUpdateLast = millis();
}  
else if ((millis() - RPMUpdateLast) > 1000) {
SensorValues[8][0] = 0;
   }
  }
 
 
Also, I find this comes in handy for testing code speed.
 

long Start = 0; //Global


void StartTime(){
  Start = micros();
}


void PrintTime(){
Serial.print('-');
Serial.print(micros()-Start);
}


void PrintlnTime(){
Serial.print ('-');
Serial.println(micros()- Start);
}


And then one last thing.  I meant to give you this earlier to help with my buggy code.

 

/*
WARNING:  The code that follows will make you cry;
a safety pig is provided below for your benefit


                         _
 _._ _..._ .-',     _.._(`))
'-. `     '  /-._.-'    ',/
   )         \            '.
  / _    _    |             \
 |  a    a    /              |
 \   .-.                     ;  
  '-('' ).-'       ,'       ;
     '-;           |      .'
        \           \    /
        | 7  .__  _.-\   \
        | |  |  ``/  /`  /
       /,_|  |   /,_/   /
          /,_/      '`-'

*/
Link to comment
Share on other sites

I like where you guys are going, but I am diving into the Shaft speed sensor in the turbo lololol.  I have a perfectly good RPM gauge on the dash :shifty:

 

With alittle help from safety pig I might just get through it.

Link to comment
Share on other sites

I was going to post up the circuitry for the turbo sensor, but if you insist lol.  (HERE it is anyway haha).

 

I normally put him in globally... otherwise he's all over the place.

 

Cape could be a good addition.

Link to comment
Share on other sites

Man, that 20X4 screen is a tad larger than I thought... Parts are all in & I'll assemble tomorrow with a dual pressure regulator/gauge setup I grabbed from a restraunt soda system. I'll be able to simulate drive & boost for real with the senders. If all is well, I'll install it on the truck this weekend. I also have a great schematic for an automotive switching supply for 5VDC. It can be found in these schematics. Also there is the CAN driver setup in schematic form, too. Nick, I think you have this...LOL  https://www.dropbox.com/s/1wdj8b3fzw8b7r2/Schematics.zip?dl=0

 

Ed

Link to comment
Share on other sites

 

Here's my pressure reading function in a different project, encase it's of help.

 

int PressureRead(int AnalogPin){
int AverageNum = 3;
int Val = 0;
 
 for (int i = 0; i < AverageNum; i++){
  Val += analogRead(AnalogPin);
}
  Val = constrain((Val/AverageNum), 103, 920);
  return map(Val, 103, 920, 0, 1000 );
}
 

So, correct me if I am wrong, but I want to substitute like this:

int ReadExhaustPressure(){

int ExhaustVal = analogRead( ExhaustPressurePin ); // read the value from the sensor

return map( ExhaustVal, 0, 1023, 0, 100 ); // Last two values are the psi range of the choosen sensor

with:

int ReadExhaustPressure(){

int ExhaustVal = analogRead( ExhaustPressurePin ); // read the value from the sensor

return map( ExhaustVal, 103, 920, 0, 100 ); // Last two values are the psi range of the choosen sensor

to compensate for the .5=4.5 VDC from the ratiometric sensors, right?

I will have it all hooked up tomorrow & try to video the readings & adjust the pressures for different drive & boost ratios over 30 PSI.

I also have a J1939 reader for the computer, so I will be able to get output readings with that.

 

Ed

Link to comment
Share on other sites

Ed, that would work.  Though negative values won't read correctly.  So you might consider either limiting the lower value of the analog input;  to chop off anything under 0 psi.  Or map it to a wider range to include the negative values.

 

So either:

int ReadExhaustPressure(){
int ExhaustVal = analogRead( ExhaustPressurePin ); // read the value from the sensor
if (ExhaustVal < 103) ExhaustVal = 103;
return map( ExhaustVal, 103, 920, 0, 100 );

 Or:

int ReadExhaustPressure(){
int ExhaustVal = analogRead( ExhaustPressurePin ); // read the value from the sensor
return map( ExhaustVal, 5, 920, -12, 100 );
Link to comment
Share on other sites

Any ideas for how to enable the eb? 

 

I hate hate hate having toggle switches lining the dash so I really would not like to do that.  the idea of using a the brake pedal is ok, but I guess I would rather not have the EB engage every time I used the brake. 

 

I also thought of another button mounted on the gear select column, but I can't fit more wires.

 

Maybe a old high beam switch for the floor board that I can hit with my left foot? 

 

any other thoughts?

 

 

 

Edit:

 

I think I am going to find the late 01-02 modem steering wheel buttons and add them into my steering wheel.  One of those will be EB control. 

Link to comment
Share on other sites

×
×
  • Create New...