Miata Turbo Forum - Boost cars, acquire cats.

Miata Turbo Forum - Boost cars, acquire cats. (https://www.miataturbo.net/)
-   ECUs and Tuning (https://www.miataturbo.net/ecus-tuning-54/)
-   -   Arduino as ECU? (https://www.miataturbo.net/ecus-tuning-54/arduino-ecu-50695/)

Leafy 09-10-2014 03:18 PM

Um, the standard speed density fuel calculation formula with dead time compensation added in?

klax187bz 09-10-2014 03:27 PM

I need the formula for calculating the time when the injector is on. Also the time injection when the injector is off.
On this topic at the 5th page, https://www.miataturbo.net/ecus-tuni...u-50695/page5/, Bloodline specified about an InjTime that calculates Injector Open Time.
Do you have any idea regarding the mathematical formula?

klax187bz 09-10-2014 03:30 PM

To be more specific, a formula using the Lambda sensor, the depression sensor, an acceleration would be perfect

Leafy 09-10-2014 04:11 PM

2 Attachment(s)
Fuck.

Kurak 10-22-2014 07:48 PM

Aye comrades, I are Kurak and I appear to have some arduino code that should run an engine.

Well, it did run lawnmower engine! Flooded it like hell, since it was a 250cc injector and 25cc engine, but worked almost well.
The code also sparks, multisparks. I havent tested that in a real world outside my lab walls, but there it was sparking be-a-utifylly.

Code works on an Arduino UNO (yeah, cheap atmegas ftw) and injects just the right amount of fuel to get into a specific AFR (with closed loop control, ofc, if you have a wideband) with around 16us resolution.
Its up to you how you'd define target afr (i think rpm/toa is most reasonable).

What Im not seeing in this thread is hardware design. Anyone working on that?
What about the PC side software, how'd you want to define the maps?

Kurak 10-22-2014 07:49 PM

Oh, and having an "Arduino" as an ECU is an absolutely terrible idea. We definitely should do that.

Leafy 10-23-2014 07:15 AM

Somewhere, I cant find it anymore, there is a presentation given at a linux convention where someone has a more advanced arduino ecu. The gist I got from it was really that the I/O capability of the normal arduino is just not there to do this properly, and the processor and mega marginal to run a 4 cylinder for fuel and spark even on the 2560. Something tells me the Due or Galileo would both be significantly better, but still pretty huge compromises.

Reverant 10-23-2014 08:07 AM

Yeap, the ATMEGAx series are just not up for the job.

Joe Perez 10-23-2014 08:32 AM


Originally Posted by Reverant (Post 1177851)
Yeap, the ATMEGAx series are just not up for the job.

You're just not trying hard enough. I'm working on a new product called the HyperSquirt Holy Grail ECU, which uses no microprocessor at all. I can't share any details yet (top secret) but it's going to be awesome.

Kurak 10-23-2014 08:45 AM

Well, the Atema 328 series is powerful enough. Calculation of injection time (without any optimisation) takes 580us, on Arduino libs, in proper C that would be faster. Thats fast enough.
You need 6 digital output pins for injectors and wasted spark. You've got that. 2 interrupts. Got that. Some analogs - use an eternal SPI ADC and sample it from time to time, not on every engine revolution. There is a large number of pins left.

Fan control? EGR valve? Other "slow" outputs? Shift register. Cheap and easy.

Write code as you should and this little microcontroller will do the job just fine.

About the hypersquirt... you can do that w/out an uC... but hell, why?

Arduino DUE and clones are based on ARM processors. These aren't that suitable for automotive thingies - you're better off using AVRs - they'll tolerate more and are in general more reliable.

Also, running on 5V will be cooler since it has more oomph to power the transistors (lower costs transistors).

Kurak 10-23-2014 09:04 AM

Heres a fun thing: list of terminals in OEM ECU.
  1. +12V bat
  2. Main relay (input, ign switch)
  3. Ignition switch (start)
  4. Self diagnosis
  5. CEL
  6. Self diagnosis 2
  7. Igniter
  8. Igniter
  9. A/C relay
  10. Diagnosis conn
  11. Throttle sensor (WOT, closed)
  12. Stoplight switch
  13. P/S pressure switch
  14. A/C switch
  15. Fan switch
  16. Blower control switch
  17. Headlight switch
  18. Clutch switch
  19. CAS (Ne)
  20. CAS (G)
  21. Igniter
  22. AFM
  23. o2 sensor
  24. AFM temperature
  25. Water temp
  26. Injector 1,3
  27. Injector 2,4
  28. ISC valve
  29. Solenoid valve


Out of those you need... well, fast:
  1. Injectors (1,2,3,4)
  2. Ignition 1,2 (wasted spark)
  3. o2 sensor
  4. AFM (well, MAP)
  5. Throttle sensor (TOA)
  6. CAS & CAS

Slow:
  1. +12
  2. GND
  3. Water temp
  4. AFM temp

(Alternator load info:)
  1. Fan switch
  2. Blower switch
  3. Headlight switch

And lets ditch A/C for now.

Stop, clutch, cranking are redundant, this info comes from RPM/TOA. ISC and purge valves? No idea what those are, lets ditch.
So this gives us 8 pins on the uC, including 2 interrupts, and 3 direct analogs. The rest is an 8bit DAC controller (8 load inputs) with, lets have some 8 bit (328p is 8 bit) DAC for a number of analog inputs (lets add EGT, for instance). Lets have as many as we want: spi connection takes only 3 pins.

Now the 328p does cope with that quite nicely, doesn't it? With room for extensions.
It might not be fast enough to do dataloggig, but these atmegas are dirt cheap so why don't throw in another one, that would do that?

Leafy 10-23-2014 09:14 AM

You're missing the IAC, that needs to run at ~32Hz with the driving frequency variable to tune out the noise of it.

Also for slow you're missing fuel pump.

Kurak 10-23-2014 09:17 AM

I am fairly convinced that the F/P might be ommited and is ommited in the oem NA ECU, but could be nice to have it to build fuel pressure before cranking, to get nicer start, as normally the pump starts when cranking and the first revs go quite dry (unlike in cyvilised cars, where the FP is turned on for some time after you put the key into drive).

What do we need IAC for?

Leafy 10-23-2014 09:22 AM

Stock ecu does control the fuel pump. I guess you could rewire it to just always run in the on position, but if you dies when a fire starts after you crash because the fuel pump kept cranking away after the engine shutoff, dont cry to me.

You need an iac so you dont have to constantly re-do idle adjustment as the weather changes.

Kurak 10-23-2014 09:29 AM

Nope - if the engine dies, the AFM flap goes down and activates circuit breaking relay (yellow thingy on drivers side, near steering column) which cuts the fuel pump.

Leafy 10-23-2014 09:30 AM

on the 1.6 maybe. The more civilized miatas dont do that and only a moran would keep the afm when going stand alone.

Kurak 10-23-2014 09:31 AM

Especially with ITBs which is my scenario. 1:0 for you, Leafy.

flyingchameleon 01-20-2015 02:44 AM

Hi, im Jon

saw the post because the ecu on my 90 mx-5 died recently and read through the thread

first I must say thank you to everyone who contributed

my question is has anyone put this work onto a miata yet? if not I volunteer mine. wonderful little tidbit about where I live is there are no restrictions about whats on the road. (blessing and a curse)

I have an arduino uno that has the same specs as bloodline was aiming for as well as a sheild and extra micro controller if we need more umph, along with limited electronics knowledge but plenty of soldering and nuts and bolts experience. I can code, but im probably more dangerous than helpful with my background in aerospace using fortran and matlab. Its been a few years since C++ but reading over the code was exciting and refreshing.

Ideally I want to turbo it down the line, but right now I wanted to just get it running so i could get back to working on it.

finished my degree and although i should be looking for a job, I feel a project like this would help land me one.

so, how can I help?

Schuyler 01-20-2015 04:24 AM


Originally Posted by flyingchameleon (Post 1198286)
Hi, im Jon

saw the post because the ecu on my 90 mx-5 died recently and read through the thread

first I must say thank you to everyone who contributed

my question is has anyone put this work onto a miata yet? if not I volunteer mine. wonderful little tidbit about where I live is there are no restrictions about whats on the road. (blessing and a curse)

I have an arduino uno that has the same specs as bloodline was aiming for as well as a sheild and extra micro controller if we need more umph, along with limited electronics knowledge but plenty of soldering and nuts and bolts experience. I can code, but im probably more dangerous than helpful with my background in aerospace using fortran and matlab. Its been a few years since C++ but reading over the code was exciting and refreshing.

Ideally I want to turbo it down the line, but right now I wanted to just get it running so i could get back to working on it.

finished my degree and although i should be looking for a job, I feel a project like this would help land me one.

so, how can I help?

You just got a degree in aerospace which gave you experience with Fortran? Did whatever school you were studying at also have a cryogenics lab you frequented?

*A bunch of mean text about how awful of an idea this is used to reside here. I decided better of it once I wrote the concluding sentence. *

This is not the kind of project that would land you a job. The ATMega chip is not powerful enough to handle this beyond a proof-of-concept standpoint, and the end product would likely do more to deter admiration towards your professional career than it would to dazzle prospective employers.

flyingchameleon 01-20-2015 06:23 AM

I was attempting to contribute to the thread and not be a flamer and show the world what little value that is. yea, you are right, it might not land me a job from one project. I have other things under my belt. Yes i do believe it would help, it wont be the final say, but it may be the difference by saying i can do more than the average book worm.

but im guessing you are 30+ years older than me in a dead end career and not very aware or even care of the current economic situations or job markets and probably dont care. The one generation that could have helped but was too busy smoking weed. also i could give 2 nickels in your shitter to what my peers think because most aerospace graduates have their heads so far up their but its a wonder planes dont crash more often and why people hate on the few who actually tried really hard in school.

there are employers out there who want people with skills, and if you can show them something they dont see everyday they will hire you

seriously if you are a "senior member" and all you like to do is greet people with a piss poor attitude just because its the internet and your "anonymous" than get a better day job, like yelling at hobos or Mexicans or something. who knows you might be both

and... probably permaban... but either way, it just reminds me how much i hate politics and forums. just a bunch of epenor measuring.

also thanks for being a grammar nazi. shows you care less for what is trying to be said than what you can measure yourself against... keep measuring, it only gets smaller


All times are GMT -4. The time now is 01:49 AM.


© 2024 MH Sub I, LLC dba Internet Brands