Here is also an Arduino sketch I put together some time ago to "bit bang" crank signals out on the digital pins. It does a 50% duty cycle square wave for delco's, as well as both the 24x and 60-2 signal for LS engines. You can adjust the output speed (RPM) by using a pot to change the 0-5v input into arduino pin A1.
I intended to wire up a simple transistor and pull-up resistor circuit to the required output pin to create the signal output for testing ecu's on the bench. I have never got around to using it. I cant remember which digital pins were which signal outputs off the top of my head, I used direct port manipulation to speed things up, but you should be able to work it out fairly easy. I did test it with an oscilloscope when I had access to one and the signals looked pretty good despite being bit banged in software. I don't think I got around to adjusting the "delay times" to make the RPM adjustment range into a logical RPM range. Theres obviously an upper limit to how fast it will work being bit banged (maybe a couple of thousand RPM).
Code: Select all
/*
* PMAN92'S CRANK SIGNAL GENERATOR, INCLUDES:
* 50% DUTY CYCLE SQUARE WAVE - SUIT DELCO ECU/PCM
* 24X SIGNAL - SUIT GEN 3
* 60-2 - SUIT GEN 4+
*/
//Delay times are the microseconds delay between each loop (between each 3 degrees of crankshaft rotation)
#define FASTEST_SPEED_DELAY 0
#define SLOWEST_SPEED_DELAY 800
byte output[] = {
B0000000, //3 => signal state after 3 degrees of crankshaft rotation
B0000000, //6 => (there are 120 values, 120x3 = 360 degrees total)
B0000000, //9
B0000010, //12
B0000000, //15
B0000011, //18
B0000010, //21
B0000011, //24
B0000010, //27
B0000001, //30
B0000010, //33
B0000011, //36
B0000010, //39
B0000011, //42
B0000100, //45
B0000111, //48
B0000110, //51
B0000111, //54
B0000110, //57
B0000101, //60
B0000110, //63
B0000111, //66
B0000110, //69
B0000111, //72
B0000100, //75
B0000111, //78
B0000110, //81
B0000111, //84
B0000110, //87
B0000001, //90
B0000000, //93
B0000001, //96
B0000000, //99
B0000011, //102
B0000000, //105
B0000011, //108
B0000010, //111
B0000011, //114
B0000010, //117
B0000001, //120
B0000010, //123
B0000011, //126
B0000010, //129
B0000011, //132
B0000100, //135
B0000111, //138
B0000110, //141
B0000111, //144
B0000110, //147
B0000101, //150
B0000100, //153
B0000101, //156
B0000100, //159
B0000111, //162
B0000100, //165
B0000101, //168
B0000100, //171
B0000101, //174
B0000110, //177
B0000001, //180
B0000010, //183
B0000011, //186
B0000010, //189
B0000011, //192
B0000000, //195
B0000011, //198
B0000010, //201
B0000011, //204
B0000010, //207
B0000001, //210
B0000000, //213
B0000001, //216
B0000000, //219
B0000011, //222
B0000100, //225
B0000101, //228
B0000100, //231
B0000101, //234
B0000110, //237
B0000101, //240
B0000100, //243
B0000101, //246
B0000100, //249
B0000111, //252
B0000100, //255
B0000111, //258
B0000110, //261
B0000111, //264
B0000110, //267
B0000001, //270
B0000000, //273
B0000001, //276
B0000000, //279
B0000011, //282
B0000000, //285
B0000011, //288
B0000010, //291
B0000011, //294
B0000010, //297
B0000001, //300
B0000000, //303
B0000001, //306
B0000000, //309
B0000011, //312
B0000100, //315
B0000101, //318
B0000100, //321
B0000101, //324
B0000110, //327
B0000101, //330
B0000100, //333
B0000101, //336
B0000100, //339
B0000111, //342
B0000100, //345
B0000101, //348
B0000100, //351
B0000101, //354
B0000110, //357
B0000001 //360 => the signal state switches to this after 360 degrees (IE. this is the first 3 degrees of the pattern)
};
void setup() {
DDRD = B11111111; //set digital pin 0 - 7 as outputs
pinMode(13, OUTPUT); //LED Pin
pinMode(A1, INPUT);
}
void loop() {
static boolean LEDstate = true;
static byte currentPosition = 119; //there is 120 values (0-119)
PORTD = output[currentPosition];
currentPosition++;
if(currentPosition >= 120){
currentPosition = 0;
LEDstate = !LEDstate;
digitalWrite(13, LEDstate);
}
int speedRequest = analogRead(A1);
int delayTime = map(speedRequest, 0, 1024, SLOWEST_SPEED_DELAY, FASTEST_SPEED_DELAY);
delayMicroseconds(delayTime);
}