Arduino/Raspberry-Pi Powered ECU Sheild - Page 1
Forum section: electronics / projects

author: agilly1989
author_rank: Contributor
timestamp: September 20, 2012, 10:28:51 am
content: Im looking for a little assistance... Basically I'm planning a basic ECU shield for the Arduino (or the Pi or similar) that can run a car motor... I do realise there are many after-market ECUs out there (like Megasquirt) but they arent open source or easy to installBasically what I want to do is pick up the Ignition pulse and the status of various analogue sensors around the car (mostly resistive) and calculate the right injector pulse length... I have a basic circuit design in the planning stage (on Altium) and I will be happy to share it to people if they want to see what I have done, but I am still learningI will also read the settings off a SD card (or micro-SD) to save the eeprom on the arduinoSo.. Is there anyone out there willing to help me a little bit?Feel free to ask me any questions on it

author: Rerouter
author_rank: Super Contributor
timestamp: September 20, 2012, 10:57:21 am
content: yes most of the sensors around your vehicle will be resistive, but none of them will be linear, most requiring only an y=mx+b correction calculation to re-linearise, but thats up to you to implement, if you do wish to use them in some voltage divider configuration, be aware some have ranges down to 0 ohms, (not all vehichles) with a more common range being 10-180 ohms for temp pressure and fuel, (for vdo instrument vehicles)equally you will want to run diodes rail to rail on all of those inputs, as long resistively terminated wires running through an engine bay can make rather nice antennas,for fuel air mixture and a number of the other perfomance sensors, you are on your own there as i dont generally play with them,and as for the SD card idea, seriously start rethinking it, this will be controlling a few grand of engine, you really will want it to only load in the new values to the eeprom if there is a difference, not on every start, and absolutly, plan out your code and hardware so that the engine stays running, and have any other functions executed seperatly, it is not wise having a status input interupt the timing, equally for arduino i would really, really start thinking about learning the underlaying hardware calls to get the most speed out of your loop,

author: agilly1989
author_rank: Contributor
timestamp: September 20, 2012, 11:20:47 am
content: Thank you Rerouter....Air/fuel mixture is usually a 0 to 1 volt source (easy to read with the arduino)Would using a faster micro help? Like the Pi or the Beaglebone (running at about 700MHz instead of the ATmega at about 20MHz)I still have ALOT of learning to do (I'm giving myself this difficult project so I don't get bored with it), so if you can point me in the right direction it would be most appreciatedWhat do you mean when you say "Diodes rail to rail"? which direction do you mean? I dont know much about filtering (or much at all) But I would like to make this project even if it does failYea... A short check routine could run at start-up to check if there are any value differences and change them if necessary so the SD card isn't really needed for running, just to change settings...How would I work with a sensor if it does go to 0 ohms? because I was just thinking of using a basic voltage divider (with the sensor on the bottom half because they usually go to ground anyway)

author: Rerouter
author_rank: Super Contributor
timestamp: September 20, 2012, 11:41:08 am
content: i cant help with the micro speed, while i would assume faster would be better, i cannot say for certain as i have not used them,by rail to rail i mean you have one diode between chassis and signal, for negative spikes, and one between signal and your voltage rail for positive spikes,as for how it would work for 0 ohms, it would read 0V, just you have to make sure you dont cook your board with your resistor at the top of the board, some more modern designs use a constant current source and measure the voltage that develops across the sensor, just be aware if your connection comes loose you want to have it so your sources cannot fry your adc inputs with too much voltage, while it still dissipates heat, its more easy to implement so that you only have to poll them every once in a while instead of just cooking away 24/7

