Making Diesel Controller

Your chance to introduce yourself and your vehicle
Post Reply
jedediah_frey
contributor
contributor
Posts: 51
Joined: Tue Nov 05, 2013 1:43 pm

Making Diesel Controller

Post by jedediah_frey »

Hello.

I stumbled on your forum from the ChibiOS. I've been tossing around making a replacement ECM for the Bosch EDC15/16/17. The Bosch EDC series is one of the most popular diesel controllers on the market. Control is going to be much simpler for the first engines I plan on working with (The VW AHU and ALH) since it just needs a PWM signal to control fuel quantity and another to control the turbo.

I'm also very interested in the direction you go with OS and Chipset. I found myself asking a lot of the normal questions: ARM, AVR or PIC. ST, TI, PIC, Atmel, etc. ChibiOS, FreeRTOS, NuttX, etc. Before I sort of settled on ARM32, ST, STM32F4xx. I'm really interested in which way you go with the SPC56. I know it's directed more at the Automotive market but may be not as easy or cheap to start working with. (I use the GCC tool chain and Notepad++ right now).

This guy http://dmn.kuulalaakeri.org/dmn-edc/ has managed to do it with an Arduino. He manages to run everything he needs just fine on 8-bits & 16-MHz. He actually wrote a very nice command line configuration setup that you may want to look into.

I'm a Mechanical Engineer with a specialization in controls. I knew C rather well at one time and I've been playing with the ChibiOS demos for my STM32F4-Discovery board. Also looking at trying to setup Simulink such that it can compile software for me since I prefer to work in model based Control.

I have my own website registered already: http://openedc.info/ and while I'll keep my project separate since spark vs diesel has a lot of different needs, but I'll probably be paying close attention to what you do since I'm not so good on the EE side of things, especially making my own PCB boards and it looks like you have done a lot of good work on making some great buffered inputs.

Cheers,

Jedediah Frey
Mechanical Engineer
Purdue University 2006
User avatar
AndreyB
Site Admin
Posts: 14334
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Making Diesel Controller

Post by AndreyB »

Welcome Jedediah!

Three different guys, myself included, have independently decided to go with stm32f4discovery - that was based on the combination of price, speed and the availability of a totally free tool-chain.

I am mostly on the software side of things so to be honest I am not sure how much of the logic could be reused and what is difference between diesels and gasoline, but maybe we can figure out a way to share the code base. My approach to the code is pretty modular so it could be possible. Hopefully someone smarter than me can elaborate on the differences between diesel and gasoline for the purposes of the ECU.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
jedediah_frey
contributor
contributor
Posts: 51
Joined: Tue Nov 05, 2013 1:43 pm

Re: Making Diesel Controller

Post by jedediah_frey »

russian wrote:Three different guys, myself included, have independently decided to go with stm32f4discovery - that was based on the combination of price, speed and the availability of a totally free tool-chain.
Yep. Although I was looking at the STM32F4-Discovery only as a prototype board. Hopefully in the future I can get a custom PCB, mainly for size, but we could get all the buffered IO onto something the size of the discovery without the need for external boards (with connections that corrode).

The STM32F42x or STM32F43x. They have more flash, more RAM and run a bit faster.
russian wrote:I am mostly on the software side of things so to be honest I am not sure how much of the logic could be reused and what is difference between diesels and gasoline, but maybe we can figure out a way to share the code base. My approach to the code is pretty modular so it could be possible. Hopefully someone smarter than me can elaborate on the differences between diesel and gasoline for the purposes of the ECU.
Sensors could be reused. Not sure if your cars have turbos but stuff like temp and pressure sensors. The logic to read engine speed from a call effect sensor, etc can definitely be reused. As can stuff like a PID for boost (if you have a turbo).

For the older pump in line diesels it's essentially a mechanical pump with a servo added to make it throttle by wire. It's basically a PWM signal. (You can see how the guy wired it up in the link I provided). Another signal controls timing. But it's essentially 2 PWM signals. This is a VE Bosch Pump: http://www.cs.rochester.edu/~jag/vw/engine/fi/injpump.html in the last versions they produced the 'control lever' is internal.

On the newer PD and common rail diesel engines a you need to send a signal to each injector, kind of like a "spark" for each cylinder. However you need an output for each cylinder. Additionally common rail injectors are very tricky to run. Depending on how they are set up electrically to trigger them you actually use the injector as a flyback diode. This lets you generate a high voltage without needing an actual high voltage generator.

