## Main Question or Discussion Point

Hi everyone, first post so go easy :)

What I want to do is design a circuit to add two square wave frequencies into one output.

The use is for a vehicle fitted with a Karman Vortex mass airflow sensor.
The MAF sensor has a 5V square wave output of 0~150Hz.
The vehicle has been modified with twin throttle bodies currently plumbed back to a single MAF.
The idea is to run two MAF sensors, one for each throttle body.

So how do I combine the two signals into one output to the ECU?
The problem that I see is that even if the two signals are 180 degrees out of phase, they must still add. Ie. 50Hz + 50Hz input, regardless of phase, must = 100Hz output.

All feedback appreciated,

Mitch.

Related Electrical Engineering News on Phys.org
I think I get the idea. You don't care about phase and amplitudes. If one signal has a frequency of F1 and the other F2, you want the output to have a frequency of F1+F2, correct?

This would be new to me. The first thing I would do is look at a PPL VCO (phase lock loop, voltage controled oscillator).

I think I get the idea. You don't care about phase and amplitudes. If one signal has a frequency of F1 and the other F2, you want the output to have a frequency of F1+F2, correct?
You got it, that's exactly what I'm looking for.

This would be new to me. The first thing I would do is look at a PPL VCO (phase lock loop, voltage controled oscillator).
Ok then. Time to hit Google and look that up. Forgive me but I'm an electronics noob.

the CD4046 is a CMOS PLL-VCO---of course there's always an easier way to do something.

would a mixer work?
it will return F1-F2 and F1+F2
put a high pass filter to get rid of the lower frequency

I really don't know edmondng. Care to elaborate?
EDIT: Actually given the low frequency's I'm dealing with (30~150Hz) would it even be possible to filter out the original input frequencies?

Last edited:
berkeman
Mentor
The biggest problems are the 0 Hz thing and the "square wave" thing. You will need to understand what the ECU expects out of the MAF signal, before you can pick the best way (if one exists) of combining the two MAF signals into one for the ECU.

For example, if the ECU divides the MAF square wave down by two right away (like, it is only rising edge sensitive), then it is easier to combine the two signals with an adder or some such thing, since you wouldn't care about the duty cycle, only getting the right number of rising edges. You should also find out about the response time and stability criteria for the ECU, since you could confuse it if the two MAF sensors rolled through phase and gave the ECU some jittery edges.

If the ECU expects a 50% duty cycle input signal from the MAF, then you have to do more work. And the 0 Hz part is still a problem for this. What is the minimum frequency really, that is, what is it at idle. Probably not 0 Hz, right? If it is something reasonable, then you can take the two MAF signals, add them, and phase lock a 50% duty cycle signal to them as suggested already. Your comparison in the PLL will be between the added signal divided by 2, versus the PLL output signal divided by 2. That gets rid of jitter in the comparison, and as long as your PLL output is reasonably square, the ECU should be okay with it.

But even with a PLL, you are going to have to trade off PLL lock delay and jitter numbers, versus how fast and accurate you want your ECU to be able to respond.

You might be best off just to stay with the single MAF sensor to the ECU, and maybe make a simple comparison circuit for now that measures the difference in MAF from the two sensors, and just displays that for you to see. If the two MAFs are giving about the same readings anyway, then there is no reason to go to the pretty big trouble of combining the signals, IMO.

If the ECU expects a 50% duty cycle input signal from the MAF, then you have to do more work. And the 0 Hz part is still a problem for this. What is the minimum frequency really, that is, what is it at idle. Probably not 0 Hz, right? If it is something reasonable, then you can take the two MAF signals, add them, and phase lock a 50% duty cycle signal to them as suggested already. Your comparison in the PLL will be between the added signal divided by 2, versus the PLL output signal divided by 2. That gets rid of jitter in the comparison, and as long as your PLL output is reasonably square, the ECU should be okay with it.
Ok, the MAF sensor outputs a 5V square wave signal of ~30Hz at idle rising to ~150Hz at WOT.
The MAF sensors output is 50% duty cycle.

