Click on our menu buttons immediately below to find MegaSquirt® information quickly:

MegaManual Index -- MegaSquirt & Rotary Engines -- Throttle Body Issues
Ignition -- Setting the Parameters in MegaTune -- Injector Specifications
Mazda RX-7 Air and Coolant Temperature Sensors -- Kurt Staging --

MegaSquirt® & Rotary Engines

This is an overview for using MegaSquirt® on a Mazda rotary engine. It is not intended to be a primer on Wankel rotary engines themselves, only how to use MegaSquirt® with them. To find out more about Wankel rotary engines, go to Blake Qualley's excellent Rotary Engine Illustrated web site.

To understand how a rotary engine works with MegaSquirt® EFI Controller, we need to figure out how MegaSquirt® will 'see' the rotary in terms of injection cycles.

In 720° of crank rotation, a four-stroke cycle piston engine (two revolutions = 4 strokes) ingests its rated displacement (ignoring volumetric efficiency issues and the like) of air. In the same 720°, the rotary swallows twice its rated displacement (somewhat like a 2 stroke cycle engine).

To understand this, recall that a Wankel rotary engine has three faces on each rotor, evenly spaced at 120° apart. The rotors rotate at 1/3 the eccentric shaft speed, so we see an ignition event every 120°×3 = 360 degrees, and all three faces require 3×360° = 1080° of eccentric shaft rotation.

(Note that all of these factors are determined by the geometry of the case, housing, and gears, and are the same for all Wankel rotary engines.)

In the 13B, there are two rotors, however, and they are phased 180° apart, giving an ignition event every 180°, alternating between the rotors.

Crank DegreesPiston Engine
Cylinder Firing
Rotor Firing
11 (face 1)
180°32 (face 1)
360°41 (face 2)
540°22 (face 2)
720°1 - back where we started1 (face 3)
900°32 (face 3)
1080°41 (face 1) - back where we started

So to MegaSquirt® EFI Controller, the Mazda 13B rotary looks just like a 4 cylinder engine, except for having a 2nd set of plugs delayed by a few degrees. Each rotor has 3 chambers and executes an Otto cycle (intake-compression-power-exhaust) in 1080° of eccentric shaft rotation.

Therefore, setting up a rotary as a 4 stroke cycle, 4-cylinder (since it gives 4 tach pulses per 720°), and 2600cc (displacement x 2), works out fine. The number of squirts per cycle may need some experimentation for your specific installation, as with any MegaSquirt® installation.

Throttle Body Issues

The stock Mazda throttle body is progressive in nature, so injection must be as well if the stock EFI hardware is to be used without modification. This requires that MegaSquirt® fire primaries only until the secondary throttle plates have opened adequately. This can be achieved by using a version of MegaSquirt® code called 'Dual Table' which allows one to tune the two injector banks separately.


Note: You may need to add a 50K Ohm resistor to the coil signal from the OEM ignition to prevent rpm spikes, etc.

You have a few choices for ignition for a rotary engine:

Many different ignition solutions have been spawned from the base MegaSquirt® EFI Controller, such as MSnS. The rotary engine ignition requirements, with trailing firing after the leading, has not yet been achieved using MegaSquirt® or its derivatives. Some users are running a modified version of MSnEDIS, which uses a crank-mounted 36-1 wheel for timing, and fires four individual coils one per plug. They usually have it configured to fire the leading and trailing plugs together with zero split, and have noticed no complications in doing so. There may be issues when running boosted engines in this configuration, although much conflicting information exists on this topic.

Mike Robert spent some time on a dyno last year and was able to test what happened in the case of stock 'spilt' spark timing, trailing only, leading and trailing firing simultaneously (no split) timing and leading only timing.

The results were:

All of these tests were run with 26 degrees leading advance max on 87 octane pump gas.

However, idle and low load emissions might be better running both Leading & Trailing spark with split timing.

Setting the Parameters in MegaTune

For example, the 13B rotary consumes twice its rated displacement every two revolutions, acting effectively a 2600cc 4-cylinder 4-stroke. If you had 460 cc/min injectors, you would calculate Req_Fuel in MegaTune as follows:

The end result is a calculated Req_Fuel of 9.4 milliseconds.

Here is an example of a full rotary set-up:

Here's an .msq file for a 1986 stock-port 13B running staged injection code from Roger Enns:


And these are the settings as they appear in MegaTune:

and here is the megasquirt-I.ini file Roger uses:


Injector Specifications

Typical injector flow rates for Mazda rotary engines are:

MotorInjector Infocc/min
12A TurboBlue720
13B 6-Port2x injector720
4x injector430
13B Turbo Series 4 / 5red, purple, pink550
13B Turbo Series 6Primary550
20B TurboPrimary and Secondary550

As long as both primary and secondary are the same flow rate you can use 'Kurt Staging'. You fire primaries and secondaries in alternate mode, with the maximum squirt time being equal to 2 inlet periods. At high RPMs and WOT the injection periods will overlap, giving the same effect as staging. (Primaries in parallel on one injector bank, secondaries on other.)

