How to process a funky signal.

MisterBill2

Joined Jan 23, 2018
18,920
If the MCU package can handle analog inputs that may still be the way to go. Or possibly not. Certainly a linear analog signal will have less noise riding along.
 

LowQCab

Joined Nov 6, 2012
4,186
I suspect that You are attempting to build your own Fuel-Injection-System.
You can save yourself some huge headaches by just purchasing a "Micro-Squirt" Computer.
It will also drive an Automotive-Ignition-Coil,
which is a huge bonus if you're running on Alcohol.

In the above type of application, connecting to the stock Ignition-Coil is a foolish game,
install a Hall-Effect-Sensor, or knock yourself out working-out all the bugs.
.
.
.
 

Thread Starter

dandy1

Joined Sep 30, 2017
178
I suspect that You are attempting to build your own Fuel-Injection-System.
You can save yourself some huge headaches by just purchasing a "Micro-Squirt" Computer.
It will also drive an Automotive-Ignition-Coil,
which is a huge bonus if you're running on Alcohol.

In the above type of application, connecting to the stock Ignition-Coil is a foolish game,
install a Hall-Effect-Sensor, or knock yourself out working-out all the bugs.
.
.
.
If only my skills were that capable, I'm appreciate your for forewarning but its just a simple generator.
 

Thread Starter

dandy1

Joined Sep 30, 2017
178
Going forward with the circuit from Ian0

1.JPG

The diodes in use are FR107 with a 1N4007 at the front. The bias resistor (in my case) is necessary and help produce a nice clean signal. Reducing the bias reduces the the amplitude of the positive peaks but at a cost of reduced negative peak so as it is works fine.

Is there a name for this type of circuit. Are they commonly used or are they more of a 'get out of jail'. What I mean to say is it doesn't need to be professional but is it robust?

Should I use a filter on the output and how?

I was concerned that when the power rail is off that the signal may try powering anything on the rails, with the currents involved (worst case 1mA for 2mS every 6mS) is this really an issue or would it be wise to add a zener?

Some suggestions have been made and I am not questioning them, just clarifying what is or is not necessary.
 

Ian0

Joined Aug 7, 2020
9,985
If you don't want any other information from the signal apart from its frequency, then add a monostable (a CMOS 555).
If you ground is connected to the engine casing, then the combination of diodes you have will prevent any current flowing into the supplies.
 

MisterBill2

Joined Jan 23, 2018
18,920
The circuit with the diodesand resistors is commonly called a "clamp circuit" because it clamps the signal level to between the two voltages.
 

LowQCab

Joined Nov 6, 2012
4,186
On a Generator application You automatically have
a beautiful, and almost perfect, Sine-Wave Tach-Output from the Generator-Windings.

The next question is,
are You simply "monitoring" the Output-Frequency ?,
or are You trying to actually "control" the Output-Frequency ?
.
.
.
 

Thread Starter

dandy1

Joined Sep 30, 2017
178
On a Generator application You automatically have
a beautiful, and almost perfect, Sine-Wave Tach-Output from the Generator-Windings.

The next question is,
are You simply "monitoring" the Output-Frequency ?,
or are You trying to actually "control" the Output-Frequency ?
.
.
.
The idea is to idle the engine when there's no current and knock it off if it hasn't drawn current for a while.
 

LowQCab

Joined Nov 6, 2012
4,186
This may "sound-like" a great idea,
but applying it in a practical manner is something else entirely.

This is something that the Generator manufacturers could have easily implemented, ~70-years ago,
have You ever asked yourself why they haven't ?,
and, that they don't even offer this functionality as an option ?

When no Current is being demanded from what ever Load is connected to the Generator,
there is almost zero Load being placed on the Engine,
so the Engine's Governor closes the Throttle almost completely,
even though the Engine is still turning over ~3000-rpm.
This means that the Engine's Fuel-Consumption drops dramatically,
because the only Load is the Internal-Friction of the Engine, and the Cooling-Fan.

You don't need to know the RPM of the Generator to get the functionality that You are asking for,
only that there is a "completed-Circuit" on one of the Generator's Outputs.

The Output-Voltage is quite low at Idle-Speeds,
so a completed-Circuit, ( a demand for Power ), may be a little tricky to detect reliably.

You also can't have any Loads that may get wacky with a
slow Voltage/Frequency increase like some certain types of Electronics.

Motors, and Resistive-Loads will probably tolerate the slow Voltage/Frequency increase.
.
.
.
 

Thread Starter

dandy1

Joined Sep 30, 2017
178
Update

I broke out the Arduino and here are the results:

RPM OUTPUT.JPG

Accurate and very usable. Not a single glitch in 10 mins of testing - follows the rev profile perfectly. Big thank you to
Ian0

Any issues with overshoot can be dispelled. I connected the circuit up to 3.95v, with the arduino running on 5.12, do the math if you like but the highest ADC value came back 790 which works out 3.95v.

ADC.JPG
 

strantor

Joined Oct 3, 2010
6,811
Cool! Good job!

If I'm reading that correctly (just going off the first group of 5 lines) you have a square wave or square-ish wave with on/off times measured in μS, with a duty cycle of roughly 85% and frequency of 51.68Hz, corresponding to an engine speed of ~3,100 RPM. Is that about right?

I was not aware Arduino can measure time in microseconds. I thought it is rather limited in that regard with only mS capability. Apparently I am wrong. Would you mind sharing that part of the code which you are using to get the on/off time in μS?
 

Thread Starter

dandy1

Joined Sep 30, 2017
178
Cool! Good job!

If I'm reading that correctly (just going off the first group of 5 lines) you have a square wave or square-ish wave with on/off times measured in μS, with a duty cycle of roughly 85% and frequency of 51.68Hz, corresponding to an engine speed of ~3,100 RPM. Is that about right?

I was not aware Arduino can measure time in microseconds. I thought it is rather limited in that regard with only mS capability. Apparently I am wrong. Would you mind sharing that part of the code which you are using to get the on/off time in μS?
int pulsePin = 8;
unsigned long pHigh;
unsigned long pLow;
unsigned long Rinterval;
void setup() {
pinMode (pulsePin, INPUT);
Serial.begin(9600);
}
void loop(){
for (int i = 0; i < 5; )
{
pHigh = pulseIn(pulsePin, HIGH);
pLow = pulseIn(pulsePin, LOW);
Rinterval = pHigh + pLow;
Serial.print("HIGH ");Serial.print(pHigh);Serial.print("\t");Serial.print("LOW ");Serial.print(pLow);
Serial.print("\t");Serial.print("INTERVAL ");Serial.println(Rinterval);
i++;
}
Serial.println(" NEXT");
}
 
Last edited:

strantor

Joined Oct 3, 2010
6,811
int pulsePin = 8;
unsigned long pHigh;
unsigned long pLow;
unsigned long Rinterval;
void setup() {
pinMode (pulsePin, INPUT);
Serial.begin(9600);
}
void loop(){
for (int i = 0; i < 5; )
{
pHigh = pulseIn(pulsePin, HIGH);
pLow = pulseIn(pulsePin, LOW);
Rinterval = pHigh + pLow;
Serial.print("HIGH ");Serial.print(pHigh);Serial.print("\t");Serial.print("LOW ");Serial.print(pLow);
Serial.print("\t");Serial.print("INTERVAL ");Serial.println(Rinterval);
i++;
}
Serial.println(" NEXT");
}
Thanks! I have somehow managed to never learn of pulseIn. This is very useful.
 
Top