Table of Contents
Understanding the Megasquirt ECU and Your Datsun 240Z
The Megasquirt ECU is a programmable engine management system that gives you total control over fuel delivery, ignition timing, and many auxiliary functions. For a classic Datsun 240Z, this upgrade replaces the aging stock injection or carburetor system with a modern, fully adjustable platform. Owners report gains in horsepower, throttle response, and drivability, along with the ability to adapt to modifications like camshafts, turbochargers, or ITB setups.
Before diving into installation, it helps to understand the key advantages a Megasquirt system brings to the 240Z:
- Customizable fuel maps – Tune air/fuel ratios at every RPM and load point, eliminating flat spots and improving efficiency.
- Ignition timing control – Adjust timing curves for optimal power and knock prevention, especially with higher compression or forced induction.
- Data logging capabilities – Record sensor and engine data in real time to diagnose issues and refine tuning on the road or dyno.
- Wideband O2 support – Integrate a wideband sensor for closed-loop fueling and automated self-tuning.
- Support for both electronic and mechanical distributors – Megasquirt works with the stock distributor (locked or modified) or direct coil-on-plug setups.
For the Datsun 240Z, the most popular Megasquirt variants are the MS2 (2.0) and MS3 (3.0) modules. The MS3 offers more processing power and advanced features like sequential injection and full-sequential spark, but the MS2 is perfectly capable for a street-oriented build. You can purchase pre-assembled units or DIY kits from official suppliers such as DIYAutoTune and Pierce Manifolds.
Tools and Materials Needed
Having everything ready makes the swap much smoother. Here is a complete list of what you will need:
- Megasquirt ECU – Pre-assembled or kit, with appropriate firmware loaded.
- Wiring harness – Either a pre-made harness for the 240Z or the DIY harness kit.
- Sensors – Throttle position sensor (TPS), manifold absolute pressure (MAP) sensor, intake air temperature sensor, coolant temperature sensor (CTS), and optionally a wideband O2 sensor.
- Relay and fuse setup – Main relay, fuel pump relay, and inline fuses.
- Soldering iron and solder – For making reliable connections on the DB37 connector or harness splices.
- Wire crimping tool and strippers – For attaching terminals and splices.
- Multimeter – For continuity checks, voltage readings, and resistance measurements.
- Basic hand tools – Screwdrivers (Phillips and flathead), combination wrenches (8mm–14mm), socket set, and a trim panel removal tool.
- Electrical tape and heat shrink tubing – To protect connections from moisture and vibration.
- Laptop with Megasquirt tuning software – TunerStudio MS (free or paid version) and a compatible USB-to-serial adapter.
- Soldering iron and solder – For building the ECU if you go the kit route.
Additionally, consider a wideband O2 sensor kit like the Innovate MTX-L or AEM 30-0300 – these are highly recommended for accurate tuning and self-learning features.
Step 1: Preparing the Megasquirt ECU
If you purchased a kit, carefully assemble the ECU following the official Megasquirt manual. Pay close attention to proper soldering technique and component orientation. Use a magnifying lamp to inspect for cold joints or bridges. Test continuity between the DB37 pins and the board traces after soldering.
For pre-assembled units, verify that the firmware is current and that the board jumpers match your 240Z configuration. Common settings include:
- Injector wiring: standard high-impedance or low-impedance with PWM current limiting.
- Ignition input: Hall-effect sensor from a magnetic pickup distributor, or VR input for a 36-1 wheel.
- Tach output: configure to drive the stock tachometer if desired.
Once the ECU is built, bench-test it by applying 12V power and connecting a simulated sensor (or a variable resistor) to the analog inputs. Confirm that TunerStudio reads the values correctly.
Step 2: Removing the Stock ECU and Preparation
In the Datsun 240Z, the stock ECU is located under the passenger side footwell, bolted to the firewall.
- Disconnect the battery (negative terminal) – this is critical for safety.
- Remove the trim panel and carpet covering the ECU area.
- Label each wire on the stock harness with masking tape – you will reuse many of them. Especially note the power, ground, injector, and distributor signal wires.
- Unbolt the ECU and disconnect the harness. Some 240Zs use a 40-pin connector; others have individual bullet connectors.
- Remove the entire stock ECU from the vehicle – you can retain it as a spare or sell it.
While the interior is open, take the opportunity to inspect the condition of the harness. Replace any brittle or cracked insulation, and add a fresh ground terminal to the chassis near the ECU location.
Step 3: Wiring the Megasquirt ECU
This is the most time-consuming part. Refer to the Megasquirt wiring diagram for your specific model (MS2/MS3) and the 240Z year (1970–1973 have subtle differences). The general approach is to create a “pigtail” harness that connects the Megasquirt DB37 connector to the car’s existing wires.
- Power and grounds: Run 10-gauge wire from the battery positive via a 30A fuse to the main relay. From the relay, feed 12V to Megasquirt pin 28 (fuel pump pin also gets power). Ground the ECU directly to the engine block or a dedicated chassis point – do not rely on the battery negative alone.
- Fuel injectors: The 240Z uses either low-impedance with a ballast resistor (early models) or high-impedance injectors (later or swapped). Megasquirt can drive both, but you may need to adjust the PWM settings. Wire each injector to its respective pin (pins 32–35 on MS2, for semi-sequential).
- Ignition coil: For a distributor-based setup, connect the ignition output from the ECU (pin 36) to the negative side of the coil, and ensure the positive side has 12V with the key on. Remove the stock ignitor if present.
- Sensor inputs: Wire the TPS, MAP sensor (or use the internal MAP sensor via a vacuum line to the intake manifold), CTS, and IAT to their respective pins. Shielded wire is recommended for the TPS and MAP signals to reduce noise.
After all connections are made, use the multimeter to check for shorts between power and ground, and verify that the identity of each wire matches the diagram. Apply heat shrink over every solder joint.
Step 4: Installing the Sensors
You may need additional sensors beyond what the stock 240Z has. Here is how to install the key ones:
- Throttle Position Sensor (TPS): If your 240Z still uses a carburetor, you’ll need to install an aftermarket TPS on the throttle shaft of an upgraded EFI throttle body. For existing injection, replace the worn sensor with a new potentiometric TPS. Adjust it so that the voltage reads 0.3V at closed throttle and 4.7V at wide open.
- Manifold Absolute Pressure (MAP) sensor: Megasquirt comes with an internal MAP sensor (standard range of 250 kPa or 400 kPa for forced induction). Connect a vacuum line from a port on the intake manifold to the ECU. Avoid using a port that sees boost only – it must see manifold pressure under vacuum as well.
- Coolant Temperature Sensor (CTS): Remove the stock temperature sender and install a compatible sensor (GM-style is common) in the same port. Ensure the threads match – you may need an adapter. Wire it to pin 21 (MS2) with the signal wire shielded.
- Intake Air Temperature (IAT) sensor: Mount in the intake piping between the air filter and the throttle body. Use a threaded bung. The sensor must be in the airflow stream but not directly in liquid.
For a wideband O2 sensor, weld an appropriate bung into the exhaust downpipe (before any catalytic converter). Run the signal wire to the ECU analog input, and ensure the controller is powered and grounded correctly.
Step 5: Configuring the ECU with Software
With all wiring verified and battery reconnected, it is time to configure the Megasquirt. Connect your laptop via USB (or serial). Open TunerStudio MS – it automatically detects the ECU.
Run the Startup Wizard and enter your engine specifications:
- Number of cylinders (6), firing order (1-5-3-6-2-4).
- Displacement (2.4L or whatever your engine is).
- Injector flow rate (cc/min) and number of injectors (stock is 6, or use 2 high-impedance for batch fire).
- Required fuel – calculate based on injector size and displacement.
- Ignition input capture – typically “Rising Edge” for a Hall sensor.
- Spark output – “Going High” (inverted) or standard depending on your coil setup.
Calibrate all sensors: go to the “Tools” menu, select “Calibrate Thermistors” for coolant and air temp, and set the TPS min/max values. Also set the MAP sensor calibration (standard 250 kPa uses 0-5V scaling).
For initial tuning, use the Auto Tune feature with the wideband O2. This will adjust the fuel map while the engine runs at idle and moderate loads. A safe starting fuel target is 14.7:1 at idle and 13.0-13.5:1 under moderate load.
Step 6: Starting the Engine and Initial Testing
Before cranking, do a final check: ensure the fuel pump primes (you should hear it for 2 seconds when you turn the key to “ON”). If not, check the fuel pump relay wiring. Prime the fuel system by cycling the key a few times.
Crank the engine. If it does not start:
- Check for spark – use a timing light or pull a plug and ground it.
- Verify injector pulse – use an LED noid light on an injector plug.
- Check the tach signal – TunerStudio should show RPM while cranking. If it shows zero, the ignition input circuit or wiring is wrong.
Once it fires, let it idle at 900-1100 RPM. Adjust the idle speed screw on the throttle body (if EFI) or the base idle screw on a carb conversion. Monitor the AFR gauge – it should settle into the 14-15 range. If it is very lean (18+) or rich (10-), adjust the “Master Fuel” value by about 10% increments.
Perform a heat cycle: run the engine to operating temperature, then let it cool completely. Repeat twice. This seats the rings and verifies no coolant or oil leaks appear from sensor installations.
Step 7: Fine-Tuning Performance on the Road or Dyno
Now that the engine runs reliably, it is time to dial in the fuel and ignition maps for maximum power. Use the VE Analyzer tool in TunerStudio after logging a street drive session. Target a smooth AFR curve – 14.7 at cruise, 12.5–13.0 under heavy load (for naturally aspirated). For ignition timing, start conservative – typical advance at idle is 10–15°. Increase to about 30–34° at full load by 3000 RPM for stock compression.
Listen for knock; if you hear pinging, reduce timing 2–3°.
Consider a professional dyno tune for the final adjustment – many shops are familiar with Megasquirt and the Datsun L-series engine. They can optimize power safely and provide a base map you can refine.
Troubleshooting Common Issues
Even with careful installation, problems can arise. Here are typical hurdles and solutions:
- No RPM signal: Check the distributor pickup – on a 240Z with points, you must replace with a Hall or VR sensor. Verify the wiring and that the sensor gap is correct (0.020–0.030″).
- Engine stalls immediately after start: The fuel map is too lean in the startup cells. Enrich the afterstart enrichment values by 10-20%.
- Idle hunting or surging: Vacuum leak, or the idle control valve (if using stepper motor) is not configured. Use a temporary manual idle screw until the maps are dialed in.
- Overheating: Verify that the cooling fan comes on – the Megasquirt can control it via a programmable output with a temp threshold.
Final Thoughts
Installing a Megasquirt ECU on your Datsun 240Z is a rewarding project that unlocks the full potential of the L-series engine. The learning curve is steep, but with patience, a methodical approach, and resources like the MSExtra forums and DIYAutoTune support, you can achieve a reliable, high-performance daily driver or track toy. Modern tuning tools allow you to refine the driving experience over time, and the ability to adapt to future modifications makes Megasquirt a long-term investment in your Z’s performance.