[HN Gopher] Speeduino - Arduino based engine management
       ___________________________________________________________________
        
       Speeduino - Arduino based engine management
        
       Author : canbus
       Score  : 112 points
       Date   : 2023-06-02 08:57 UTC (14 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | anfractuosity wrote:
       | Out of interest does a typical engine management system used in a
       | car, make use of an MCU which supports lockstep computing, with
       | multiple cores executing the same instructions simultaneously?
        
         | sidewndr46 wrote:
         | For a car it'd be kind of overkill. The failure mode of the
         | system is usually something like "throttle position sensor
         | value out of range" due to bad wiring or a bad sensor. So
         | multiple cores doesn't do anything, because you still wind up
         | pulling over to the side of road. Some aircraft do something
         | like what you're thinking but it's actually separate computer
         | architectures running the same code.
         | 
         | Now if you go back in time far enough to pre-WWII designed
         | vehicles it was common to have two ignition systems with a
         | massive mechanical lever to switch between "magneto" and "coil"
         | based ignition for gas engines in military engines. Coil driven
         | spark plug systems had advantages but the magneto system was
         | much more reliable by virtue of having no moving parts. Diesels
         | had a slight advantage here in that there was no ignition
         | system as such to fail.
        
         | actionfromafar wrote:
         | No. (But the MCUs are rather rugged. I would imagine they have
         | a watchdog to catch some error conditions, possibly in
         | hardware.)
        
           | ilyt wrote:
           | I can imagine bitflip in one of the tables could be pretty
           | dangerous and not catched by watchdog
        
             | Already__Taken wrote:
             | I saw a 30 second segment in something I'm sure was about
             | F1 engines that had something on a dyno and they flipped
             | (while running) from the engine map to an ai predicting the
             | engine timing per-firing and you could hear the thing
             | smooth right out.
             | 
             | So no I imagine there's actually quite a lot of wiggle room
             | to be off. Less so if you want it to last a million miles.
             | But 30k?
        
             | Gordonjcp wrote:
             | Not really. What's it going to do, make the engine run rich
             | for a fraction of a second until the next time it
             | recalculates the mapping?
        
               | ilyt wrote:
               | Mapping is not recalculated in flight, it is loaded from
               | flash (or via obd when tuning) and normally not reloaded
               | till restart. You might have some luck with short/long
               | term trim fixing it, or not.
               | 
               | If you're lucky ecu might crash or run rich in that one
               | rpm/load point, if not it might run lean entire highway
               | drive, if say a bitflip happens to flip lambda probe
               | settings to always show mixture being too rich.
        
               | samtho wrote:
               | Yeah, the kinetic energy associated with a running engine
               | (flywheel to entire vehicle mass) makes it rather
               | difficult to stall from a single cycle problem,
               | especially given that it consistently recalculates and
               | checks everything multiple times before the timing signal
               | is sent.
               | 
               | The engine feels like it's running fast, but it's really
               | slow compared to ECU's ability to observe it and respond
               | to it. A single missed signal would just result in a
               | misfire.
        
               | Gordonjcp wrote:
               | > kinetic energy associated with a running engine
               | (flywheel to entire vehicle mass)
               | 
               | Like the notoriously hard to stall Citroen 2CVs and
               | Dyanes, where roughly a third of the total weight of the
               | engine was the ridiculous flywheel.
               | 
               | They could chirp the tyres in first, second, or third
               | gear if you got all that mass spinning fast enough, not
               | from power but from momentum.
        
         | samtho wrote:
         | Nope, just automotive grade components and potting goop. A
         | Bosch ECU from a VW New Beetle that I recently repaired has a
         | single Infineon MCU, AMD flash, and Bosch power management ICs.
         | 
         | All Audi and VWs recently have drive by wire system that opens
         | the throttle, drives ignition coils, and triggers fuel
         | injectors electrically. It's not like there is much to go
         | wrong. I did find a very high accuracy, temperature compensated
         | Crystal resonator which makes sense for sending timing signals
         | in a harsh environment.
        
           | pkphilip wrote:
           | Can any of this be done using an open source design? that is,
           | would it be possible to create open source engine management
           | kits for vehicles?
        
             | tyingq wrote:
             | There's also a fair amount of open source short of full
             | engine management. Things like read/write into the CAN bus,
             | altering fuel curves without fully taking over the engine
             | computer, burning altered EEPROMs for older ECMs, etc.
        
             | ilyt wrote:
             | AFAIK you can "just" take Cortex-R based MCU and just
             | configure it properly and you will get the "resets if 2
             | cores don't agree" behaviour
        
             | jacquesm wrote:
             | Yes, yes, and that's already been done:
             | 
             | https://rusefi.com/ /
             | https://github.com/rusefi/rusefi/wiki/Hardware
             | 
             | and others...
        
           | qznc wrote:
           | Some Infineon MCUs have lockstep multicore. Probably not
           | necessary for the computing power you need for engine control
           | though.
        
       | westmeal wrote:
       | Love speeduino! I'm using it to resuscitate an old 87 corvette in
       | batch injection/ignition mode. Starts up but I've got wayyy more
       | to fix on this old turn.
        
       | haunter wrote:
       | One of my favorite examples
       | https://www.youtube.com/watch?v=iH9lp-Nms-o
        
       | Matrix89 wrote:
       | I've used to run my it in my miata, until I've moved to Haltech.
       | Given what it's worth speeduino is a killer in terms of price to
       | performance. IIRC I've moved because speeduino being based on
       | ATMega, doesn't allow for high resolution tables, and overall
       | it's quite basic. My friend used to run megasquirt and while it
       | had more features according to him megasquirt was harder to setup
       | right than speeduino
        
         | lubesGordi wrote:
         | How did you learn how to tune (fuel maps, timing, etc)? I was
         | kind of hoping the speeduino docs would have something in
         | there, alas "it does not cover advanced engine tuning, fuel /
         | ignition strategies etc".
        
           | rainbowzootsuit wrote:
           | Not sure on speeduino, but for Megasquirt, you would start
           | with a best guess fuel map based on engine displacement.
           | These are data that can be shared around.
           | 
           | Then, to tune precisely to the engine, you datalog the oxygen
           | sensor or fuel ratio sensor in closed-loop and process that
           | data to refine the fuel map.
           | 
           | I'm harking back to Megasquirt 1 here so things might be a
           | little different now.
        
             | lubesGordi wrote:
             | So does the best guess basically just mean estimating a
             | fairly rich mix at first? Then for tuning are you trying to
             | lean it out to the point you start pinging then back off?
        
               | millzlane wrote:
               | Yes, it's how the pros do it. After a bunch of cars with
               | the same mods you can tune in the base map pretty much
               | withing 20% error. Copy that map to a car with the same
               | mods. Then it's just a pull on the dyno and refine the
               | fuel maps, rinse and repeat until all cells are stoic or
               | rich but not too rich at WOT. That's a very simple
               | explanation. But there's also things like timing, VVLT,
               | Boost controllers, torque maps, and clutch friction
               | points for DCT's that can all be adjusted.
        
           | westmeal wrote:
           | I can send you some video seminars from this company called
           | high performance academy. They have these paid courses and
           | honestly they've got a lot of free shit on youtube too that
           | is helpful for tuning your VE tables and how to come up with
           | timing figures.
        
             | lubesGordi wrote:
             | High Performance Academy looks great! Thanks for bringing
             | that up.
        
           | Matrix89 wrote:
           | Honestly I don't know, it's not like I've read some kind of a
           | book. I think it's a combination of reading random articles,
           | docs and watching youtube videos(HPAcademy <3). Obviously
           | having a good understanding of how an engine works is also
           | super useful.
        
       | rainbowzootsuit wrote:
       | Shout-out to the OG of open and DIY engine management systems:
       | MegaSquirt.
       | 
       | https://megasquirt.info/history/
       | 
       | http://www.megamanual.com/MSFAQ.htm
       | 
       | I participated in the Yahoo group where the early development of
       | this happened and had a car that my friend and I retrofitted.
       | Bowling and Grippo deserve all the credit due for making this in
       | a free and open spirit.
       | 
       | The original way one made the kit is to order a board in a group
       | buy, and import a BOM .csv file to digikey to put together your
       | own parts kit. It looks like you can mostly still do the same
       | today.
        
         | ehnto wrote:
         | I have never used a megasquirt but I was always rooting for
         | them. We also had an underdog here in the form of Nistune, it
         | was and still is just a bloke in his garage.
         | 
         | I have to support my locals though, Haltech and Link. They have
         | a recent video on the Haltech YouTube channel of a tour of
         | their facilities. It's no Toyota factory line, but feels very
         | pragmatic and I love that they still do it in house.
        
         | geocrasher wrote:
         | I got interested in MS and ended up doing a deep dive on fuel
         | injection in general, learning the different types (TBI, MPI,
         | etc) and the different sensors involved (MAP vs MAF and the
         | like) and really just soaking it all in.
         | 
         | Around that time a friend was having car problems. He described
         | the symptoms to me. I looked up the type of fuel injection used
         | on that car, which sensors it used etc, and recommended they
         | replace a specific sensor, without ever having even seen the
         | car- all based on my knowledge from Megasquirt. I found out
         | later that it worked, the engine ran much better. It's amazing
         | what a bit of open source knowledge can do :)
        
       | fegu wrote:
       | This is so cool, a nice push towards low cost repairs and de
       | facto "right to repair" for hobbyists. The MX5 is also a cool and
       | inexpensive test vehicle. Hope more models are added.
        
         | JKCalhoun wrote:
         | I thought it was cool when the Spec Miata racing class was
         | added -- until, years later, you can hardly find any old Miatas
         | that are not either automatics, or stripped down ex-racers.
        
           | ilyt wrote:
           | The fate of any cheap good sporty car
        
       | mewse-hn wrote:
       | I'd love to convert my ninja 250 from 1987 over to fuel injection
       | but I don't think I have the electrical expertise to figure it
       | out. There are even throttle bodies available from japan where
       | they had fuel injection much earlier than north america. Oh well.
        
       | technothrasher wrote:
       | I had some fun a few years ago developing a replacement circuit
       | for Ferrari 308/Mondial ignition ECUs, and then subsequently the
       | ones for the 328/Mondial 3.2/Testarossa cars. It was interesting
       | to see how crude but still effective the original circuits from
       | the 1980's were, but also how much polish I could give to it
       | while retaining form/fit/function compatibility, using an ARM
       | Cortex-M0 and other modern ICs available to me.
       | 
       | One of the biggest updates I was able to do was to add a much
       | more rugged power supply. The original boxes get fried easily by
       | dirty jump starters, pulling the alternator while running, etc.
       | It was pretty easy with the components available now to make a
       | new circuit that protects from all that.
       | 
       | The most interesting thing to me was that when I went to a more
       | modern ignition map rather than the crude 8 stepped curve they
       | had originally implemented, while testing showed it produced more
       | power and better emissions, people beta testing for me reported
       | it felt 'too smooth, less fun'. So I went back to the original
       | crude steps <shrug>.
       | 
       | Anyway, it was an engaging project that taught me a lot about
       | engine ignition, and I've now sold about 100 boxes and helped
       | keep these old classics on the road.
        
         | ilyt wrote:
         | Was there anything special in the cars that made off the shelf
         | aftermarket ECUs not work with them ?
        
           | technothrasher wrote:
           | No, off the shelf ECUs will work. But because it is a
           | mechanical fuel injection system on these cars, most of the
           | applicable off the shelf ECUs are designed to copy an old two
           | spring distributor system, so you'd lose a lot of the
           | ignition map. Also, for any off the shelf ECU you'd have to
           | hack into the wiring harness, because the OEM units use a
           | proprietary 11-pin connector which is unavailable anywhere. I
           | had to pay about $5000 to get a custom run of them made. A
           | lot of people don't want to hack into their car because it
           | lowers the value. There are definitely people who have hacked
           | these cars with standard ECUs though, even going full
           | electronic MPI fuel injection with things like MegaSquirt.
        
         | Zemtomo wrote:
         | Just to be clear: you build an engine controller with a normal
         | arm cortex-m0?
         | 
         | And if this thing breaks the engine just do nothing?
         | 
         | Did you build any hardening or redundancy into it?
        
           | Gordonjcp wrote:
           | Why would it need hardening or redundancy?
           | 
           | The original system hasn't got any.
        
             | Zemtomo wrote:
             | My experience with cars is not very deep but I did hear a
             | lot about redundancy, isolated systems, real time
             | requirements and automotive grade components.
             | 
             | Also I would say that controlling the ignition is very
             | critical to a car.
        
               | Gordonjcp wrote:
               | Yeah, there's none of that in car ECUs.
               | 
               | If something happens to the system that controls the
               | ignition, it either runs poorly or stops altogether. No
               | biggie.
        
               | technothrasher wrote:
               | Those are all important, but modern improvements. In the
               | 1980's electronic management of engine systems was still
               | very new to the scene and so most of the systems are
               | still pretty basic.
               | 
               | > Also I would say that controlling the ignition is very
               | critical to a car.
               | 
               | Indeed.
        
             | technothrasher wrote:
             | I definitely gave hardening and redundancy some thought
             | when designing. Just because the originals didn't have it
             | doesn't mean it wouldn't be a nice thing to add. So I think
             | it's a fair question to ask. But I decided it was mostly
             | impractical for my design goals and price point.
        
           | technothrasher wrote:
           | If the ignition unit dies, the car will just turn off. I did
           | add the power supply hardening, am using automotive rated
           | components, and I'm actually able to ignore one of the three
           | engine speed/TDC sensors in the car upon failure and still
           | run, but other than that no redundancy. The original boxes do
           | not have any redundancy either, so I'm still providing a
           | "like OEM" solution.
        
             | Zemtomo wrote:
             | Cool to read about this.
             | 
             | I'm in Munich close to Bmw etc and whenever I did something
             | with automotive it would say 'automotive grade components
             | '.
             | 
             | I would not have assumed this would just work.
             | 
             | Is this also connected to can? Or is this only for old
             | cars? So what inputs does it use?
        
               | technothrasher wrote:
               | It is only for direct replacement of the OEM ignition
               | units on these Ferraris. The cars pre-date any kind of
               | diagnostic bus. Although some cars of the era did have at
               | least some flash code based diagnostics, the Ferraris
               | really had nothing until the 348 came out in 1989.
        
             | bayindirh wrote:
             | I know at least one Ford ECU (1996 Ford Escort ZETEC) which
             | has a limp-mode backup controller if the main ECU processor
             | dies, so no, at least some ECUs have redundancies inside.
        
               | technothrasher wrote:
               | Oh, I'm sure a lot of engine ECUs have redundancies,
               | probably most at this point. I was speaking toward the
               | Magnetti Marelli Digiplex ECUs from the 1980's
               | specifically. They have no redundancy.
        
         | lemmiwinks wrote:
         | > while testing showed it produced more power and better
         | emissions, people beta testing for me reported it felt 'too
         | smooth
         | 
         | How hard would it be to made that user-selectable? Because I
         | would guess that some would prefer it that way while driving in
         | the city.
         | 
         | Can you send CAN bus commands to the ECU?
        
           | technothrasher wrote:
           | I could have made a lot user selectable, added bluetooth
           | connectivity (or CAN, I suppose), allowed uploaded maps, etc.
           | But I wanted to concentrate on keep it simple plug-and-play
           | for two reasons. First, the majority of people who own these
           | cars don't want to fiddle. Their car died and they want to
           | just swap out the unit and go. Second, I had some trepidation
           | about the Clean Air Act of 1970, which basically says "don't
           | screw with emissions". If I made it too easy for people to
           | "play" with ignition maps, I was worried I'd be in violation
           | of that law.
        
         | rainbowzootsuit wrote:
         | I definitely have no need for this, but do you have anything
         | published about the project?
        
           | technothrasher wrote:
           | I don't, unfortunately. I've thought about writing it up but
           | never got around to it.
        
         | vctrnk wrote:
         | I'm still looking for an open ECU focused _only_ on old,
         | carbureted cars. Projects like Speeduino, rusEFI, MegaSquirt,
         | etc. are wonderful, but I have no use for them because they 're
         | more geared towards fuel-injected engines (though some do have
         | ways to run injector-less).
         | 
         | Case in point: I have a Renault R5 GTL with a Renix pseudo-ECU
         | module [1] taken from a Renault R11 TX, along with its
         | camshaft, head, double barrel carb and other bits. It has
         | inputs only for manifold vacuum & crankshaft sensor (some
         | support a knock sensor, mine does not). A crude ROM map is
         | applied to the advance curve from just those two parameters. It
         | works really well, but that's it, no way to change or fine-tune
         | anything.
         | 
         | > while testing showed it produced more power and better
         | emissions
         | 
         | A customizable "ECU" similar to the Renix approach that does
         | EXACTLY this, would be a godsend to me (and also my local old
         | Fiat/Lada/you-name-it heads). At these small displacements, we
         | just don't care how the engine sounds: every HP gained is a
         | win.
         | 
         | [1] http://boursinp.free.fr/pdgdiag2.htm
         | 
         | PS. Yes, I know an 123ignition dizzy is what I need, but
         | they're way too expensive - and proprietary. Where's the fun in
         | that?
        
           | bayindirh wrote:
           | There's at least one Speeduino based model aimed at
           | carbureted cars:
           | 
           | https://wtmtronics.com/product/carbumate/
        
           | geocrasher wrote:
           | Check out this guy. He built what calls a "carb cheater".
           | It's a Chevy Idle Air Controller (IAC) from a TBI setup, and
           | is essentially a very controlled vacuum leak. Using it, he's
           | been able to get some pretty impressive feats done. Might be
           | the level of hackery you're looking for. It doesn't do
           | timing, but this is the right kind of tinkering you're
           | looking for, I think.
           | 
           | https://www.youtube.com/watch?v=FwhMz2kR4pw
        
           | technothrasher wrote:
           | Electromotive sells a waste spark system they call "XDi" that
           | seems to be the go to replacement ignition system for the
           | earlier carborated Ferrari folks. Perhaps something to look
           | at if you haven't already?
           | 
           | > and also my local old Fiat/Lada/you-name-it heads
           | 
           | If you've got any Fiat friends who have a car with a Digiplex
           | ignition system that needs a replacement, my ignition units
           | will work with many of them as well, as the Fiat units are
           | basically identical to the Ferrari units but with different
           | curves in them. I've never actually sold a unit to a Fiat
           | customer, but I do have curve information on several Fiat and
           | Lancia cars. The exterior boxes are 100% identical, and I've
           | used some of the Fiat boxes as cores before (I use the old
           | boxes to make the new units, as sandcasting new replacement
           | aluminum boxes would be way too cost prohibitive)
           | 
           | > 123ignition dizzy
           | 
           | I've heard good things about those distributors, but I've
           | never played with one myself. I've used the Petronix solid-
           | state triggers to replace points in a distributor plenty, but
           | several of my mechanic friends now use the 123 ignitions
           | instead.
        
             | dicknuckle wrote:
             | Don't even need Pertronix. You can use a TFI module from
             | 1990's Ford vehicles and trigger it directly from the
             | points distributor, or build a simple circuit with 1
             | transistor to invert the signal and trigger an HEI ignition
             | module.
        
               | technothrasher wrote:
               | This is true, but the Pertronix units are cheap, easy to
               | install, easy to remove and put points back in, and
               | readily available. The downside I've found from them is
               | that their reliability isn't perfect, but they're
               | definitely better than points!
        
               | dicknuckle wrote:
               | An OEM TFI or HEI is even cheaper and more reliable. If
               | you splice everything with bullet connectors and keep the
               | points coil with you, it's the same thing to go back to
               | points, with no tools.
        
         | camhenlin wrote:
         | I'm currently working on replacing the factory KJet on a 83 308
         | QV engine that's been swapped into a 77 308 GTB to a MegaSquirt
         | 3 unit, with coil on plugs from a newer Corvette. Full fuel and
         | ignition mapping control! It's been relatively straightforward
         | so far, someone even makes a crank trigger setup for these
         | cars, I've mostly just worried about keeping the work tidy. I
         | am planning on adding a Rotrex C38-71 supercharger once the
         | modern fuel injection conversion is complete.
        
           | technothrasher wrote:
           | Converting the 308 to full MPI is a great project, and I've
           | seen some folks who have done really nice work in that area.
           | Supercharging/Turbocharging them is also a fun project, but
           | quite a bit more work!
        
       | slicktux wrote:
       | This is awesome!
        
       | skypanther wrote:
       | This has me thinking, are there any similar projects for antique
       | "dumb" cars? I have a 1940 Chevy with a simple distributor,
       | points, timing, etc that all need tweaking now & then. When any
       | of those are out of tune, it runs rough, starts hard, stinks, and
       | so on. I'm not looking for performance, but more efficient and
       | reliable operation would be wonderful.
       | 
       | It would involve a lot more than just an Arduino & some wiring
       | obviously. And a lot of the car's charm is its low-tech
       | originality.
        
         | Gordonjcp wrote:
         | It's called "123ignition", and it's exactly what you need :-)
        
         | bayindirh wrote:
         | I think there are solid state ignition coils which replace
         | distributors. Also, there's at least one Speeduino model which
         | does what you want [0].
         | 
         | [0]: https://wtmtronics.com/product/carbumate/
        
         | jasongill wrote:
         | Yes, there's lot of projects out there, but most people just
         | use off-the-shelf products.
         | 
         | Get yourself electronic ignition (Pertronix is a recommended
         | brand) which replaces points and basically uses solid state
         | electronics to fire the spark plugs, making them run much
         | better and no more messing with points.
         | 
         | All engines need timing, but modern distributor-less motors do
         | it automatically; timing should be a set it and forget it thing
         | for the most part.
         | 
         | Then your carburetor is likely the issue for running rough,
         | hard to start, etc. You could get a different more modern
         | carburetor, but switching to fuel injection may be the way to
         | go if you just want "turn the key and go". They make fuel
         | injection systems that look and mount just like a carburetor
         | but use more modern tech - look at FiTech, or Holley for
         | solutions. Those are going to require you to add a sensor to
         | the exhaust and a couple sensors around the motor (all included
         | in the kit, but work to add), plus you'll probably need a new
         | fuel pump that can put out much higher pressure (fuel injected
         | cars use ~40-60psi fuel, carburetor is more like 3-5psi).
         | 
         | It stinks because it's burning raw fuel and you're not used to
         | the smell of that thanks to today's cars with catalytic
         | converters - they do sell them aftermarket that you could add
         | in to your exhaust system as well.
         | 
         | At the end of the day, it's all very possible and there are
         | open source projects like Megasquirt that could be a place to
         | start, but going the open source route will be even MORE
         | "fiddling around" than your current setup, so you may want to
         | look at off-the-shelf EFI conversions. At least do yourself a
         | favor and get Pertronix electronic ignition - it's a total game
         | changer in terms of ease of starting, smoother running, and
         | less hassle, and it doesn't cost much and is easy to do.
        
           | geocrasher wrote:
           | Indeed, I worked with a guy who had a Ford 300 I6 in his
           | Unimog. He had it running on Megasquirt, but it was so fiddly
           | that he ended up going back to carb.
        
         | ehnto wrote:
         | I think a modern carb and distributor would get you a nicer
         | running car if you wanted to stay analog. There were plenty of
         | improvements from 1940 until the time we switched to computer
         | control.
         | 
         | But for a digital solution, you're looking at an EFI conversion
         | kit, with a ready made wiring harness to convert the necessary
         | items to run the EFI. It is common enough to do that you'd have
         | no trouble sourcing advice and if you like that kind of thing
         | it would be a great project. I see Holley do good looking kits
         | but I can't speak from experience sorry.
         | 
         | The difference between an ECU run V8 and an "analog" V8 is
         | mostly in electronic control of ignition timing and fuel
         | injection, and all the sensors needed for the ECU to know
         | what's going on. I think just replacing the carb with an EFI
         | carb kit would be a great project, but to take it further you
         | would need to ditch the distributor and use coilpacks and
         | ignitors controlled by the ECU, and a timing sensor to sense
         | the position of the crank. At that point you need a full ECU
         | and speeduino would do the trick, but there are supported
         | manufactures of aftermarket ECUs as well like Haltech, Holley,
         | Motec, and Link.
        
       ___________________________________________________________________
       (page generated 2023-06-02 23:02 UTC)