author: poptones
author_rank: Frequent Contributor
timestamp: September 20, 2012, 11:48:07 am
content: Early FI systems used micros like the 8051 and 6809. I designed one years ago using an 8051, just for kicks I even made one that used nothing but op amps and 555s. That was for an old Gold Wing I bought for like 50 bucks.It's all in how accurate you want it to be. It's pretty easy to do basic stuff, witness the old Edelbrock TBI system. But if your aim is to replace the computer in your car, that's going to be a lot more involved.I made a few gadgets for my Mustang back when I was hotrodding that would trick the ecu into doing my bidding. Stuff like disconnecting the hegos so it runs open loop, installing an adjustable fuel pressure regulator, putting pots in parallel with the resistive sensors and making a simple comparator run off the tp sensor to actuate an alcohol injection under WOT. It worked pretty well and it was way easier than trying to duplicate the myriad functions of Ford's EEC system. And this was an 87 model car - trying to replace an ecu in a newer model is going to be even more difficult, now you have transmission strategies and suspension sensors and steering sensors and god knows what else. My 2005 Magnum was completely drive by wire, even the gas pedal and gear shift lever were just electronic parts bolted to the floor with a microcontroller sending signals over the car's can bus.

author: agilly1989
author_rank: Contributor
timestamp: September 20, 2012, 11:58:29 am
content: If you have a schematic for your fully analogue EFI poptones I would Love to see it (I enjoy analouge circuits, I have the circuit schematic of my Marantz amp on my wall just because it looks cool)Its to replace the Lucas/Bosch L-Jet system in Jaguars, So its basically converting the old analogue system into a more programmable digital systemI'm not planning to use CAN-BUS or any other digital transmission as of yet....

author: poptones
author_rank: Frequent Contributor
timestamp: September 20, 2012, 12:16:55 pm
content: Unfortunately I lost everything I owned in a house fire a few years ago. But you really just need to think of it like an analog computer - that's what the old systems were anyway. You just set the base, multiply by air temp, multiply by tp, multiply by coolant temp, multiply by manifold pressure, etc. It's a string of multipliers with each stage's parameters adjusted by a pot. It's not going to be super accurate, but it can work better than carbs.The old Bosch systems were analog electronic and mechanical. Not too many sensors, but you may have the concern of distributor control.

author: agilly1989
author_rank: Contributor
timestamp: September 20, 2012, 12:34:21 pm
content: The only inputs to the ECU areAir/Fuel ratio (if the ECU has lambda feedback)Mass Air Flow (Resistive)Air Temp (Resistive)Engine Temp (Resistive)Ignition Pulse (from the ignition system)And some switches for cold engine start, Full throttle and No throttleIm guessing I'll get the most noise from the Ignition pulse so I'll need some pretty decent filter circuits on that inputI also want to add some more complex things into it like manifold pressure sensing and knock sensing and other things, but thats for a later version

author: Unknown
author_rank: Unknown
timestamp: September 20, 2012, 12:48:38 pm
content: Quote from: agilly1989 on September 20, 2012, 10:28:51 amWhat makes you think open source DIY ECU is going to be easier or cheaper? In short it is not!1. You need to outline what you are trying to do. What I/O do you have? What sensors? Building something reliable that is not going to detonate thousands of dollars worth of mechanical hardware is not trivial.2. What the hell engine are we talking about? Petrol? diesel? Taxi Pack? Grumpy V8?3. Are you after performance? Economy? lower emissions?QuoteThe best help I can offer is to make it quite clear designing an ECU is not a trivial exercise! There have been thousands of man hours gone into most of the better ones.While not exactly open source there are plenty of Kit ECUs that allow you to play and learn.An ECU as a beginner project is about as feasible as DIY earth orbit. Forget the Arduino, if you want to get into electronic engine management Google is your friend, there is plenty of learning out there, but like anything automotive be prepared to open your wallet often.

author: GeoffS
author_rank: Unknown
timestamp: September 20, 2012, 01:06:49 pm
content: Quote from: agilly1989 on September 20, 2012, 12:34:21 pmSome ECU manage a lot more than that!On my vehicle (mercedes Sprinter) , there's very little that not controlled by the ECU. For example, light switches are inputs to the ECU that then drives the relays for the lights. A recent thread on another forum about the Sprinter counted 22 different processors that control some part of vehicle operation. They may be fairly simple for managing the dashboard or more complex for engine or transmission control.As Uncle Vernon said, an enormous amount of research and money invested in these things and it shows in the price of replacement parts. Very secretive lot the ECU makers, try getting diagnostic codes from one of them