Your example above makes the most sense to me and eliminates problems introduced by phase shift.

But your right, I need to find out if the ECU is rising edge sensitive or requires a 50% duty cycle square wave.
But even with a PLL, you are going to have to trade off PLL lock delay and jitter numbers, versus how fast and accurate you want your ECU to be able to respond.
So how much delay are we talking about here?

Obviously I've got a lot to learn, I'm going to reserch about PLL's and how they work.

Thanks for the great reply even if I didn't understand half of it :)

berkeman
Mentor
So when you go to two MAF sensors, the output frequency range of each will now be about 15Hz-75Hz, right?

I'd suggest drawing a few representative waveforms (with different phases, etc.), to start to get an idea for how you might want to combine them. You can also do a full-digital PLL without an analog VCO for this low-frequency project. You would run a higher-freq digital clock (say, 32kHz like with a watch crystal, or 10MHz with a regular crystal oscillator), and oversample the MAF digital signals, and compute what the sum waveform would be, and output that to the ECU. That would be a fun all-digital project for you.

So when you go to two MAF sensors, the output frequency range of each will now be about 15Hz-75Hz, right?
You got it.
You can also do a full-digital PLL without an analog VCO for this low-frequency project. You would run a higher-freq digital clock (say, 32kHz like with a watch crystal, or 10MHz with a regular crystal oscillator), and oversample the MAF digital signals, and compute what the sum waveform would be, and output that to the ECU. That would be a fun all-digital project for you.
Hahah, sounds way over my head but if you point me in the right direction I'll give it a go.

berkeman
Mentor
I'm not sure I can point you to a good design reference... maybe others reading this thread will know of a good reference for you to read up on this.

If a brief description would help, I'll try that. Basically you would have two high-frequency counters running, counting the half periods of each of the MAF sensor outputs. Each time a counter finished counting a half period, that information would go toward adjusting the half period of your final output counter.

So if you used a 32kHz watch crystal as your time base, you would get to a half period count of about 425/2 for a 75Hz input square wave from a MAF, and a half period count of about 2100/2 for a 15Hz input. Each time you got an update from either MAF's counter (each rising or falling edge of the MAF output waveform), you would use that number plus the most recent number from the other MAF channel to pre-set the next terminal count for the output counter. There's a little bit of arbitration and synchronization stuff that has to happen also, but that's a bit complicated to get into in this simple explanation.

So I think you see the concept of how it would work. I still think as a practical matter, it's best to just stick with a single MAF sensor output. Well, except it just occurred to me that the MAF output will now be too low in frequency, since you have divided the airflow in half. Yikes. Any chance the ECU can be re-mapped to handle the 1/2 MAF output frequency?

You could be making more work for yourself than necessary.

If you expect the two MAF to output about the same frequency, you many only need to take the signal from one, and double it.

By the way, I really like the half-adder idea. Ultimately simple, if not a bit chaotic. Of course you may never know what the ECU expects to see. But if the ECU samples the MAV infrequently, instead of every wave, or doesn't do any sort of averaging, then it wouldn't work at all.

Last edited:
You could be making more work for yourself than necessary.

If you expect the two MAF to output about the same frequency, you many only need to take the signal from one, and double it.
Well this is the problem, there is no guarantee that both MAF sensors would have the same airflow. Also if one filter was to become more restricted then the other, then that would throw it out of balance. Unfortunatly this won't work reliably.

By the way, I really like the half-adder idea. Ultimately simple, if not a bit chaotic. Of course you may never know what the ECU expects to see. But if the ECU samples the MAV infrequently, instead of every wave, or doesn't do any sort of averaging, then it wouldn't work at all.
I'll do some asking around and find out what the ECU needs

How about using a frequency to Voltage Converter and Voltage to frequency converter to achieve this??
Use F to V converter for two inputs F1 and F2 to get V1 and V2 respectively, then add those two analog voltage and again use V to F converter to get a frequency output. Dont have idea on pros and cons.... just an idea to achieve frequency addition.