Arduino as ECU? - Page 14 - Miata Turbo Forum - Boost cars, acquire cats.

Welcome to Miataturbo.net   Members
 


ECUs and Tuning Discuss Engine Management, Tuning, & Programming

Reply
 
 
 
LinkBack Thread Tools Search this Thread
Old 09-10-2014, 04:18 PM   #261
Elite Member
iTrader: (1)
 
Leafy's Avatar
 
Join Date: Jun 2012
Location: NH
Posts: 9,092
Total Cats: 90
Default

Um, the standard speed density fuel calculation formula with dead time compensation added in?
Leafy is offline   Reply With Quote
Old 09-10-2014, 04:27 PM   #262
Newb
 
Join Date: Sep 2014
Posts: 3
Total Cats: 0
Default

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 is offline   Reply With Quote
Old 09-10-2014, 04:30 PM   #263
Newb
 
Join Date: Sep 2014
Posts: 3
Total Cats: 0
Default

To be more specific, a formula using the Lambda sensor, the depression sensor, an acceleration would be perfect
klax187bz is offline   Reply With Quote
Old 09-10-2014, 05:11 PM   #264
Elite Member
iTrader: (1)
 
Leafy's Avatar
 
Join Date: Jun 2012
Location: NH
Posts: 9,092
Total Cats: 90
Default

****.
Attached Files
File Type: zip HowSpeedDensityWorks16.zip (109.6 KB, 87 views)
Leafy is offline   Reply With Quote
Old 10-22-2014, 08:48 PM   #265
Newb
 
Join Date: Oct 2014
Posts: 9
Total Cats: 0
Default

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 is offline   Reply With Quote
Old 10-22-2014, 08:49 PM   #266
Newb
 
Join Date: Oct 2014
Posts: 9
Total Cats: 0
Default

Oh, and having an "Arduino" as an ECU is an absolutely terrible idea. We definitely should do that.
Kurak is offline   Reply With Quote
Old 10-23-2014, 08:15 AM   #267
Elite Member
iTrader: (1)
 
Leafy's Avatar
 
Join Date: Jun 2012
Location: NH
Posts: 9,092
Total Cats: 90
Default

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.
Leafy is offline   Reply With Quote
Old 10-23-2014, 09:07 AM   #268
Supporting Vendor
iTrader: (10)
 
Reverant's Avatar
 
Join Date: Jun 2006
Location: Athens, Greece
Posts: 5,440
Total Cats: 198
Default

Yeap, the ATMEGAx series are just not up for the job.
Reverant is offline   Reply With Quote
Old 10-23-2014, 09:32 AM   #269
Boost Pope
iTrader: (8)
 
Joe Perez's Avatar
 
Join Date: Sep 2005
Location: Chicago (Over two miles from Wrigley Field. Fuck the Cubs. Fuck them in their smarmy goat-hole.)
Posts: 26,318
Total Cats: 1,916
Default

Quote:
Originally Posted by Reverant View Post
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.
Joe Perez is offline   Reply With Quote
Old 10-23-2014, 09:45 AM   #270
Newb
 
Join Date: Oct 2014
Posts: 9
Total Cats: 0
Default

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 is offline   Reply With Quote
Old 10-23-2014, 10:04 AM   #271
Newb
 
Join Date: Oct 2014
Posts: 9
Total Cats: 0
Default

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?
Kurak is offline   Reply With Quote
Old 10-23-2014, 10:14 AM   #272
Elite Member
iTrader: (1)
 
Leafy's Avatar
 
Join Date: Jun 2012
Location: NH
Posts: 9,092
Total Cats: 90
Default

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.
Leafy is offline   Reply With Quote
Old 10-23-2014, 10:17 AM   #273
Newb
 
Join Date: Oct 2014
Posts: 9
Total Cats: 0
Default

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?
Kurak is offline   Reply With Quote
Old 10-23-2014, 10:22 AM   #274
Elite Member
iTrader: (1)
 
Leafy's Avatar
 
Join Date: Jun 2012
Location: NH
Posts: 9,092
Total Cats: 90
Default

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.
Leafy is offline   Reply With Quote
Old 10-23-2014, 10:29 AM   #275
Newb
 
Join Date: Oct 2014
Posts: 9
Total Cats: 0
Default

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.
Kurak is offline   Reply With Quote
Old 10-23-2014, 10:30 AM   #276
Elite Member
iTrader: (1)
 
Leafy's Avatar
 
Join Date: Jun 2012
Location: NH
Posts: 9,092
Total Cats: 90
Default

on the 1.6 maybe. The more civilized miatas dont do that and only a moran would keep the afm when going stand alone.
Leafy is offline   Reply With Quote
Old 10-23-2014, 10:31 AM   #277
Newb
 
Join Date: Oct 2014
Posts: 9
Total Cats: 0
Default

Especially with ITBs which is my scenario. 1:0 for you, Leafy.
Kurak is offline   Reply With Quote
Old 01-20-2015, 03:44 AM   #278
Newb
 
Join Date: Jan 2015
Posts: 2
Total Cats: 0
Default

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?
flyingchameleon is offline   Reply With Quote
Old 01-20-2015, 05:24 AM   #279
Senior Member
iTrader: (1)
 
Join Date: Apr 2011
Location: Columbia, SC
Posts: 1,342
Total Cats: 78
Default

Quote:
Originally Posted by flyingchameleon View Post
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.
Schuyler is offline   Reply With Quote
Old 01-20-2015, 07:23 AM   #280
Newb
 
Join Date: Jan 2015
Posts: 2
Total Cats: 0
Default

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 ******* 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 **** 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 ****. shows you care less for what is trying to be said than what you can measure yourself against... keep measuring, it only gets smaller
flyingchameleon is offline   Reply With Quote
 
 
Reply

Related Topics
Thread Thread Starter Forum Replies Last Post
Raleigh: Fiberglass headlight scope, 1.6L ECU, AFM, Hardtop latches, more bigmackloud Miata parts for sale/trade 13 09-22-2017 01:34 PM
3rd Time's a Charm...hopefully. zephyrusaurai Meet and Greet 2 09-28-2015 11:59 PM
Are my coils failing? viriiguy General Miata Chat 5 09-28-2015 08:39 PM
ME221 Now has Autotune and Long Term Fuel Trim Tables Motorsport-Electronics ECUs and Tuning 0 09-05-2015 09:02 AM


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -4. The time now is 06:59 PM.