author: agilly1989
author_rank: Contributor
timestamp: September 20, 2012, 01:10:16 pm
content: It'll be easier because the prototypes will be designed as a replacement for an existing system.... It'll be just as simple as upgrading the hard-drive in your computer1. The IO....Inputs:Air/Fuel ratio (if the ECU has lambda feedback)Mass Air Flow (Resistive)Air Temp (Resistive)Engine Temp (Resistive)Ignition Pulse (from the ignition system)And some switches for cold engine start, Full throttle and No throttleOutputs:A PWM output to control the injector pulse2. Its a 4.2L Straight 6 Jaguar motor which is in a XJ6 Series 3 1980 Automatic Jaguar... It is a petrol engine3. Hoping to get a little more of each.... If I don't achieve any of them, it was a failed learning experimentI do realise this is a VERY large task... and I do know know there are A LOT of better ECUs out there and I know there is a lot of learning to do but I have a fair bit of spare time on my handsSo basically if the question is "WHY IN THE HELL ARE YOU DOING IT?" the answer is "Because I love to learn"If I make an ECU I can learn how Engine management works, Devise efficient code, work with noisy inputs, analogue and digital inputs etc, etc, etcAny other questions Uncle Vernon?And to GeoffS: Im just planning on older analogue systems (like pre 1990) not these digital systems at the momenthttp://www.jaguarforums.com/forum/jaguar-engines-47/custom-jaguar-l-jetronic-5cu-ecu-70295/That is my post looking for ideas on a jaguar forum... It states my intentions and ideas... I realise most of them are out of my reach at the moment

author: Unknown
author_rank: Unknown
timestamp: September 20, 2012, 03:08:09 pm
content: Quote from: agilly1989 on September 20, 2012, 01:10:16 pmIf it's that easy you'll hardly need to ask for assistance,QuoteFirst thing you learn if you want improvement in all areas you generally cant go too far from what the manufacturer supplied. You can get wild horsepower but it wont coincide with economy. You can get better mileage but it likely won't be the powerhouse it could be.QuoteWhat I believe you are missing is that there is an immense amount of learning to be had without reinventing every bit of the wheelQuoteNo arguments with that. just an old head warning that the learning can be incredibly expensive. I know of people that devoted much of the time and effort during a masters degree developing an ECU.QuoteIf you revise your strategy you'll likely learn a lot more. Don't get me wrong, I am not suggesting you close the bonnet/hood and leave well enough alone. What I am suggesting is that you keep the learning and experimentation manageable. There is a hell of a lot of mechanical engineering to master along with any afternoon of micro code.Quoteplenty! Centring around why you think you need raw code to learnQuoteIsn't Arduino a digital system?QuoteThat is a good start. Talk to others. I believe you are attempting too much for your apparent level of expertise,but only you can decide what is right for you.

author: Zad
author_rank: Super Contributor
timestamp: September 20, 2012, 03:45:37 pm
content: Quote from: agilly1989 on September 20, 2012, 10:28:51 amMegasquirt is not open source, but that doesn't mean it is totally black-box either. Much of what it does has been derived from car manufacturers and component data sheets. If you want to re-invent the wheel then be prepared for a whole world of pain, but you'd be stupid to ignore what is there already:http://www.msextra.com/doc/general/ms3v3schems.htmlAs you can see, most of the sensor conditioning is trivial, and the output drives aren't rocket science (except perhaps the optional current limiting and flyback clamp on the injector drivers).Personally, I'd use one of the automotive ARM cored chips, Arduino is possible but clunky (and limited in memory) and the Raspberry Pi just doesn't have enough I/O without expanders to make it a practical proposition. Get a spark timing system up and running first, then worry about the fuelling system later.

