Speeduino is now on Github Sponsors (Rather than Patreon): https://github.com/sponsors/noisymime
Help with building your Speeduino, installing it, getting it to run etc.
By HugoW
This topic I start to document everything, or at least most of, what I did, am doing and will do to get my engine running, car driving and later turbo charged. I am only a hobbyist with some tinkering experience, no electronics experience and no EFI knowledge... Here we go.

I started this project in May 2018, buying a 1998 MX5 NB with an old worn out 1.6 engine. The car sat at a second hand car dealer specialising in recent small convertibles and this car stood out as an eye-soar between newer MX5s, MR2s and BMW Z3s and such. I got a great deal on the car. I also bought a 1.8 VVT engine from a 2004 NB a few months later. Then we moved house (which was planned), life changed in many ways and I drove the car but didn’t get ‘round to tinkering on it. I gathered some parts like an exhaust manyfold for the turbo, the GT2554S turbo itself and I started work on a DIY stainless 3” down-pipe. The new house did came with a large (for my standards) garage, but only in august 2020 I finally swapped the engine. The harness was a nightmare but mid-October I got the engine to start and made some attempts to drive. I am only now, end December 2020 and early January 2021, getting to the point of tuning the car and starting to understand what that means. But before I get deeper into that, let me tell you what I did to get it running on Speeduino. I bought a 0.4.4 board all soldered together, 'ready to go'. I won’t tell you all failed attempts, but I will tell you what works for me. No guarantees it will work for you…

First off, before the engine swap, I found the ECU of this engine requires a TE Connectivity connector, their part number 353830-5, here’s a link:
This is not available everywhere but if you search you can find them. Next I made a PCB connecting all connector pins to the Speeduino:

I am actually on version 3 of that PCB, now, which is fully functional. It does not include the extra features to drive a wideband controller, so I wired that up separately. Besides that, the original wiring does not include a boost control solenoid and the original Mazda ECU controls the field of the alternator, so its output voltage. All issues to be solved.

The alternator issue is the easiest. Just buy a controller, I bought this one:
I wired it in between the ECU connector and the big blue connector that connects the engine loom to the car loom (under the dash, close to the centre console, on the driver’s side). It’s pretty straight forward. The controller comes with 5 connections:
1) 12V. I spliced a white/red switched power wire to connect this.
2) Ground. I spliced the black-blue ground wire to connect this.
3) Field. This is the grey-red wire going to pin 3M of the ECU connector. I disconnected it from the connector and connected it to the controller.
4) Disable. You could wire this in with the crank signal from the ignition switch, but I left it open.
5) LowBatt. This will light the dash light when the battery is not charging. It connects to the brown/red wire of pin 3U of the connector. I disconnected that from the connector and connected it to the controller.
And done. The thing works, I adjusted it to about 14V and all is well.

The boost solenoid is not an issue that really needs solving now, but I did so anyway as I will need it in the future. When you implement the Speeduino, you don’t need the MAF sensor anymore. So you don’t need it’s wiring anymore, either. This connector houses three wires, black/blue for ground, whte/red a switched power and a pink wire. This pink wire I will use to send PWM signals to the boost solenoid. It reaches the connector on pin 4X. The PCB I made connects it to Speeduino pin 35, the boost control pin. I’ve not done anything more, here, yet, but it is prepared.

