Frequency limiter, and hold at a set max frequency

Thread Starter

Berre195

Joined Feb 25, 2021
5
Hi,

Short version:
I have a sensor that generates a signal from 80Hz to ...Hz
I need to make a signal modifier that takes this input and follows it 1 to 1 so: 80Hz = 80Hz/100Hz = 100Hz/.... but if it gets to 155Hz or above it should keep outputting 155Hz.
So 180Hz = 155Hz / 200Hz = 155Hz
When the sensor drops below 155Hz it should go back to following the input

Long version:
This sensor is a MAP (manifold air pressure) on a car. This car is originally non turbo so the engine and thus the sensor only sees vacuum.
The car will have an aftermarket turbo and now this sensor will see positive pressure the car won't know what to do with this value and go in limp mode and not run right
The car only understands 80HZ to 155HZ (vacuum to atmosphere) adding a turbo will create positive pressure which means a value higher than 155Hz (according to some info I found its 0kpa = 159Hz, I'm saying 155Hz to have some buffer) The higher values will cause the limp mode
So I need to make something that outputs what this sensor outputs 80Hz-155Hz but if it goes over this it should keep outputting 155Hz untill it drops back down.

There was a company that made this modifier but it's not being made anymore, and a lot of the turbo kit's that had this modifier included don't have these anymore because they are all second hand (it's an old kit) and most people just didn't know it was part of the kit and didn't take it out the donor cars

A normal MAP sensor (on basicly any car) gives a 0-5V output and is very easy to modify but this ford sensor gives a frequency output.
So the part i'm looking for isn't existant/readily available in the automotive world.
But i was thinking in electronics there has to be a circuit that does just this.
It doesn't sound that hard, and someone must've had a use for something somelar like this

------------------------------------------------------------------------------------------------------------------------------------

What I have been thinking of is a high pass filter at 155hz
That would somehow know when its filtering and then switch to a 555 timer that is set at 155Hz
I have been racking my brain on how to connect these 2 circuits but I just don't know how.
I am really hoping there is someone here that has a circuit that can do this or something simular or help me figure this out.

I might be completly wrong in this reasoning, I have some knowledge of electronics but really not that in depth. so any help is really much appreciated

It should be possible with an arduino but i'd prefer the system to be as simple as possible.
There was one guy who tried it with an arduino but didn't get it to work.
So i'd preffer another approach.


