Page 1 of 1

raspberry pi ECM for cars?

Posted: Thu Nov 14, 2013 2:06 am
by jehamann
Hi, I was wondering if it was possible to make a raspberry pi into a car's electronic control module, I mean an ECM is just a computer and I imagine the computers in cars do not use much ghz processing power.

Re: raspberry pi ECM for cars?

Posted: Thu Nov 14, 2013 2:41 am
by Nige C
Woah. This may seem a simple thing with the Pi,s processing power. But commercial ECM's for cars are a hardened technology.
Cars are a noisy environment electrically and mechanically. Also commercial ECM's comply with the CANBUS standard.
Getting an ECM - Engine Control Module wrong could be disastrous and wreck a cars engine. Or worse, cause a crash and loss of life, ie run away engine etc.

Re: raspberry pi ECM for cars?

Posted: Thu Nov 14, 2013 7:16 am
by MoosePi

Re: raspberry pi ECM for cars?

Posted: Thu Nov 14, 2013 10:13 pm
by jehamann
thanks for the info! the reason why I asked this was because I would rather make my own ECM, so I can buy any motor and make the necessary adjustment need to make the engine run right, I dont want to have to pay for abunch of money for a probably expensive ECM to use on one engine. Do you guys know were I could look and find out how to build one from scratch?

Re: raspberry pi ECM for cars?

Posted: Thu Nov 14, 2013 10:45 pm
by jasonclark
jehamann wrote:thanks for the info! the reason why I asked this was because I would rather make my own ECM, so I can buy any motor and make the necessary adjustment need to make the engine run right, I dont want to have to pay for abunch of money for a probably expensive ECM to use on one engine. Do you guys know were I could look and find out how to build one from scratch?
I expect you need a real-time system for this. Standard Linux probably won't cut it for good control within the time constraints of engine management.
If you're adjusting the timing of the engine, you'll need to respond to 1000's of events per second. I guess the Pi can do this, but only in bare-bones mode (so no OS).

What processor do existing ECU's use? I expect some form of microcontroller, but the level of processing power may help decide if the Pi is suitable.

Re: raspberry pi ECM for cars?

Posted: Fri Nov 15, 2013 12:42 am
by dancytron
You might be able to do it for an older 1980's or early 90's engine where you are really dealing with just an 0xygen Sensor, Knock Sensor, Vacuum Sensor, a couple of temperature sensors and a few more sensors that just retard the timing and set the fuel to air ratio. Newer engines are much more complicated and have a lot more going on.

Technically, at least in the United States modifying the computer like you describe is an illegal modification of the emissions that makes a vehicle no longer street legal and is subject to a big fine.

But, if you are at the track or offroad or someplace with no rules (or no enforcement) and can get away with using an old engine, you could set it up the old fashioned way with no computer at all.

ECMs are available at reasonable prices at pick and pull junk yards and people on ebay who rebuild them.

Re: raspberry pi ECM for cars?

Posted: Fri Nov 15, 2013 9:59 am
by fixitsan
Have you looked at any of the 'Megasquirt' systems ?

They allow you to customise the kit for any engine, and it has a lot of support

Try http://www.megamanual.com/index.html

Re: raspberry pi ECM for cars?

Posted: Fri Nov 15, 2013 11:31 am
by techpaul
Most ECMs have all sorts of peripherals and often TPU (Timing Pattern Units) to produce accurate timed 16 bit wide and larger sets of pulses to drive things and a myriad of peripherals to receive signals from these days a myriad of sensors they need at high speed.

Slower speed sensors are sometimes communicated via CANbus, this is a difficult field to be safe in noting that Toyota have recently lost court cases in USA and are dealing with lots of money problems for this.

They use their own Real Time (hard real time) operating systems or schedulers. This is normally a task undertaken by a design team where some of the design team deal with non-electronics or software but know the mechanics and engine dynamics.

Off road usage and tinkering would be OK for YOU taking all the risks.

Be aware in any country you would need to check whether this is legal, and any recertification of vehicle would be required. Most insurance companies would void the vehicle insurance for on road use as this is a custom modification.

Re: raspberry pi ECM for cars?

Posted: Tue Dec 10, 2013 7:54 am
by colinh
And there was me thinking he needed electronic countermeasures for his car ... :shock:

Re: raspberry pi ECM for cars?