Wiring in the wide band O2 sensor controller and signal is done also by using existing wiring, like the boost control. The engine comes with EGR (exhaust gas recirculation) which I don’t use with Speeduino, as it doesn’t have a feature to control it. The EGR connector on the engine comes with 6 wires and the normal O2 sensor connector also comes with 3 wires. I used some of these wires to wire in the system I bought, a 14point7 Spartan2:
https://www.14point7.com/products/spar ... ntroller-2
This has 6 wires to connect. Here’s how I wired it up:
1) Green, the linear output. I used the blue shielded wire of the O2 connector to connect the signal from the controller to the ECU connector. This goes to connector pin 4W of the connector. The PCB connects that to the O2 pin of the Speeduino, pin 21.
2) Black, electronics ground. This I wired using the white/green wire of the EGR connector to pin 2F of the connector. The PCB is not prepared for anything more so I soldered a wire from pin 2F to ground on top of the PCB.
3) White, heater ground. This I wired with a new wire to the bolt holding in the cam sensor on the valve cover.
4) Brown, the simulated narrowband output. I didn’t connect this, I don’t use it.
5) Blue or orange, a wire to drive an LED. I used the pink wire of the EGR connector to get that signal from the controller to pin 2I of the connector. The PCB is not prepared for anything so I soldered a wire from pin 2I to the LED, and a ground wire from the LED to a ground point on the PCB.
6) Red, the power wire. This is a bit of a strange one. Some people just use the switched ground (white/red), for instance of the EGR connector. Some switch it with the fuel pump solenoid. I chose to wire it in more complicated, but more controlled. I mounted a solenoid next to the controller, receiving power from the white/red wires. One wire to the input of the solenoid, one to the coil. The output of the solenoid goes to the controller, the red wire. But now we need to ground the other side of the coil. For this I used the pink/black wire from the EGR connector to pin 2H of the connector. The PCB is not prepared for anything so I soldered a wire from 2H to Speeduino pin 36, which is normally used for a second idle control. The engine only has a two wire ICV (power and signal), so Speeduino pin 36 is not used. But Speeduino pin 36 is powered by Arduino Mega pin 6. And the Speeduino firmware keeps it dormant if not used, but does not allow us to use it for anything else. So I soldered a wire from Arduino Mega pin 23 to Arduino pin 6, as I can use Arduino pin 23 is not used by the firmware. This now allows me to define an additional output in TunerStudio, to control the wideband O2 controller. Here is what I have:
The rule is pretty simple; when the RPM goes over 500, a counter starts. When it reaches 20 seconds, it turns on the WB controller. Actually, it activates Arduino Mega pin 23, which is wired to Arduino Mega pin 6, which drives the MOSFET that could be used to PWM-ground a second signal wire on a 3-wire ICV, but in this case it grounds the solenoid which then powers the 14point7 Spartan2 controller. Done. Easy… I might add some pics, later.

With all the wiring done, I 3D printed a mount for the PCBs and one for the connector. I bought an aluminium housing on e-bay and mounted it all. This is a pic with the previous PCB version, which didn’t house the diodes properly, yet:
In this picture you can also see the addition MOSFET I used before someone recommended me to use the MOSFET for Idle2.

Next I installed firmware 202012 via Speedyloader and set up a project in TunerStudio with that same firmware, all like the Speeduino manual says. I downloaded a base tune called “NB8B PNP base tune” and loaded it in TunerStudio. Next I went through a lot of screens, adjusting settings and setting sensors, values, etc. The car now runs and drives, but with a lot of issues. The most important ones now:
- I have a weird spark table, which I believe came with the base tune, but it needs to be changed. I was recommended this site:
http://www.useasydocs.com/theory/spkta ... mCWZgx0twE
To generate a new one, and I will go from there… I also collected some reference tunes, but there is a lot of difference between references I found and some are plain wrong, but still work reasonably for their creator / user.
- The VVT control I have turned off at the moment. I need to tune it’s PID controls, but it is a nightmare. Reference tunes I was given / I found don’t make sense and don’t work.
- The car starts really bad, especially when cold. I am looking into the settings with help from the Facebook group.
- The closed loop idle is hunting like mad, so I set it to open loop for now. But I need to change this, as Idle is very high now. When I turn on the headlights, the interior heater fan and the coolant fan kicks in, the idle it just about 850 rpm. But without those users, idle is too high now.
- The car hesitates / leans out big time when I touch the throttle. It immdeiately corrects, it is as if the ECU is slow in responding. It is only in the first tenth of a second when starting to accellerate. Driveable but annoying.

So, that is where I am now. I will add some pictures soon as I was already asked for that on the facebook group. Tomorrow I hope to load a new spark table and re-start VE tuning.

Last edited by HugoW on Sun Jan 10, 2021 2:14 pm, edited 6 times in total.
Hi ktop, thanks for the reply. I can see the pics, maybe others can chime in whether they do or don't. I cannot find an issue easily.

Last weekend and this weekend were really good, car-wise. I feel now comforable sharing my tune with others:
https://drive.google.com/file/d/1S5eFrE ... sp=sharing
Please don't copy this to your car as I have different injectors, messed with those settings and my bias resistors are weird (long story). What I did the past months was searching for posted tunes of the MX5 NBFL 1.8 VVT engine, and make different projects in Tuner Studio per tune, projects named after the people posting them. Whenever I start messing with settings, like with the closed loop idle which I did today, I take a look at the settings these people posted. For reference, but also to understand them better. I also search youtube for understanding of the settings. Combined, I start tinkering with mine.