For Gasoline engines there are 2 different types of spark. You either have a per cylinder coil pack where each cylinder generates its own high voltage spark. Or you have the old fashioned "all for one" coil where one coil generates the voltage for all the cylinders. Because of the way it works you only need critical timing on the start of the spark. You can also get away with 'wasted spark'. Meaning in a 4 stroke engine you can fire the spark every 2 strokes. Because if you're on an exhaust stroke a spark in the cylinder won't do anything. Where as you can't very well inject diesel fuel then.

In summary:
1998-2003 US VW Diesels using a Bosch VE Rotary pump.
1x PWM Signal for Fuel Quantity
1x PWM Signal for Fuel Timing
1x Input for quantity feedback
1x Input for timing feedback
(The VE pump is also used MANY places, Benz, Cummins, etc all used a VE pump at one point or another)

2004-2007(?) US VW DIesels using a Unit Injector("Pump Düse")
Output signal per cylinder.
Timing is CRITICAL. A few uS one way on the other with start or end of current can have a large impact on amount of fuel.
Not sure about the input signals it has/needs.

2008+ US VW Diesels using a common rail injector
Output signal per cylinder. Also needs to generate a high voltage pulse. I'm not entirely sure how Bosch CR injectors work.
Timing is just as critical and I don't know what IO it needs. Way beyond the scope of what I plan on initially.

Another thing to note is since they lack a spark you can't use a spark sensor to detect RPM. Some have a "W terminal" on the alternator that puts out a signal proportional to engine speed (It's unregulated AC). Most just have a hall effect sensor on the crank now.
User avatar
AndreyB
Site Admin
Posts: 14334
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Making Diesel Controller

Post by AndreyB »

Adding a turbo to my http://en.wikipedia.org/wiki/Mazda_B_engine#BP engine on my race car is probably the goal of this project, so - yes, there will be turbo support at some point but right now I need to get to a point where N/A would run nicely.

Where are you exactly with the development and what steps are you planning for the near future? Our status is on the video on the main page http://rusefi.com/ but I am planning to have an update on this maybe even this week.

Even with the differences you have mentioned I believe we should be able to reuse the code to the benefit of both projects, what do you think?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
jedediah_frey
contributor
contributor
Posts: 51
Joined: Tue Nov 05, 2013 1:43 pm

Re: Making Diesel Controller

Post by jedediah_frey »

Right now I have a STM32F4-Discovery board with blinking lights in front of me. Once I get both my cars up and running I plan on dismantling my old injection pump and start playing with that on the bench to see what type of PWM signal it likes. Then figure out how the hall effect sensor reads and then get the car to idle on the STM32, and then start working with the throttle.
User avatar
AndreyB
Site Admin
Posts: 14334
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Making Diesel Controller

Post by AndreyB »

jedediah_frey wrote:Right now I have a STM32F4-Discovery board with blinking lights in front of me. Once I get both my cars up and running I plan on dismantling my old injection pump and start playing with that on the bench to see what type of PWM signal it likes. Then figure out how the hall effect sensor reads and then get the car to idle on the STM32, and then start working with the throttle.
If/when you have a running car, I think you should sniff what's going on by plugging into the harness one way or another.

While one options is sticking needles into the wires, I have "simply" made myself a harness extension out of a harness socket and ECU socket I've grabbed at a junk yard. With a harness extension, I am sniffing any wire I choose - either with a $10 USB Chinese logic analyzer or with my stm32
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Making Diesel Controller

Post by kb1gtt »

Great to see some TFSI interests http://en.wikipedia.org/wiki/Turbo_fuel_stratified_injection. I once created a QUCS simulation that showed how to generate an 80V kick to drive a DI injector. Picture found here http://sourceforge.net/p/daecu/code/HEAD/tree/wiki/simulations/QUCS_souce_files/picture_docs/DI_3.PNG?format=raw The QUCS source file is found one level higher. If I had a high pressure pump and injectors to play with, I'd be tempted to try that circuit in the real world instead of the simulation world.

I'm more of a hardware guy, who can read code, but can't generate it very well. Think of learning a foreign language off of audio books. I can hear, and understand it, but speaking it, that's a different story.

Do you have some interest and equipment for common rail stuff? I'd be happy to help with the electrical ends of it if you have interests.

[edit] updated link as google code is going away, moved link to SF.net [/edit]
Last edited by kb1gtt on Mon Apr 27, 2015 9:33 pm, edited 1 time in total.
Welcome to the friendlier side of internet crazy :)
jedediah_frey
contributor
contributor
Posts: 51
Joined: Tue Nov 05, 2013 1:43 pm