Thank you for reading, any input is very welcome!
(and I appologise if this is in the wrong thread I wasn't sure where to put this)
 

dl324

Joined Mar 30, 2015
13,083
Welcome to AAC!

What are your restrictions on solution space? If the guy couldn't get it to work with an Arduino, the problem was him, not the Arduino. I'd go with an Arduino.

What would happen if this circuit malfunctioned?
 

crutschow

Joined Mar 14, 2008
27,708
Do you know if there is any requirement on the duty-cycle of the signal, i.e. does it need to be a square-wave or can the on/off ratio vary?
 

crutschow

Joined Mar 14, 2008
27,708
One though is to use a frequency to voltage converter at the MAP output, and use that voltage to switch to the fixed frequency (e.g. 555 astable) at the voltage that corresponds to 155Hz.
 

Thread Starter

Berre195

Joined Feb 25, 2021
5
Thank you!

There is plenty of space, i'd like it to not be to big but it really doesn't matter at all.

If the circuit would malfunction, the car would go in limp mode (wich is a safety mode so you can limp home).
And the car is a project car definatly not my daily car which has to get me to work every day.
I know the dangers connected it's really not an expensive car so if it fails it fails.

I found the guy's code, I am hoping to get in contact with him but it was posted in 2016 so I don't think I will get an answer.
So I don't really know what is wrong with it, the car gave an error code while running.
I only know the basics of programming, I made a couple of arduino projects. so i'm not to skilled at programming.
But it seems like it should work...
Maybe the arduino output is not strong enough.
If this looks ok, I could try it with a mosfet connected to 5v.


#include <FreqMeasure.h>
#include <Tone.h>
Tone tone1;
void setup() {
Serial.begin(57600);
FreqMeasure.begin();
tone1.begin(9);
pinMode(13 , OUTPUT);
}
double sum=0;
int count=0;
void loop() {
if (FreqMeasure.available()) {

sum = sum + FreqMeasure.read();
count = count + 1;
if (count > 1) {
float frequency = FreqMeasure.countToFrequency(sum / count);
Serial.println(frequency);
if (frequency <155) { tone1.play(frequency); }//frequency output off boost
else { tone1.play(154); }//frequency output on boost
sum = 0;
count = 0;
}
}
}
//it reads the frequency and if it`s below 155 output is 155 and if its more then 155 output it`s 155Hz
 

Thread Starter

Berre195

Joined Feb 25, 2021
5
One though is to use a frequency to voltage converter at the MAP output, and use that voltage to switch to the fixed frequency (e.g. 555 astable) at the voltage that corresponds to 155Hz.
I'm not sure I understand how this would work.
Map output is converted to variable voltage, when this voltage hits (for example) 2.5V (wich would be 155Hz) this switches the output that goes to the ecu from the map output, to a 555 timer?
How could I make it switch at a set voltage?

I don't know if there is a specific duty cycle.
I think i should maybe try making an arduino osiloscope and look at the sensor output to get some more info
 

crutschow

Joined Mar 14, 2008
27,708
How could I make it switch at a set voltage?
Use a comparator (e.g. LM339/LM393) with a voltage reference.
That will give a precise trip point to switch over to the 555 and back.

Do you know the voltage level of the MAP digital signal?
 
Last edited:

djsfantasi

Joined Apr 11, 2010
7,826
float frequency = FreqMeasure.countToFrequency(sum / count);
I don’t like this statement. He calculates the input to FreqMeasure.countToFrequency() using a mixture of types*. THEN, he possibly performs another type conversion. Doing this often results in code that doesn’t work.

Of course, we don’t know the type of FreqMeasure.countToFrequency(). Nor do we know the expected type of its parameter.

Nor do we know why this didn’t work.

At a minimum, I’d cast the int to a double inside the parentheses. Then, you’re dividing a double by a double. It would look like this...

float frequency = FreqMeasure.countToFrequency(sum / ( double) count);
* I’m using ‘type’ in the sense of the type of the variable. Like float, double, int...
 

crutschow

Joined Mar 14, 2008
27,708
Here's an update on simplifying the F to V conversion technique.
The LM2907 is designed to detect a desired frequency and change the output digital state.
Quote: The LM2907 and LM2917 devices are monolithic frequency-to-voltage converters with a high gain op amp designed to operate a relay, lamp, or other load when the input frequency reaches or exceeds a selected rate.
This output can thus be used to switch a digital gate to select either the MAP output or the 555 output to send to the car computer.
This will then require only the LM2907/LM2917, a single IC NAND gate package, and the 555 oscillator.
 

Thread Starter

Berre195

Joined Feb 25, 2021
5
The LM2907 is designed to detect a desired frequency and change the output digital state.
Quote: The LM2907 and LM2917 devices are monolithic frequency-to-voltage converters with a high gain op amp designed to operate a relay, lamp, or other load when the input frequency reaches or exceeds a selected rate.
This is perfect thank you so much, i will spend the rest of the evening learning about some new (new to me) ic's it seems like


I have been thinking about this all day, what i came up with was a simple zener diode at the correct voltage that is representative of 155Hz and this then feeds into the gate of 2 mosfets, one that disconnects the MAP output to the ECU and one to connect an astable 555timer.

I'm not sure if you can put the mosfets togheter like this or if this will cause issue's, i was thinking of a relay so i can use NO and NC contact but i'd preffer not having a "mechanical" contact, it might be to slow and everything mechanical wears out, I know it'd be a long time before the relay fails and quite easy to replace but a mosfet just seems better suited.

i'd actually need 3 mosfets because there is something unrelated that needs to be grounded

And i wasn't sure how accurate/reliable the zener will be in always cutting at the exact same voltage



Thank you again so much, this forum is amazing i wasn't expecting to have a solution (or at least an idea of what to do) this quickly.
 

Thread Starter

Berre195

Joined Feb 25, 2021
5
I don’t like this statement. He calculates the input to FreqMeasure.countToFrequency() using a mixture of types*. THEN, he possibly performs another type conversion. Doing this often results in code that doesn’t work.

Of course, we don’t know the type of FreqMeasure.countToFrequency(). Nor do we know the expected type of its parameter.

Nor do we know why this didn’t work.

At a minimum, I’d cast the int to a double inside the parentheses. Then, you’re dividing a double by a double. It would look like this...



* I’m using ‘type’ in the sense of the type of the variable. Like float, double, int...

Yeah i'm sorry i couldn't find to much information on the sensor (its 25+ years old and not very commonly used even back then)

I'm going to try it with the frequency to voltage converter, and if that doesn't work i'm going to put the sensor on an oscilloscope and see what it does. I'll try to gather as much info as possible and go the arduino route and start with the changes you suggested.

Anyway thank you so much for helping me out it is really appreciated
 
Top