author: agilly1989
author_rank: Contributor
timestamp: September 20, 2012, 11:21:23 pm
content: Thank you Zad... That will help me a fair bitYes.. A agree that an automotive ARM chip would be better, But I don't have the resources available and knowledge to work with one at the momentI have been mesing around with arduino for about a year and it might be able to do it... I'm honestly not sure... I have seen people use one of the 8 bit PIC micros but I couldn't find and they wouldn't show me the schematicsI don't really want to mess with the spark timing at the moment because the Jaguars dont have an analogue system for controlling the spark, either in points (like in my jag) or a hall effect sensor in the distributor (like my dads)Uncle VernonI needed some assistance/help/whatever from some experienced electronics engineers because you guys might have tried it before (or even something similar) and might be able to say it was a total flop or not. But since poptones made one for a motorbike using opamps and 555 timers... Why in the hell couldn't I design a simple (compared to modern equivalents) ECU?To put it basically... To put it basically, its a Pulse width modulated Monostable... It varies the pulse width from the sensors and fires on the ignition pulse (basically).... There has to be another delay on the Ignition so the fuel gets fired at the right timeI really dont need help with the programming its the electronics and design things ill need help with.... Component choice, Filter Design, PCB trace width etc?Did you look for help when you were designing one of your major projects when you didnt have much experience? I don't have the money NOR the pieces of paper required to do an electrical engineering course unfortunatelyIm just sick of making "Hello world" programs on my arduino and I think they can be used for a lot more than temperature logging and display or something else then what they are being used for at the moment so I'm throwing myself into the deep end and seeing if I will drown or notAll I am is a 22 year old guy that is trying to do something useful so if you dont have anything useful to say Uncle Vernon don't say it... Im not planning to make money from this but the older analogue ECUs are slowly disappearing and people want to keep their cars and they dont want to do an extensive re-wire of the harness to upgrade to an after market ECU so that's what I'm trying to do... I haven't been to an electronics class before.. I live in rural Australia and they only taught basic electronics through school and there aren't any sparkys around that are willing to put an apprentice on... So Im basically all self taughtSo please dont troll me Vernon I dont want it

author: free_electron
author_rank: Super Contributor
timestamp: September 20, 2012, 11:36:20 pm
content: 1 ) i would be very weary using shields .... one bad connection in the shield and it all goes to snot... especially in a car that vibrates... those pinheaders are NOT suitable for such applications.2 ) the arduino is not avery ruggedized system in itself , and definately not automotive grade ...if you want to stick to arduino : build your own system on 1 board , pay a lot of attention to protection circuitry (load dumps, voltage spikes etc ), and shielding

author: poptones
author_rank: Frequent Contributor
timestamp: September 20, 2012, 11:50:57 pm
content: An arduino running compiled code has to be as fast as an old 8051 that ran at 1.5uS average execution time. I would say don't let it discourage you, but I don't think you're going to get anywhere expecting handholding. I'm sure it can be done, I've done it - but there's a good bit of learning to be done. Visit the web sites of the megasquirt and such, remember those were developed in the open so whether they are "open source" or not ther's plenty to learn from. Another good source (for me, twenty years ago) is the intel microcontroller application handbook. Not sure how you'd get one today, but there were all kinds of app notes there about using the capture/compare unit of the 8096 to calculate spark and generate fuel pw, notes on electrical system issues in autos - all sorts of information. Perhaps these can be found now in pdf reprints or even at intel's website.

author: vl400
author_rank: Regular Contributor
timestamp: September 21, 2012, 12:12:17 am
content: If you have a look on delcohacking.net we are using cheap Holden Commodore ECU/PCMs on all sorts of vehicles. I have written custom firmware for one of the models to add a heap of extra features and be fully programmable on the fly with some added hardware. You can download the definition file (XDF) for TunerPro (a free data logging and bin editor program) and take a look at what you get to play with, its all free but the code is not open source.http://delcohacking.net/forums/viewtopic.php?f=27&t=356However, a user did release some open source C code to run on the same hardware. The code might give you some ideas of what is involved on that side of things ..http://delcohacking.net/forums/viewtopic.php?f=27&t=476Developing an entire ECU from scratch is no small task, I also dont think the raspberry pi is the right base for this either. You dont need that much processing power for a simple ECU, until the early 2000s Holden managed to control an engine and transmission using a 68HC11 keeping the major code loop speed at 160Hz or above. An arduino could manage it, but good coding will be needed as memory will be tight. Its also lacking hardware timers to make your job easier. As a first step maybe using a cheap factory ECU with your own code might help get you started

