Jump to content
Mopar1973Man.Com LLC
  • 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

Cowboy/ed/smart people

 

I think I have this almost put into my code for doing the code for doing turbo speed.
 

I am getting a final compile error of

"D_ReadSensors.ino:40:18: error: invalid types 'char[int]' for array subscript:"

 

 

SensorValues[8][0] = ((30000000UL * RPMPulses)/(RPMTimeLast - RPMTimeStart));

 

I am guessing I didn't define "SensorValues" but I am not sure how to define it or if I need to.

 

thoughts?

Link to comment
Share on other sites

SensorValues[8][0] is just an 2D array, I use it in my code to make processing the values easier.  You can replace it with 

TurboRPM = ((60000000UL * RPMPulses)/(RPMTimeLast - RPMTimeStart));

 and then put this globally. 

long TurboRPM = 0;
Link to comment
Share on other sites

One more dumb question,

 

RPMPulses comes from "#define SpeedSensorPin 7" above, do I analog read that pin? 

 

I don't think the he351ve sensor is a hall sensor is it?  I found out what it was a few weeks ago, but I can't seem to remember what it was or remember where I found what kind of sensor it actually was.

 

 

 

Edit:  Is it a VR sensor?

Link to comment
Share on other sites

  • 3 weeks later...

Well I have finally gotten some more time to work on this.  however sadly I have forgotten almost everything I was working on.   I never finished the speed sensor section of the code so I can looking into that more.

 

 

Cowboy,

 

Have you had a chance to do anything on your project that I can steal :evilgrin:

 

 

 

 

Anyways I hope to have the speed sensor working over the next couple days.

Link to comment
Share on other sites

Try this.

//Globally

volatile int TurboRPMPulses = 0;
volatile unsigned long TurboRPMTimeLast = 0;
unsigned long TurboRPMTimeStart = 0;
int TurboRPMUpdateLast = 0;
long TurboRPM = 0;
const byte TurboRPMPin = 2; //it can be either 2 or 3 on arduino


// in Void Setup 
void RPMSetup(){
   pinMode(TurboeRPMPin,INPUT);
   attachInterrupt(TurboRPMPin, TurboRPMInterrupt, RISING);
 }
 
 void RPMInterrupt(){
   TurboRPMTimeLast = micros(); 
   ++TurboRPMPulses; 
 }
 // in void loop
int ReadRPM(){
  if (RPMPulses >= 10 && (RPMTimeLast - RPMTimeStart) >= 100000){
 
noInterrupts();
  TurboRPM = ((60000000UL * TurboRPMPulses)/(TurboRPMTimeLast - TurboRPMTimeStart));
TurboRPMPulses = 0;
TurboRPMTimeStart = TurboRPMTimeLast; 
interrupts();
TurboRPMUpdateLast = millis();
}  
else if ((millis() - RPMUpdateLast) > 1000) {//if the turbo stops spinning, set it to '0'
TurboRPM = 0;
   }
  }
Link to comment
Share on other sites

It depends on your external circuitry.  Here's a good read about VR sensors - http://en.wikipedia.org/wiki/Variable_reluctance_sensor.

 

I would recommend some sort of protection via a comparator to protect the micro controller.

 

The guy on CF mentions needing a pull-up resistor, but I'm not sure as to why that is.

Link to comment
Share on other sites

It's lower then I expected, but the negative voltage isn't a good thing.  If it were me I'd use a lm393 and a couple resistors as it's a heck of a lot cheaper then a specialized VR chip.

Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...