Re: Making Diesel Controller

Post by jedediah_frey »

kb1gtt wrote:I'm more of a hardware guy, who can read code, but can't generate it very well.
Good. I'm an ME that can code so I have the other half of the spectrum covered.

Here's some documents I found on driving a Piezo. Lots of graphs that will probably make more sense to you: http://www.dspace.com/files/pdf1/Appnote_PZAmp.pdf
Do you have some interest and equipment for common rail stuff? I'd be happy to help with the electrical ends of it if you have interests.
Interest but no equipment. I plan on doing VE -> PD -> CR. (Rotary Pump -> Unit Injector -> Common Rail) since those are increasing orders of complexity and timing critical stuff. And common rail is fuel inspecific. The same code should work on a diesel or gasoline (TDI or TSFI).
User avatar
AndreyB
Site Admin
Posts: 14334
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Making Diesel Controller

Post by AndreyB »

kb1gtt wrote:Do you have some interest and equipment for common rail stuff? I'd be happy to help with the electrical ends of it if you have interests.
Not sure how much this is relevant, but larger chain junk yards will have a 50% off sale for the Thanksgiving weekend.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Making Diesel Controller

Post by kb1gtt »

I had once found that a 2012 Kia Soul has DI the pump that from a dealer cost something like $550, and the injectors were like $50. If found in a junk yard, that could be much more cost effective for a starting point. If the pump and injector can be obtained, it shouldn't be to hard to connect them to a Briggs and scrap iron lawn mower motor or equiv.
Welcome to the friendlier side of internet crazy :)
jedediah_frey
contributor
contributor
Posts: 51
Joined: Tue Nov 05, 2013 1:43 pm

Re: Making Diesel Controller

Post by jedediah_frey »

russian wrote:
kb1gtt wrote:Do you have some interest and equipment for common rail stuff? I'd be happy to help with the electrical ends of it if you have interests.
Not sure how much this is relevant, but larger chain junk yards will have a 50% off sale for the Thanksgiving weekend.
Unfortunately common rail pumps are 10k+
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Making Diesel Controller

Post by kb1gtt »

The price has come way down. I see this one from Hyundia has become available on the after market.

http://www.jimellishyundaiparts.com/showAssembly.aspx?ukey_product=8467908&ukey_assembly=1105808

See item 35320B for the mechanically driven fuel pump $582, and 35310 the injector for $66. There is pipe connected to 4 injectors, so common rail. What I don't know for sure is the pressure. I believe it's around 100 bar, but don't know for sure.
Welcome to the friendlier side of internet crazy :)
jedediah_frey
contributor
contributor
Posts: 51
Joined: Tue Nov 05, 2013 1:43 pm

Re: Making Diesel Controller

Post by jedediah_frey »

kb1gtt wrote:See item 35320B for the mechanically driven fuel pump $582, and 35310 the injector for $66. There is pipe connected to 4 injectors, so common rail. What I don't know for sure is the pressure. I believe it's around 100 bar, but don't know for sure.
I wonder if the driving would be the same as a piezo Bosch diesel injector. Those are usually 1000bar+ with piezoelectric up through 3000 bar.
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Making Diesel Controller

Post by kb1gtt »

I think you are flipping PSI and bar. According to this youtube GDI produces between 40 and 200 bar. My daily driver is GDI, I see one of my VAGCOM logs shows between 60 bar and 110 bar. I think you flipped PSI and bar as 40 to 200 bars is 100 to 2900 PSI. You appear correct if you use PSI instead of bar. Also worth noting, 6061 aluminium has a yield strength of no more than 8000 PSI http://en.wikipedia.org/wiki/6061_aluminium_alloy If the pump had pressures that high, the metal would likely crumble.
Welcome to the friendlier side of internet crazy :)
jedediah_frey
contributor
contributor
Posts: 51
Joined: Tue Nov 05, 2013 1:43 pm

Re: Making Diesel Controller

Post by jedediah_frey »

kb1gtt wrote:I think you are flipping PSI and bar.
Nope. That's a gasoline engine. I'm talking about Diesel common rail engines where you need complete atomization near TDC.
Wiki wrote:On diesel engines, it features a high-pressure (over 1,000 bar or 100 MPa; 15,000 psi) fuel rail feeding individual solenoid valves, as opposed to low-pressure fuel pump feeding unit injectors (Pumpe/Düse or pump nozzles). Third-generation common rail diesels now feature piezoelectric injectors for increased precision, with fuel pressures up to 3,000 bar (300 MPa; 44,000 psi).
User avatar
AndreyB
Site Admin
Posts: 14334
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Making Diesel Controller

