Diesel engine Alternator W signal RPM

Hey every one, i messing around arduino for some time, but i have a project and cant go forward, need some expert help.

Folowing this thread:

I made the same filter, using a 5v zener, 4,7 resistor and a .47uf capacitor, so the W signal from alternator enter the filter, and go out to pin 9 in arduino. the ground of the filter go to the car and arduino, in this case it dont show anything, but if i remove the ground of the arduino it the messy but i get some reading.

have some pics from the parts attached

I have a vw transporter t4 with w rpm signal from the alternator similar as the dude from the other thread.

runing this same code:

const int pulsePin = 9;
int pulseHigh;
int pulseLow;
float pulseTotal;
float freq;
float rpm;
int polos = 12;

void setup()
{
  pinMode(pulsePin, INPUT);
  Serial.begin(9600);
}
void loop()
{
pulseHigh = pulseIn(pulsePin,HIGH);
pulseLow = pulseIn(pulsePin,LOW);
pulseTotal = pulseHigh + pulseLow;
freq = 1000000/pulseTotal;
rpm = (60*freq)/polos;
Serial.println(rpm);
}

what im missing for this doesnt work ?

Does pulseHigh and pulseLow ever get longer than about 32 milliseconds? If so you better make them long instead of int.

1: foto3.gif shows "inf" 4 times. Does that mean "infinite"?

2: Please try this: put in "Serial.writeln()" statements for pulseHigh, pulseLow, pulseTotal and freq. I'd like to see the result...

aarg:
Does pulseHigh and pulseLow ever get longer than about 32 milliseconds? If so you better make them long instead of int.

const int pulsePin = 9;
long pulseHigh;
long pulseLow;
float pulseTotal;
float freq;
float rpm;
int polos = 12;

void setup()
{
  pinMode(pulsePin, INPUT);
  Serial.begin(9600);
}
void loop()
{
pulseHigh = pulseIn(pulsePin,HIGH);
pulseLow = pulseIn(pulsePin,LOW);
pulseTotal = pulseHigh + pulseLow;
freq = 1000000/pulseTotal;
rpm = (60*freq)/polos;
Serial.print("rpm ");
Serial.println(rpm);
Serial.print("freq ");
Serial.println(freq);
Serial.print("pulsehigh ");
Serial.println(pulseHigh);
Serial.print("pulselow ");
Serial.println(pulseLow);
Serial.print("pulsetotal ");
Serial.println(pulseTotal);
}

but still get inf on serial monitor.

Erik_Baas:
1: foto3.gif shows “inf” 4 times. Does that mean “infinite”?

2: Please try this: put in “Serial.writeln()” statements for pulseHigh, pulseLow, pulseTotal and freq. I’d like to see the result…

1: i dont know.

2: see the pictures foto5 below i have change from int to long and still get INF, pic “allground” it arduino groundet to the filter and the car, “noarduinoground” its filter grounded to the car but not on arduino, and “no car grounded” its the filter grounded to the arduino but not to the car (and looks like the best and consist result).

Still no clue…

One remark though: “float pulseTotal;” should be “long pulseTotal;”. After all it’s the sum of long pulseHigh and long pulseLow, so it will never have decimals.

Can you measure the voltage on Arduino pin 9 (preferably with an oscilloscope)? The capacitor or the zenerdiode may be defect (shorted internally).

Erik_Baas:
Still no clue…

One remark though: “float pulseTotal;” should be “long pulseTotal;”. After all it’s the sum of long pulseHigh and long pulseLow, so it will never have decimals.

Can you measure the voltage on Arduino pin 9 (preferably with an oscilloscope)? The capacitor or the zenerdiode may be defect (shorted internally).

Ok, ill change pulsetotal to long, i just copy the mk2guy threat code. he said that it works, but not for me, i have change the capacitor already, stupid question, can it be 650v or need to be 16v or near? i didnt find lower voltage, and its .47uf same as 0,47 right? im not a eletronic expert, just basics. ill try other zener.

and i dont have a osciloscope, ill try to get one for test.

on of this will work for me?
https://www.amazon.com/Tekit-Printing-yellow-1-75mm-Filament/dp/B00YRNB2LM

arved:
capacitor [..] can it be 650v or need to be 16v or near?

Im guessing the one with 650V is polyester, the other one an electrolytic? Use the first one, it'll live longer. :wink:

arved:
.47uf same as 0,47 ?

Yes, actually it's 0.47 µF.

arved:
on of this will work for me?
https://www.amazon.com/Tekit-Printing-yellow-1-75mm-Filament/dp/B00YRNB2LM

Sure, I have an older version of this (but cheaper) from AliExpress. Range, buttons, display etc. are identical.

You might look here for someone who has gone down this path before.

John

Don’t forget when you get this working , that the alternator runs at a faster speed than the crankshaft .

Erik_Baas:
Im guessing the one with 650V is polyester, the other one an electrolytic? Use the first one, it’ll live longer. :wink:

Yes, actually it’s 0.47 µF.

Sure, I have an older version of this (but cheaper) from AliExpress. Range, buttons, display etc. are identical.

thanks erik, buy this osciloscope yesterday, hope it come fast to make sure every thing its working

JohnRob:
You might look here for someone who has gone down this path before.

John

ill take a look, and try this too thanks.

hammy:
Don’t forget when you get this working , that the alternator runs at a faster speed than the crankshaft .

yes i know, ill adjust the rpm, but first make the arduino read…

Today got my oscilloscope

Get a idle reading and a full throttle, without Arduino filter I build

But I don’t know if it’s a right reading

See attachment

See attachment

Where?

IPhone don’t upload the photo right

F02E001C-07FF-4F2E-9425-B62E241713E4.png

If someone have some tips for iPhone upload I’ll be glad :slight_smile:

F02E001C-07FF-4F2E-9425-B62E241713E4.png