author: agilly1989
author_rank: Contributor
timestamp: September 21, 2012, 12:19:38 am
content: thanks alot vl400 and Im looking into the 8051 series processors at the moment poptonesThanks A whole lot guys

author: FenderBender
author_rank: Super Contributor
timestamp: September 21, 2012, 12:24:09 am
content: Yeah there's a whole lot of crap that gets on the "12V" line. There's so much crap on that line that almost cars disable all electronics during startup so you don't get giant kV spikes that send your equipment up in smoke.It's not very forgiving and it is very unpredictable. That said, you can totally prevent any issues from occuring by using a good combination of protection circuitry. MOVs, PTCs, thermal fuses, gas discharge tubes, whatever.Just be aware.Also, as others have said, a "shield" is a pretty bad idea. Automotive needs to be much more reliable than that. Also, Arduino is not instrinsically safe by any means. It has very limited protection circuitry on the AVR. Not well equipped for serious auto use.

author: agilly1989
author_rank: Contributor
timestamp: September 21, 2012, 12:31:18 am
content: yea... I'll need some pretty decent protection on my 12v line... and I realise now that the Arduino may not be the best of choice out there... I'll probably go with some sort of 80xx series chip or some sort of PIC (I heard they process code faster than the Atmel chips)If I could find the circuit diagram for the existing ECU im going to base it off, I would just reverse engineer it to a point... but there are components on the board that are un-marked or are custom Bosch/Lucas componentsYea, Ill probably go for a single board solution guys, thanks for pointing that out to me

author: poptones
author_rank: Frequent Contributor
timestamp: September 21, 2012, 12:32:42 am
content: An 8051 is a lousy place to start. 1985 was a long, long time ago. I'd sooner start with the atmel.

author: agilly1989
author_rank: Contributor
timestamp: September 21, 2012, 01:04:12 am
content: yea, 1985 is a while ago... even longer in "Processor years"

author: Unknown
author_rank: Unknown
timestamp: September 21, 2012, 01:08:21 am
content: Quote from: agilly1989 on September 20, 2012, 11:21:23 pmI did not say you couldn't! But given you are suggesting a small budget and limited resources, I've suggested you are probably taking on more than you can handle in a single project. I'm not out to prove you wrong, just offering some of that experience you said you were looking for. Go ahead prove me wrong if you feel affronted.QuoteAll things automotive are simple when put basically, the reality can be an altogether more complex undertaking.QuoteSure did! And I listened and learnt from some brilliant engineers, mechanics and enthusiasts. Their advice wasn't always what I wanted to hear either, and it was seldom inaccurate even if it did seem discouraging at the time.QuoteYou don't need a piece of paper to achieve results, but if you don't have the money for that how have you budgeted for the costs associated with reinventing the automotive wheel.QuoteYes time to move on you can only flash so many LEDs before the magic dies. There is still a lot of learning between a by the numbers Arduino project and a ground up ECU design. There are lots of Automotive applications you could put your Arduino/s to, and they would provide a lot of the insight required without rendering your (likely) sole means of transport into a brick.QuoteExhibiting a lot of 22 yo attitude too! You asked for advice, I offered it! If you want to do all your learning the hard way, go ahead, no skin off my nose. If you only accept the advice you want to hear you on a hiding to nothing in the automotive world.QuoteGood! You Wont.QuoteI hear what you are saying there,but I don't understand how any home brew is going to involve any less wiring changes. If you just trying to build a replacement for a superseded part, that is not what you have asked for above.Elsewhere in this thread is some excellent advice about adapting a more readily available factory ECU for other applications, you'd learn just as much by adopting this kind of solution and you'd be for more likely to be able to afford it.QuoteSome of the best mechanics I know and have met have never set foot in a classroom in their life. Nothing wrong with self taught, just understand it can be an uphill battle.QuoteYou asked for advice, I gave it! If you're too stupid to take it on board then don't ask! No one is trying to hose down your enthusiasm, the advice offered is an attempt to steer you towards a project you are likely to complete. Ignore my advice, prove me wrong, it will always will be your choice.