So, today I felt was the day to get closed loop idle going. Up until now, I had my Idle control in Open Loop mode. This was OK during warm up as I just set the PWM to keep the revs at 1200 - 1300 rpm. Turning on the lights / window heating / interior heating fan would lower that RPM, but not enough to get into trouble. However, when warm, I wanted idle to be 850 rpm. This is easily done with the PWM setting, but adding all those electricity users would lower the RPM too far and make the engine stumble. So, up to closed loop. I found multiple nearly identical PID and other settings in my library of other people's tunes, so I made a nice average to start off with. This resulted in a hunting idle. The controls obviously were too late with correcting, dropping revs to below 500 sometimes, even stalling the engine. If not stalling,the revs would be punched up to 1200-1300, way to high (all with warm engine). So, PID needed to be less agressive in correcting, but should start correcting earlier. I messed with the settings but I couldn't get it stable. This is partly because I have little knowledge of PID tuning, but also I still have a lean spike when engaging the throttle. The IAC is basically doing just that, slightly opening the throttle when the RPM is too low, causing the spike. Now since I don't have a solution for the lean spike, yet, I was thinking about a work-a-round. And one that doesn't just work when you have a lean spike, but works in general. I started tinkering on (1970s) Mini's and BMWs when I was young, on carburetors. So, I resorted to what I know, mechanical settings.

First I switched off idle control completely. This was a huge mistake, I did so while the engine was idling and it instantly revved up to the limiter (which is pretty low in my case, 6k rpm) so I turned off the ignition. It seems turning off the idle control activates the Idle pin and opens the valve 100%, which is a bad thing. I reported it on the Facebook group, as I think this is a firmware issue. So I turned on the Open Loop controls and started to lower the values, while raising the idle mechanically by adjusting the screw on the throttle body that controls how far the throttle valve can close. Raising RPM to 950 with the screw, lowering it to 850 by lowering the PWM values. It turnes out, lowering PWM under 15 does not have any influence anymore. Between 15 and 0, the rpm didn't change. I already knew from my previous open loop tuning, the max PWM value is about 15 heigher then the minimum, needed for a raised idle when really cold. So my IAC PWM duty table now looks like this:
All values were 14 points higher when I started this morning, that has been compensated by setting the idle higher mechanically.

Next I turned the controls to closed loop and I put in the minimum PWM valve duty value of 15 and a max of 30, based on the open loop settings. I also made a nice curve on the IDLE RPM Targets:
These settings combined work very well when the engine is warm. I just brought my daughter to a friend to play, switching on and off the lights, rear window heating, interior fan, etc, while at idle waiting at crossings. Now it's freezing cold here, literaly, -4 C, so tomorrow morning when really cold I can see what these setting do when cold. But, so far so good.

Last edited by HugoW on Sat Jan 09, 2021 2:23 pm, edited 1 time in total.
I have done two other things I'd like to share.

Since I changed the original 265cc (?) injectors to 450 cc RX8 injectors, I changed that number in TunerStudio. It uses that number to calculate required opening time to get the right amount of fuel. With that set correctly, I got the ystem up and running. However, these injector settings gave me rather low VE table value. This means lowering or raising those values goes in relatively big steps (you cannot do half steps). Exaggerated; if you idle at VE table value '10', raising or lowering '1' is a change of 10%. Now I believe the maximum VE value you can enter is 254. Since my tune at full power is still way below half that number, I decided to get closer to half that number to give more precision tuning. The other half I leave available for when the turbo comes, later. So what I did was I fooled the injector setting by telling TunerStudio I have 675 cc injectors (1,5 times the actual value). To compensate, I also multiplied the VE table as a whole by 1,5. That evens everything out. It means my idle in the VE table is now at 42. Raising or lowering it by 1 means a change of less then 2,5%. This is something you can play around with, I haven't found any downsides to it, yet, as all other values such as enrichments for cold temps or accelleration are a multiplication of the VE table number.

