DIY-Flow-Bench icon indicating copy to clipboard operation
DIY-Flow-Bench copied to clipboard

Frequency based MAF sensor

Open DeeEmm opened this issue 5 years ago • 6 comments

Add support for frequency based MAF sensors

As requested by Branco Jurgec via FB - https://www.facebook.com/branko.jurgec?comment_id=Y29tbWVudDoyNzA3NTkwOTg5Mjk4OTk2XzI5OTIwOTY4NDA4NDg0MDg%3D

DeeEmm avatar Apr 26 '20 04:04 DeeEmm

Example Frequency MAF data file. (GM Monaro)

/***********************************************************
 * VDO-AFM-043.h
 *
 * Manufacturer: VDO | Siemens
 * Part#: AFM-043 | 25008302 | A2C59506198
 * MAF file for type: GM GenIII LS1 / VT-VX-VY 5.7 Commodore / Monaro 
 * File units = 100 * gm / sec
 * Comments: Basic test data
 * Status:
 * Support: https://github.com/DeeEmm/DIY-Flow-Bench/wiki/MAF-Data-Files
 * Discussion: https://github.com/DeeEmm/DIY-Flow-Bench/discussions/51
 ***/
#pragma once

#include "../mafData.h"
#include "../constants.h"



MafData::MafData () {
	
}


/***********************************************************
 * MAF Type
 *
 ***/
String MafData::mafSensorType () { 
	
	String mafSensorType = "VDO-AFM-043";
	
	return mafSensorType;
	
}

/***********************************************************
 * MAF Output Type
 *
 * VOLTAGE
 * FREQUENCY
 ***/
int MafData::MAFoutputType() {
 
	int MAFoutputType = FREQUENCY;
	
	return MAFoutputType;
}


/***********************************************************
 * MAF Data format
 * 
 * KEY_VALUE
 * RAW_ANALOG
 ***/
int MafData::MAFdataFormat () {
	
	int  MAFdataFormat = KEY_VALUE; 
	return MAFdataFormat;
}


/***********************************************************
 * MAF Units
 * 
 * KG_H
 * MG_S
 ***/
int MafData::MAFdataUnit () {
	
	int MAFdataUnit = MG_S;
	return MAFdataUnit;
}


/***********************************************************
 * Kay>Val MAF Data 
 *
 ***/
long MafData::getMafData() {
		
	long mafLookupTable [][2] = {
		{1500,214},
		{1625,259},
		{1750,307},
		{1875,359},
		{2000,415},
		{2125,474},
		{2250,540},
		{2375,610},
		{2500,685},
		{2625,767},
		{2750,855},
		{2875,948},
		{3000,1050},
		{3125,1159},
		{3250,1276},
		{3375,1402},
		{3500,1534},
		{3625,1695},
		{3750,1866},
		{3875,2052},
		{4000,2229},
		{4125,2416},
		{4250,2616},
		{4375,2826},
		{4500,3048},
		{4625,3283},
		{4750,3530},
		{4875,3791},
		{5000,4066},
		{5125,4354},
		{5250,4657},
		{5375,4974},
		{5500,5306},
		{5625,5655},
		{5750,6019},
		{5875,6398},
		{6000,6795},
		{6125,7209},
		{6250,7641},
		{6375,8091},
		{6500,8558},
		{6625,9045},
		{6750,9550},
		{6875,10074},
		{7000,10620},
		{7125,11184},
		{7250,11770},
		{7375,12376},
		{7500,13004},
		{7625,13654},
		{7750,14326},
		{7875,15020},
		{8000,15738},
		{8125,16479},
		{8250,17244},
		{8375,18032},
		{8500,18846},
		{8625,19684},
		{8750,20548},
		{8875,21438},
		{9000,22353},
		{9125,23295},
		{9250,24264},
		{9375,25260},
		{9500,26284},
		{9625,27337},
		{9750,28417},
		{9875,29527},
		{10000,30666},
		{10125,31834},
		{10250,33033},
		{10375,34262},
		{10500,35521},
		{10625,36813},
		{10750,38135},
		{10875,39490},
		{11000,40877},
		{11125,42297},
		{11250,43750},
		{11375,45237},
		{11500,46758},
		{11625,48313},
		{11750,49902},
		{11875,51199},
		{12000,51199}
	};

}