author: agilly1989
author_rank: Contributor
timestamp: September 21, 2012, 01:12:27 am
content: Im sorry Vernon... I misunderstood you... I will take your advice seriously nowthank you

author: agilly1989
author_rank: Contributor
timestamp: September 21, 2012, 07:05:23 am
content: I have decided to just make an ALDL (or OBDII) "Upgrade" thing for the ECU to start off with... I wont be controlling anything, Just intercepting the signals and converting them to ALDL compatable data so they can be read by a computer... Once I have that information I can figure out how im going to output signals to control the Injectors

author: poptones
author_rank: Frequent Contributor
timestamp: September 21, 2012, 04:54:24 pm
content: That old thing has obdII?

author: agilly1989
author_rank: Contributor
timestamp: September 21, 2012, 09:03:53 pm
content: No... It has got no sort of diagnostic port or output... What I have decided to do is basically put the microcontroller in parallel so I can monitor voltages and such and log them to an SD card or even straight to A pc with serial data... But if I can simulate the same data sequence that is ALDL or OBD or any other kind of automotive diagnostic... I can just use pre-existing diagnostic equiptment

author: saabman
author_rank: Newbie
timestamp: September 27, 2013, 01:51:51 pm
content: Just been reading through this old thread and was quiet interested in your ideas.How did you go with it or did it go in the too hard basket?I stumbled across this thread while researching the posibillty of doing something very similar but for a VW Kombi :lol:Id love to hear where you got to with it.Bernie

author: agilly1989
author_rank: Contributor
timestamp: September 28, 2013, 12:19:46 am
content: saabman (aka Bernie)After looking at calculations, Power ratings and interference tolerance, PCB layers and design for high voltage/current.. Its WAY out of my depthIn the right hands and the right knowledge, I do believe it is possible (with a fast enough Microprocessor)

author: Seg
author_rank: Regular Contributor
timestamp: September 28, 2013, 02:11:29 am
content: I've thought about doing something like this. IMHO this is totally do-able. Just get yourself an old parts car with a run-able engine, and experiment. Read up on engine controls, there's plenty out there.An Atmel ought to be plenty fast to run TBI, though you may need to get a little closer to the metal than the Arduino libraries. Sequential injection may require something faster...I once owned a rusty 1981 Lincoln Mark VI with EEC-III, Ford's first fuel injection system, and my research indicates it is in fact the very first microprocessor based ECU to make it to market.This is a classic read on the topic:http://www.langston.com/Fun_People/1996/1996ACW.htmlQuoteThere'd be no real market for a product here, there's already lots of aftermarket ECUs out there, and stock ECU's such as Ford's EEC-IV has been reverse-engineered to hell and back to do anything you want. But making your own would be quite the educational project...

author: agilly1989
author_rank: Contributor
timestamp: September 28, 2013, 02:26:35 am
content: Seg... As you might have read I was going to base it off an old analog-ish (I think the Lucas-Bosh system was an analog/digital hybrid) but the reverse engineering and effort/time started to become ridiculous.I would LOVE to see a simple replacement (a direct replacement would be awesome) for older EFI systems, something that uses pre-existing cable harnesses that could "upgrade" a car to a point.Adding data logging, custom curves and other things would be good as wellBUT alas... it got too much for me, health, work, time, life in general got in the way