Posted: Tue Dec 10, 2013 3:22 pm
by black85vette
I don't think the Pi is a good choice for ECM. Not enough inputs and not the right kind. You also need drivers able to activate the fuel injectors. There is a lot of engineering behind an ECM. It is a long learning curve to be able to setup an engine properly with a commercial unit much less having to design all the hardware and software on your own. To do it properly requires some investment in test/monitoring equipment and access to a dynamometer. I have also heard the the Megasquirt system is pretty good. I am running an Accel DFI ECM on my Corvette and the learning curve to just make adjustments to it is pretty significant.

If you want to talk to some folks that know their stuff stop by thirdgen.org forums. That is where a lot of Camaro gearheads hangout and discuss all aspects of engines and fuel management. I have learned a lot from them.

Re: raspberry pi ECM for cars?

Posted: Wed Dec 11, 2013 8:54 pm
by AJB2K3
Someone built an ecu for his car using an arduino but he had the oridginal ecu to check that what he thought he was doing was indeed what he was supposed to be doing.

Re: raspberry pi ECM for cars?

Posted: Fri Jul 07, 2017 1:16 am
by davidpetersonharvey
Whatever happened with this?

I'm reading people saying the board is too slow to handle this and other people saying that someone actually did it with an Arduino. The peripherals aren't that different on the two boards and the Raspberry Pi is certainly the more powerful of the two, especially the newer model 3. I'm thinking you would have to start with a scaled-down Lenox package like damn small Linux or Arch Linux

maybe you can even start with the Linux kernel

It sounds like a lot of work to me

Re: raspberry pi ECM for cars?

Posted: Fri Jul 07, 2017 1:25 am
by davidpetersonharvey

Re: raspberry pi ECM for cars?

Posted: Fri Jul 07, 2017 8:46 am
by jamesh
Best thread necro of the week. 4 years or thereabouts.

Not sure the PI3 is suitable as Linux is not a RTOS that can handle to requirements.

Re: raspberry pi ECM for cars?

Posted: Fri Jul 07, 2017 9:05 am
by Mortimer
davidpetersonharvey wrote:In fact, check out this link.

http://hackaday.com/2015/01/28/raspberr ... on-engine/
Interesting, but not quite what is being talked about here. In Adam's PhD project, the Pi is not directly controlling the engine, there isan ECU there. This topic seems to be about whether or not the Pi could take on the role of the ECU, and in my opinion the answer is "maybe, for a small simple engine, like a single cylinder motorcycle or lawnmower engine."

Re: raspberry pi ECM for cars?

Posted: Mon Apr 20, 2020 7:23 pm
by sp0oky
I'm sorry to be that guy, but yes a raspberry pi is definitely powerful enough and fast enough to run a vehicle, and yes, Adam's pi is controlling the engine. The low-level MCU that was mentioned is interpreting the instructions from the pi's calculations into machine code. The pi cannot natively interpret CAN. There's a ton of MPU's in the vehicle, and they all communicate via the CAN network. The pi is so much more powerful than the native unit that it can calculate algorithms inside machine learning software while simultaneously updating the system with the new instruction set. The raspberry pi is 100% controlling the system. It is the central processing unit. The difference between that and the standard ECU in your vehicle is that the entirety of the instruction set from your ECU is at most 3MB, and clocks in at a top speed of 128MHz. The Raspberry Pi 2 from 2015, the time of that article, had 1GB of SDRAM and a clock speed of 900MHz.

"GM stated that the 2011 Buick Regal will have the auto industry's fastest processor: 128Mhz, and 3MB of flash. 'Three meg of flash memory and 128MHz clock speed doesn't sound like a lot in terms of computing power until you consider the environment these controllers have to live in. Our controllers are made to operate reliably up to 260 degrees (127C) and down to -40 degrees (-40C) for the life of the vehicle.'"

It not only can run the ignition system, but it could run the entire car. The reason we still use these systems is because of 1) bureaucracy 2) simplicity 3) My personal opinion, money.

I've heard arguments for and against CAN, and I personally believe those in favor of can are just afraid of change. I think it's time to move into the future. CAN is the reason why we still use these crude ECU's, where bandwidth is limited, speed is limited, possibilities are limited. It cost money to develop new technologies, but that's what drives innovation. We've had access to ethernet for decades, and that would give us access to more powerful computer systems to run our vehicles. You wouldn't need to tune your car, because it would do that for you. Finely demonstrated by Adam, with not very powerful computer.