Mazda RX-7 Air and Coolant Temperature Sensors

Stock Mazda sensors can be used by updating the firmware with new lookup tables using EasyTherm, and changing one bias resistor on the MegaSquirt® board.

The coolant temperature sensor is close in spec to the GM unit, so no change in bias resistor is needed. The air temperature thermistor on the other hand, is VERY different from GM sensor, which requires a bias resistor change. This is resistor R4 on the MegaSquirt® printed circuit board, and is 2.49K Ohm by default. For the Mazda sensor, use a 47K Ohm resistor, although any resistor in the 30K-50K Ohm range should work.

Use EasyTherm or equivalent to create and download the new thermistor tables.

The specs from the factory service manual (84-85 GSL-SE, 86-88 all models, likely 89+ as well) are as follows:

Coolant Temp:

Air Temp:

You use EasyTherm to generate the .INC files, which you use to recompile the code to match your sensors. You can find more on compiling code in the Assembly Language Tutorial.

Here are some 'pre-built' files (using the above values and resistors):

Note that to use these files, you generally have to rename them to remove the 'rot_' prefix, which is added to prevent mixing them up with the original MegaSquirt® files.

Don't forget to copy the modified files to the MegaTune directory.

Loading the code to MegaSquirt® is covered in the appendices: Embedded Software Upgrade Instructions .

You also need to copy the .INC files to the MegaTune directory.

Kurt Staging

Those of you wanting to do staged injection you have also got an alternative way, using the standard MegaSquirt® hardware and code. 'Kurt staging' (named after the originator, Kurt Heintz) is a method of improving the dynamic range of a set of injectors. It takes advantage of the fact that the injectors timers are independent, and thus they can overlap. This means that one injection event does not have to finish before the next starts.

To implement Kurt staging, you can use a second set of identical injectors that feed each cylinder and hook the injector driver #1 to the first set and INJ driver #2 to the second set. What will happen is at idle the injectors will alternate their pulses but as your VE values increase they will start to overlap pulses and allow full flow from both injectors at the same time. In essence, you progress from alternating to simultaneous as pulse widths increase.

The available time, in seconds, to inject (for a 4 stroke cycle) is:

time = 120/RPM * duty_cycle

Whenever the pulse width is greater than ½ of this, Kurt staging will be in effect.

For example, at 6,000 RPM on a with port injection you have a maximum of 85% of 720° to inject, or 17 milliseconds. If you change this to 2 squirts you have 8.5ms per squirt (ignore inj_on). For example, if you had two 19lb/hr injectors per cylinder and suppose VE=100 when the pulse width was 8.5ms. Up to this point each injector is on separately, i.e. one squirts for 8.5ms, then the other squirts for 8.5 ms. Above this they start overlapping, up to the point that, at VE=200 you have 17ms of injection at 38Lbs. Kurt staging gives twice the dynamic range of a single large injector on standard code.

The main criteria is that the engine must be set up so that it could conceivably run on either bank. For port injection, you must use two injectors per cylinder. For throttle body injection, you don't have any special hardware requirements. All injectors must have the same flow rating. They are then wired up, half to INJ1 bank, and the other half to INJ2 bank.

The injectors are set up to run alternately with the 'injector staging' parameter in MegaTune. For example, on an independent runner 4 cylinder engine you set the MegaSquirt® to 2 squirts/alternating. Each runner will have 1 injector from each bank squirting into it. This will in effect squirt once per cycle into each runner, first from one injector, then from the other on the next cycle. But, these squirts can overlap, so at higher revs, you can have both injectors squirting during the same cycle, injecting more fuel than one injector could.

Kurt staging works with the MegaSquirt® as is, requiring no additional coding. You will need to have all the same size injectors placed as close as you can get them to each other and might need to alternate the injector banks for each injector driver to get a smooth idle (IE. injector driver #1 drives "A" injector for cyl #1, drives B injector for cyl #2, drives A injector for cyl #3 and drives B injector for cyl #4; injector driver #2 would drive the opposite injector as the first injector driver).

So if you have two equal injectors feeding the same cylinder you can use the above mentioned method, if you are running an extra set of different injectors or up stream injector/injectors you will need to use the dual table code, rather than Kurt staging.

Kurt staging is useful for turbos and also for high revving motors, as well as when it is more convenient to get another set of small injectors to get desired fuel flow (i.e., doubled up 19 lb/hr injectors on a high powered 351W might be more cost effective than a set of 40 lb/hr injectors).

Thanks to Roger Enns, Bill Shurvinton, and Mike Robert for the information used in preparing this page.

MegaSquirt® and MicroSquirt® controllers are experimental devices intended for educational purposes.
MegaSquirt® and MicroSquirt® controllers are not for sale or use on pollution controlled vehicles. Check the laws that apply in your locality to determine if using a MegaSquirt® or MicroSquirt® controller is legal for your application.
©2004, 2005 Bruce Bowling and Al Grippo. All rights reserved. MegaSquirt® and MicroSquirt® are registered trademarks. This document is solely for the support of MegaSquirt® boards from Bowling and Grippo.