Post by AndreyB »

kb1gtt wrote:I had once found that a 2012 Kia Soul has DI the pump that from a dealer cost something like $550, and the injectors were like $50. If found in a junk yard, that could be much more cost effective for a starting point. If the pump and injector can be obtained, it shouldn't be to hard to connect them to a Briggs and scrap iron lawn mower motor or equiv.
Junk yards have all kinds of cars mostly in the 1990-2000 range. Kinda a little bit of up to 2004 but these would be Korean cars mostly. So, if any cars older than 2000 used them tell me which ones :)
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Making Diesel Controller

Post by kb1gtt »

I knew there was a reason why I felt you were correct. I see from here http://en.wikipedia.org/wiki/Common_rail it notes "Third-generation common rail diesels now feature piezoelectric injectors for increased precision, with fuel pressures up to 3,000 bar (300 MPa; 44,000 psi)" That exceeds the yield strength of many materials. I wonder why GDI uses much lower pressures. I think they are all running the same general technology for the electrical drive of the injectors, however I have a lack of experience so I could be wrong. I believe even the GDI injectors are using around an 80V kick to open the injectors then holding with a continuous 12V. I also believe the pulse is actually opening a small pilot valve, which then opens the larger valve. I understand that piezio technology is often used to open the pilot, however other technologies can be used, and both have the same general electrical drive needs.

From fig 6 found here http://www-mat.ee.tu-berlin.de/research/sic_sens/sic_sen3.htm that gas engines cyl pressure under full load was up to 50 bar.

ASME wants to change $25 for this image http://gasturbinespower.asmedigitalcollection.asme.org/data/Journals/JETPEZ/27202/082801_1_f1.jpeg found in this article http://gasturbinespower.asmedigitalcollection.asme.org/article.aspx?articleid=1430075 which seems to indicate that diesel is around 70 bar peak. I'd like to find a better diesel combustion pressure graph. I wonder why the need for such high pressures. I know diesel's detonate, and if not handled properly can cause erosion, so I would expect pressures that can exceed aluminium 8,000 psi yield strength. However I don't follow why the injectors need to be so much higher. Perhaps those higher pressure injectors are only for steal blocks and steal heads, or for when they do the multi pulses during combustion.
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Making Diesel Controller

Post by kb1gtt »

Following the thread name, I want to start some discussion about what the minimum allowable latency is for a diesel engine. For example with the PWM style and mechanically controlled injector pumps, it's likely OK for a signal to take 1/2 of a second from the time it takes to read the signals, to the time it takes to update the outputs. However if you are looking for the multi pulse during combustion thing, that's going to require a much lower latency.

From the above combustion pressure curve, it notes that the combustion pressures happen in around 90 degrees of rotation. At say 9kRPM, 90 degree's takes 1.6mS to pass. If you are looking for say 5 pulses to happen in that time, you are looking for an absolute min of .3mS. I would wager a guess people look to uphold .1 degree accuracy for when you can turn on and off the injector, so I would think a realistic min latency would be 2uS. So how do you setup yourself to have a platform that can uphold latency's in the 2uS to 300uS range? After all you don't want to setup a platform now, only to have to re-engineer the entire thing again when you change to a newer technology.

So I guess a question that should be asked early on, is what is a proper allowable latency? Once we come to a conclusion about that, we can start talking about how we uphold that latency. I tend to want an FPGA design as that latency is around 5nS, while IRQ's in software can get down under 1uS but are typically much longer. However what is a proper latency.
Welcome to the friendlier side of internet crazy :)
jedediah_frey
contributor
contributor
Posts: 51
Joined: Tue Nov 05, 2013 1:43 pm

Re: Making Diesel Controller

Post by jedediah_frey »

When does the GDI do injection? Is it near TDC like diesel engines?

Another thing is that gasoline will evaporate in air, diesel will just pool. You need to atomize the diesel fuel so you get it to a very high pressure so that at the injectors it atomizes. But that's more of a thermodynamic discussion. It is what it is. I just know the higher the pressure the better the combustion. You lower NOx because you don't have the flame front. It's at least a semester class in thermodynamics to understand the why. More == Better.

---------------

Fortunately we NEVER get to 9kRPM. My car red lines at 4700. Most Even the Audi R10 race car only goes to 6000 RPM or so. The advantages of high torque. And while the pressure pulse is 90 degrees you're actually only injecting a very small window of that (the rest is combustion). I'll have to do a sine sweep on my engine to figure out the phase delay between the signal and the response.