author: senso
author_rank: Frequent Contributor
timestamp: September 28, 2013, 04:35:58 am
content: There are cheap injection kits for low capacity 4 stroke(and to some extent there is people trying to run them in two strokes), and even the made in china ones, almost always use Freescale mcu's with eTPU's.Or you could do like Pectel/Bosch racing ECU's and assign all the time sensitive signal aquisition/generation to an FPGA and ofload the rest to a mcu/cpu.

author: Ryan
author_rank: Newbie
timestamp: November 25, 2013, 10:40:43 pm
content: I'm a bit into this project as already. I'm putting a GM TBI system on my 1978 Bronco. If I get it working, I'll likely upgrade to a Holly TBI unit, but I don't want to drop that much money into it until I get that far.Being TBI, it's not really that hard. If I was doing full multiport that would be a whole different animal. We'll see how this goes before I start with that.Right now, I am waiting for a few more parts.I have gotten this far:I am only running a Uno. So far that hasn't been a problem. I have it working on the bench with a fake tach line (Function generator), Fake O2 sensor (variable voltage power supply) and the output going to fake injectors (my oscilloscope). Since my engine has a simple thermal switch that tells if the engine is warm, I don't need to know the engine temperature.I built a separate circuit to provide the RPM to the Arduino to simplify the arduino part of things, and I should be up and going soon.I have the parts on their way for the onboard power supply (with large capacitor backup/filtering) after regulation, high current driver for the injectors and input buffering/voltage range adjustment for the rest of the lines. The throttle bodies (I got two so I could mess with one outside of the truck when the other is on the truck) are here, cleaned and ready, and I expect the adaptor plate from Summit any day now. Hopefully I'll have more to report soon.If this works well and seems reliable, I may offer it as a kit for people like me that are good with Arduinos and engines, but don't want to give thousands to Accell/Holley/etc...

author: Stonent
author_rank: Super Contributor
timestamp: November 26, 2013, 03:46:38 am
content: Just wanted to mention that the Arduino "group" specifically forbids the use of Arduinos for automobile purposes.That being said there are versions of the ATMega64 and 128 that end in C1 that are considered for automotive purposes.http://spaces.atmel.com/gf/project/arduinoallegro/There's also this project:http://sourceforge.net/projects/arduems/

author: agilly1989
author_rank: Contributor
timestamp: November 29, 2013, 04:24:20 am
content: I'm sorry guys, I have since cancelled this project because of money and skills, but feel free to continue discussing it

author: timb
author_rank: Super Contributor
timestamp: November 29, 2013, 07:46:26 am
content: Just to add, the Raspberry Pi would be basically the worst choice for this. You need something that can handle real time tasks, which Linux (barring something with Real Time extensions) isn't good at. The first time a background process does *anything* you're going to miss an incoming pulse or have the PWM start skipping, which will cause your engine to lose power, miss, etc.,.Also, Arduino isn't a good fit for this either considering the harsh conditions of living in a car (heat, cold, humidity, voltage spikes, noise which also applies to the RPi above). You'd also have to hand code all the interrupts and subroutines so you might as well just use a straight up AVR as the Arduino Libraries would be basically useless.If anyone was thinking about this, I'd recommend something like a TI Hercules Safety MCU or similar (which is designed for mission critical applications, like automotive or medical) combined with a safety RTOS.

author: Seg
author_rank: Regular Contributor
timestamp: November 29, 2013, 09:27:07 am
content: I think you're confusing an educational project, with a finished product. Just get it working with an Arduino, then move on from there. Ryan has the right idea.http://c2.com/cgi/wiki?DoTheSimplestThingThatCouldPossiblyWorkAlso I constantly see people insisting X can't be done on a Raspi, when they obviously haven't even considered writing a kernel driver. Writing Linux kernel drivers is not black magic. (Mucking in kernel internals can be, but not drivers.) The kernel owns the CPU, put your code in the kernel and you too can own the CPU.