NOTE: Need to use interrupt capable pin to be able to measure frequency

DeeEmm avatar Aug 21 '21 10:08 DeeEmm

Frequency based MAF sensor code implemented.

MafData file format changed from class structure back to header file to address conflicts.

WIKI info for MAF file creation updated

/***********************************************************
 * ACDELCO-19330122.h
 *
 * Manufacturer: AC Delco
 * Part#: 19330122
 * MAF file for type: Corvette Z06  
 * File units = 100 * gm / sec
 * Comments: Basic test data
 * Status:
 * Support: https://github.com/DeeEmm/DIY-Flow-Bench/wiki/MAF-Data-Files
 * Discussion: https://github.com/DeeEmm/DIY-Flow-Bench/discussions/51
 ***/
#ifndef MAFDATA
#define MAFDATA

//#ifdef ACDELCO_19330122

#include "../constants.h"


/***********************************************************
 * MAF Type
 *
 ***/

String mafSensorType = "ACDELCO_19330122";


/***********************************************************
 * MAF Output Type
 *
 * VOLTAGE
 * FREQUENCY
 ***/

int MAFoutputType = FREQUENCY;



/***********************************************************
 * MAF Units
 * 
 * KG_H
 * MG_S
 ***/

int MAFdataUnit = MG_S;


/***********************************************************
 * Kay>Val MAF Data 
 *
 ***/
 
 long mafLookupTable [][2] = {
		{1500,142},
		{1625,176},
		{1750,210},
		{1875,248},

                ... etc ...

		{11625,39951},
		{11750,41377},
		{11875,42845},
		{12000,44360}
	};
#endif

DeeEmm avatar Aug 24 '21 02:08 DeeEmm

Codebase has changed substantially and as a result the code for frequency based MAFs is now broken.

Need to revisit this feature and get it working again.

The main issue that was encountered was the interrupt nature of operation clashing with the task based operation. This was the reason that this code was removed.

Need to find a better way of implementing frequency based support

DeeEmm avatar Feb 01 '23 01:02 DeeEmm

I've pushed this out to the next release as I need to get the basic code finalised.

DeeEmm avatar Feb 01 '23 01:02 DeeEmm

Just going to leave an idea here, whilst doing some work on the shield I had the idea that the frequency measurement should be moved out to hardware by using a frequency to voltage converter. This will eliminate the software interrupt issues whilst still catering for both types of MAF.

MAF data will need to be remapped from frequency to voltage, but this should be simple to do in excel. Software will see no differentiation between MAF types.

This needs some more investigation but it could be as simple as utilising an external converter like this one or integrating an IC directly into the shield.

The BOB above is limited to 1khz which I believe makes it unsuitable to read most MAFs which are IRO 0-3khz but there are likely other more suitable solutions out there.

DeeEmm avatar Feb 02 '23 01:02 DeeEmm

Further to the above discussion of a hardware based frequency converter I stumbled across the following whilst looking for MAF Data...

https://www.thirdgen.org/forums/tpi/596907-cheap-frequency-voltage-converter.html

converter

It's an old post but no reason it should not work..

I found this going thru some of my old stuff. Its a circuit that uses an LM2917 freqency to voltage converter. I used this for a year or two before I converted over to a PCM that could read the MAF in directly. It works reasonably well for reading in the freqency based MAFs. Basically the circuit works as a charge pump that pumps charge into a capacitor that results in a voltage thats proportional to the frequency. The output is 0-5V for 0-12000 Hz input. The only special concerns with the circuit is that the 1000pf cap. and 55 kohm resistors need to be 5% or tighter tolerance wise. Its also recommended to use a mica capacitor for the 1000pf unit as they have very little variation with temperature. Also, make sure all electrolytic caps used in the circuit are rated for at least 35V, and proper polarity is observed.

You'll need to assemble it yourself, but it shouldnt cost more than $15-20 dollars for the parts.

DeeEmm avatar Apr 12 '23 02:04 DeeEmm