Given how the current system is setup I don't think any actual design/engineering is going to go into the current system. I just need to drive 2 PWM signals. The systems I've worked on in the past had a 1 uS resolution on everything. At which point I'm wondering if it's something a standard MCU can do (Without separate FPGA / TPU unit)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Making Diesel Controller

Post by kb1gtt »

I believe GDI pulses during combustion. VW like to advertise ultralean operation, which can only happen during combustion. However I haven't measured it so I don't know for sure.

Most all of my OEM cars redline at 6kRPM. My truck redlines at something slower, I think it's still around 5.5KRPM. I tend to think of 6KRPM as the min, and 9KRPM as common on motor cycles, and race cars.

About IRQ latency that varies for a large variety or reasons. If you have a 10MHz clock, each clock cycle will take .1uS, however to react to an IRQ there are lots of tasks like pushing things onto the stack, such that you can return to your normal processing when you are done the IRQ. Then followed by IRQ prioritization and maintenance handler, eventually you get to the actual IRQ routine. It's common you have a hundreds to thousands of clock cycles before the routine has a chance to start processing the IRQ. Then of course the IRQ processing has latency itself. This often puts the latency over 300uS.

There are some ways to get the latency down, for example if you highly optimize the IRQ handler(s) by writing them in assembly, or if you have a multi-core chip you can simplify the IRQ handler on the sub processor, so it doesn't have to push stuff to the stack, and can fast track you to the IRQ code in short order. Those chips also typically use 100MHz clocks or greater, so 1uS latency is fairly easy to obtain. We have low cost options that allow for a very large variety of latency's, however what latency is tolerable?
Welcome to the friendlier side of internet crazy :)
User avatar
Poseidon
Posts: 66
Joined: Mon Sep 01, 2014 2:46 pm
Location: Melbourne, Australia

Re: Making Diesel Controller

Post by Poseidon »

Just a little sidebar GDI (or any petrol) vs Diesel...
The fuel on GDI is still being injected during intake stroke, atomising, then compressing.

Diesel on the other hand is compressing air 40+ bar normally aspirated engine, then in accordance with rpm timing injecting fuel at the correct time and due to the pressure and heat caused by the pressure combusting. Increased advancement in boost systems to increase air in the chamber mean higher pressure at injection time. Kinda like trying to take a piss at the bottom of the Marinara Trench vs petrol engine pissing in outer space... Lol just sayin

And that's without the thermal dynamics, lecture, pollution control, and pre, post & variable injection theory as I learned it on the global design platform :D

So why the high injection pressure, global design platform engines nearing euro 5-6 standards need every last optimisation. Peak pre, post, variable injection time is the only way to get to burn efficiency lowering add on Enviromental packages like the archaic EGR systems, or new expensive adBlue catalytic systems.

I hope that helps someone/anyone since this is my main area of expertise....

And if anyone can get a diesel injector to do this stuff you'll be on par with the big guys!!!



Sent from my iPhone using Tapatalk
Nothing is ever broken, it's just a mater of patience, resources and persistence to fix it!!! Oh yeah and knowing when it's worth it or not!!!
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Making Diesel Controller

Post by kb1gtt »

Seems common that gas job don't like to use the term diesel. Instead they like to call it TFSI or something similar. http://en.wikipedia.org/wiki/Turbo_fuel_stratified_injection Also there are many variations, some simply inject into the cyl, and spark very similar to how it's done with manifold / port injection. Then others inject fuel similar to how it's done with diesel. A key problem for the gas jobs is that the high pressure pumps are very difficult to manufacture relative to manifold / port injection pumps. Turns out diesel is very much a lubricant, while gas is a solvent. So it becomes kind of hard to keep things sliding smoothly while generating high pressures. Any how, the TFSI engines will switch between traditional gas, and traditional diesel. Basically the turbo can boost such that you have detonation pressures or non-detonation pressures. Then it can spark as required.

A friend recently sent me this link http://www.myhero.ws/hero.asp?hero=Envirofit_Tech_2005 if we could find a way to make small engines work with these high pressures, I think we'd have something of interest. Picture being able to safely add a high boost turbo with out changing the pistons. AKA you prevent detonation by limiting the fuel dispensed, slowing down the flame front and decreasing the cyl pressure such that it's at safe levels. That would be really interesting, and small engines are cheap to blow up. Once it's done on a small engine, it would be a natural progression to a larger engine.

Yup, would be interesting, but I have no idea how to make it happen.
Welcome to the friendlier side of internet crazy :)
Post Reply