author: timb
author_rank: Super Contributor
timestamp: November 29, 2013, 11:23:41 am
content: Yes, doing the simplest thing that could possibly work is generally the best idea. However, in this case, it's not. Would you trust a several thousand dollar engine or even your life (or somebody else's) to an Arduino or a kernel driver you wrote yourself with no prior experience? Because I wouldn't.I can see getting a Safety MCU dev board and getting it working on that,thenmucking about with auto-proofing and RTOSes. But why start on a completely incompatible MCU and have to re-write all your code?As for what the Raspberry Pi can and can't do, I'm writing a book on using the Pi for Robotics and trust me when I say, writing a real, working Kernel Driver to reliably control the Pi's hardware in such a manner that it's appropriate for real time critical tasks might not be black magic, but it's not easy. In fact, I'd say that for most people it would be a lot easier to slap an MCU on top and let it control critical low level tasks while the Pi does all the high level processing. Just write some firmware that makes it a dumb slave and talk to it over SPI or I2C. Now you have a little co-processor that can even act as a Watchdog to reset the Pi if it locks up. (Plus an ADC, DAC and more I/O!)To me, that's doing the simplest thing to make it work.

author: NiHaoMike
author_rank: Super Contributor
timestamp: November 29, 2013, 03:44:32 pm
content: What about use a small FPGA or CPLD to handle the timing critical stuff? Might also be able to use it to handle some of the failsafes.On the safety aspects, put in a few hardware overrides (such as a drop to idle when the brakes are engaged) and it would be good enough for experimental purposes.

author: Seg
author_rank: Regular Contributor
timestamp: December 01, 2013, 12:46:48 am
content: We're not talking about a new engine here. We're talking TBI engines from the 80's. You'd use a junkyard engine for your prototype. You can easily get a junky old car with a runnable engine for $100 or less in the midwestern US.And I don't see how a buggy ECU is going to kill anyone. Worst thing to happen is maybe run too lean and detonate a cylinder. It's not actually that hard to run an engine, it's been done with primitive mechanical thingies called carburetors for ages. Running an engineoptimallyin all conditions, that's the tricky part.It's presumed anyone doing this is already a motorhead, knowledgeable in the appropriate safety practices, and not afraid to muck about with an engine. There's no more danger here than already exists when wrenching on an engine.If you're not comfortable with this, then don't do it, obviously.

author: Seg
author_rank: Regular Contributor
timestamp: December 01, 2013, 01:00:04 am
content: http://sites.google.com/site/hamlinhomeprojects/projects/raspberry-pi-isrRaspi can handle 90,909 interrupts per second in kernel. Considering the engine spins at less than 10,000 RPM that's probably fast enough.

author: Skimask
author_rank: Super Contributor
timestamp: December 01, 2013, 01:15:55 am
content: Quote from: Seg on December 01, 2013, 01:00:04 amIf ALL is was doing was sitting there and waiting for the next injection event to occur...then, sure, a lowly ATTiny could probably handle the job.

author: timb
author_rank: Super Contributor
timestamp: December 01, 2013, 04:12:50 am
content: Quote from: Seg on December 01, 2013, 01:00:04 amDid you read the entire article? It seems like an absolute nightmare to write a 3.2.x kernel driver for non-i386 hardware because, as the article mentioned, all the resources on the web assume you're working with a 2.7.x kernel and most examples assume you are compiling for i386 hardware and not cross-compiling.Like I said, a kernel driver is feasible, for sure, but it's not the easiest route for this project. If you want to push the Raspberry Pi just to find the limits (as the guy in the article did) or can't use an external MCU/FPGA for whatever reason, by all means knock yourself out! However, in a case like this it's just not the right tool for the job.A faulty MCUmost likelywon't kill anyone, but the potential for very bad things to happen seems awful high to me with a Raspberry Pi. You're driving along and it locks up, you slam on your brakes but the engine is dead so you lose power steering, power brakes, acceleration. It would take ~30 seconds to reboot... At least an MCU with a watchdog would be back on within a second.Like I said, it just seems overly complicated and not fit for the job to me.