Firmware live stream happening this weekend: viewtopic.php?f=13&p=43195
For anything you'd like to see added to Speeduino
By klotzy_550
Hi everyone,

I think this topic came up a few years ago, but I couldn't find anything relevant on it when searching the forum. I want to setup a phase detection using the Map sensor on a single cylinder engine. I am sure that I could achieve this purely in software, but in the meantime I was planning on adding in a little architecture within the read map cycle minimum code that generated a pulse that was proportional to current speed. This pulse would happen just after the minimum had been recorded. My only real concern with this method is subtle variation in where this cycle minimum lies on a crank angle basis.

What are people's general consensus on this? What other methodologies are available minus the physical cam sensor?


By klotzy_550
Something along these lines:
Code: Select all
case 2:
  //Minimum reading in a cycle
  if (currentStatus.RPM > 0 ) //If the engine isn't running, fall back to instantaneous reads
	if( (MAPcurRev == currentStatus.startRevolutions) || ((MAPcurRev+1) == currentStatus.startRevolutions) ) //2 revolutions are looked at for 4 stroke. 2 stroke not currently catered for.
	  #if defined(ANALOG_ISR_MAP)
		tempReading = AnChannel[pinMAP-A0];
		tempReading = analogRead(pinMAP);
		tempReading = analogRead(pinMAP);
	  //Error check
	  if( (tempReading < VALID_MAP_MAX) && (tempReading > VALID_MAP_MIN) )
		if( (unsigned long)tempReading < MAPrunningValue )
		  MAPrunningValue = (unsigned long)tempReading; //Check whether the current reading is lower than the running minimum
		  digitalWrite(pinTrigger2, LOW);	// generate falling edge for trigger 2 once the INT Valve starts to open until the minimum value
	  else { mapErrorCount += 1; }
	  //Reaching here means that the last cylce has completed and the MAP value should be calculated

	  //Update the calculation times and last value. These are used by the MAP based Accel enrich
	  MAPlast = currentStatus.MAP;
	  MAPlast_time = MAP_time;
	  MAP_time = micros();

	  currentStatus.mapADC = MAPrunningValue;
	  currentStatus.MAP = fastMap10Bit(currentStatus.mapADC, configPage2.mapMin, configPage2.mapMax); //Get the current MAP value
	  if(currentStatus.MAP < 0) { currentStatus.MAP = 0; } //Sanity check
	  MAPcurRev = currentStatus.startRevolutions; //Reset the current rev count
	  MAPrunningValue = 1023; //Reset the latest value so the next reading will always be lower
	  digitalWrite(pinTrigger2, HIGH);	// reset the pulse for Trigger 2
  else { instanteneousMAPReading(); }
User avatar
Are you simply looking to establish a known stroke event within roughly 180°, e.g., which stroke is "intake" ±90°? Or more info than that?

As Speeduino already knows the crank angle at any moment, this could be referenced to the minimum or maximum MAP signal and output as the cycle signal, or cycle signal crank position + or - x° if required, perhaps as a TA value. BTW, an alternative I have used before is a pressure sensor reading the throttle bore at the butterfly or bore venturi. While there is lots of noise, there is also one strong primary signal that accompanies airflow (not manifold vacuum) at that restricted point.

For others: Cycle signals are fun to brainstorm because they can be any consistently repetitive signal every 720° on a 4-stroke, so rocker arm position, valve position, spring compression (transducer/others), timing gear, cam lobe, chain link, intake pulse, exhaust pulse (watch harmonics), idler gear pulse, proximity sensor pulse, cylinder pressure (multiple methods), crankcase pressure, spark discharge voltage (higher on compression), compression release valve position, oil pump position, fuel pressure pulses, and so on. Each has its pros and cons, and applicability, specific to the application of course. All of these can be a variety of sensing methods, from Hall to VR, magneto-resitive, IR, laser, transducer, sonic, proximity, density, and so on.
By klotzy_550
Yes, just trying to establish a known stroke event within a semi defined window. Using this information I would like to run sequential fueling / Spark if possible. Ultimately if I cannot get it to work as desired I can resort to batch fueling and wasted spark.

I already have an encoder on the crankshaft, but no cam encoder. The OEM ecu runs sequential fuel / ignition and detects phase with the map sensor signal.

Does this seem feasible?
User avatar
I don't see why not, and @jama is working on the multiple-MAP stuff right now, including a cycle-sense routine. Most of it is on Slack in the #dev channel. I have heard of others using it. The venturi/blade signal I used was not for cycle sensing, but the intake airflow pulse was unmistakable on a crude vacuum gauge, and why I think it might be an option for your purposes. This was discussed here a long time ago I'm pretty sure. :? Any way to help?

By klotzy_550
Thanks for the input David, much appreciated.

I have been reading through the Speedy Manual lately, trying to catch back up with where Speeduino is currently at. One thing I cannot definitively determine is if it simultaneously supports Cam and Crank, both with missing teeth. For example: Crank: 36-1, Cam: +1. If I run Speeduino without a cam signal, will it inject fuel every revolution? Half the desired fuel quantity every 360°?

User avatar
klotzy_550 wrote:
Tue Nov 26, 2019 3:46 pm
… One thing I cannot definitively determine is if it simultaneously supports Cam and Crank, both with missing teeth. For example: Crank: 36-1, Cam: +1.
If you mean a simple 36-1/1, then yes it does, e.g., many Fords are 36-1 crank with a single pulse per-cycle from the "cam" sensor. Speeduino can use missing-tooth crank-only, or missing and either a 1-pulse cam or 4-1 pulse cam. If it has cam signal, it doesn't need missing teeth on the crank (Dual Wheel). Other wonky combinations with specific decoders.
klotzy_550 wrote:
Tue Nov 26, 2019 3:46 pm
If I run Speeduino without a cam signal, will it inject fuel every revolution? Half the desired fuel quantity every 360°?
If you set it that way, which is effectively "double-shot sequential", commonly used by the OEMs today such as Daimler-Chrysler. Conversely, it can fire once per-cycle, though it's not timed for which cycle it's using.

By klotzy_550
Awesome, great to hear! Thanks again for the input.
PCB for BMW m52 engine

Hi! Leave out the IGBTs and jump over those like t[…]

NA VVT Swap No Start

Relevant manual page:[…]

E190 2.3 8V FUEL ONLY

I think there is a reason why OEM bosch costs 70$ […]

May 2020 firmware release

I could try the 680 ohm, but the onboard pullup […]

Still can't find what you're looking for?