Arduino development board
Posted: Mon Dec 30, 2013 11:35 pm
Most of us drive these old diesels because they don't require any electronics hooked up to make them run.
But there are times when it would be nice to hook up to an engine analyser or computer and see how everything is running.
I've started playing with the Arduino stuff last winter, didn't do much with it over the summer, tried to understand how to program it.
I see there is a guy over on the GTD forum that is working on an Arduino VNT turbo controller.
http://dmn.kuulalaakeri.org/vnt-lda/
A little over my head so I'll learn alot from it.
I'd like to build a diesel engine analyser, using an injector pulse detector and a refelctive sensor on the flywheel.
These boards are getting more popular with people who like to build things themselves.
I'm wondering how many people on here have experience with the Arduino.
I really don't know what I'm doing but this is the sketch (program) I'm working on:
But there are times when it would be nice to hook up to an engine analyser or computer and see how everything is running.
I've started playing with the Arduino stuff last winter, didn't do much with it over the summer, tried to understand how to program it.
I see there is a guy over on the GTD forum that is working on an Arduino VNT turbo controller.
http://dmn.kuulalaakeri.org/vnt-lda/
A little over my head so I'll learn alot from it.
I'd like to build a diesel engine analyser, using an injector pulse detector and a refelctive sensor on the flywheel.
These boards are getting more popular with people who like to build things themselves.
I'm wondering how many people on here have experience with the Arduino.
I really don't know what I'm doing but this is the sketch (program) I'm working on:
Any tips would surely be appreciated./*
* Finds time from TDC1, TDC2 and Peaktime and calculates BTDC.
* First it looks for a LOW on the pulse detector to trigger a start. It starts counting and looks for a LOW on the TDC sensor. TDC1 stores the timing of the event.
* Then it looks for the second TDC LOW which gets stored in TDC4.
* The pulse comes before TDC1.
*/
long btdcCalc (int a);
int tdcCalc (int a);
const int pulsePin = 1; // digital pin 2, referred to as interupt pin 0, connected to the injector line pulse detector
const int tdcPin = 3; // digital pin 3, referred to as interupt pin 1 connected to flywheel TDC sensor
int a; //for loop variable
long pulseStart; //holds the time the flywheel sensor goes low.
long microsecrotate; //used to calculate RPM
unsigned long TDC4; //TDC on cyl 4, 1 on flywheel sensor, 0 on sprocket sensor
unsigned long TDC1; //TDC on cyl 1, 1 on flywheel sensor, 1 on flywheel sensor, both HIGH
int rpmX; //The X axis on the graph
int tdcY; //The Y axis on the graph
void setup()
{
Serial.begin(9600);
pinMode(pulsePin, INPUT);
pinMode(tdcPin, INPUT);
attachInterrupt(0, btdcCalc, FALLING); //interrupt connected to pin2 injector line pulse detector
void btdcCalc(){
pulseStart = micros ();
}
attachInterrupt(1, tdcCalc, FALLING) //interupt attached to pin3 flywheel laser sensor
void tdcCalc(){
if (TDC1 == 0 && pulseStart != 0) // if the flywheel triggers was it cylinder 1 or 4
{TDC1 = micros} // 1 triggers right after the pulse
else if (TDC1 != 0 && pulseStart != 0)
{TDC4 = micros}
}
}
void loop()
{
if (pulseStart != 0 && TDC1 != 0 && TDC4 != 0) //if all the sensors have stored data in the variables start the math process
{
(TDC1 - TDC4) = microsecrotate // Subtracts the starting event TDC4, from the final event TDC1, finding the microsecs per revolution
rpmX = (60000000 / microsecrotate) //60 million micro seconds divided by the total time between events gives us the RPM
tdcY = ((TDC1 - pulseStart) / ((TDC1-TDC4) / 360)) // The timing pulse happens how many degrees before TDC1? BTDC
}
pulseStart = 0 //clear these variable so we know if they have been triggered
TDC1 = 0
TDC4 = 0
}