Besides that, I had really weird readings on the temperature gauges in TunerStudio when I started. I had measured the coolant temp sensor of the car, which matched the RX7 sensor settings in TunerStudio, and the air intake sensor I bought a BWM version for, which matches the BMW325i sensor settings in TunerStudio. The Speeduino manual tells me the bias resistors R1 and R3 are both 2490 ohm, which is also the default in TunerStudio. But still, weird readings. After a lot of searching, I found my Speeduino board came with 24k9 resistors, 10 times the value of what is should be. I first corrected the bias resistor value in TunerStudio, but this meant the range of the sensor was very, very small for the Speeduino to read. With the engine at temperatures between 80 and 100 degrees C, the sensor resistance is between 300 and 200 ohm. With the bias resistor 24k9, that means the 5V is split 0,050 volts over the sensor (at 250 ohm) and the rest over the bias resistor. I don't think that will measure accurate on the Arduino. At -10 degrees C (if any colder I stay in bed anyway), resistance of the sensor is 16k2, so voltage would be split 2V over the sensor and 3 over the bias resistor. Therefore, I replaced the bias resistors on the board with 1k ones. This means at operating temps, sensor around 250 ohms resistance, the voltage over the the sensor is 1V. At -10C the voltage over the sensor will be 4,7V. That is a nice spread for the Arduino to read. And at a minimum of 1k resistance (if the motor is melting down and the sensor is at zero ohms) there is still only 5mA current running through the system.

Last but not least, I made a little video of what is under the bonnet of my car currently, which is not very spectacular but might add some insight to the written parts:

Next on the list is curing my lean-spike upon touching the throttle. This is an ongoing item with only a bit of progress, yet.

Hi Hugo
I didn't read all of your posts cos there is a lot of it, and I dont have an mx5. :)
However, it is good of you to write all this to help others.
So I don't know completely if you solved your idle issue when adding extra load to the engine.
i was just going to suggest that at idle, when extra load is added, the idle can run a little weak due to the voltage drop at the injectors. A solution can be to add to the voltage correction slope below idle.

I notice you have a timing trough in the advance table. Reduce the advance at idle (compensate with idle screw) and add advance to the left most column. This adds extra torque as the rpm drops, and also help to reduce the idle dropping under additional load.

Thanks for chiming in. Just out of curiosity, do you run LPG injection on Speeduino?

With the trough, do you mean this part?
If I reduce retarding from 19 degrees at idle to say 15, it will make the trough deeper. I will try it today but it seems strange as, the way I read it, you notice a trough and don't see it as a good thing. Please feel free to explain, I'll try it and post the results later today.


Hugo, don't know why, but I can't see your images.

Yes, I do run lpg, though not at the moment, but it will be back soon. :)

This link, with explanations from David (psig) may help to clarify a timing trough. The whole topic can be useful.

Don't for get the voltage correction for the injectors as that is part of the fix for a good idle under differing loads. :)
Thanks, I'll go read through that topic. I was told by a friend he could see the pics.

Idle is fairly good, now, so is cold start and warm start. I now would like to address the off-closed throttle lean spike. I can share my current tune:
https://drive.google.com/file/d/1V7JH5W ... sp=sharing
And a small log in which I deliberately caused the spikes, in second gear:
https://drive.google.com/file/d/1EPUZbe ... sp=sharing

All input is appreciated.

Can't see the pictures either.
Are your files stored in a cloud somewhere ?

IAC, are you sure you didn't wire or put it in backwards in some way.
Because if it loses power or isn't controlled it should shut down and no causing your engine to run at 6K, je wilt geen Marco Bakkertje !!

Injectors, like mentioned bij others get the voltage correction and deadtime spot on.
Because every time the voltage drops or raises it effects the delay (deadtime) of injector.
Using big injectors gives very small opening times close to deadtime at idle.
So tuning idle and alternator puts out 13Vdc everything seem to run well.
Now putting headlights on, voltage drops and engine starts running crap.
That is the effect of not sufficient voltage correction, you shouldn't use the the IAC to compensate on this.

Then there is an other thing on injectors and deadtime.
The closer you get to deadtime it might not respond lineair any more.

Where do you live the Netherlands ?
I'am somewhere in the middle.....

As you even picked a very well tuned motor bike en[…]

VW 2H setup questions

Hi, parts for these cars are available from VAG or[…]

Back feeding usb

Might be worth adding something to the wiki. It's […]

Knock Sensor working on Speeduino

When I dealt with Bosch about 10 years ago I was[…]

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