Pages: [1] 2 3   Go Down
Author Topic: arduino based fully DIY fuel injection ECU.  (Read 1561 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 129
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello forum. i am making this topic, because, it is a project, i am planing on beginning soon, and i know many on this forum have also done simmilar things to this..
i am planing to build a module, from scratch, to control the fuel injectors,and other functions (iddle, smart boosts, etc..)
on my car.  the module itself, will be based, on 1-2 atmega328 chips, and maybe 1-2 attiny.
the whole concept is to make a module that will:

       know the exact cam position, so it can start pulsing the injectors on the correct time.  calculate the rpm, and by that, control the iddle valve.
 
       read MAF or map sensor (havent figured out)  in order to establish an engine load.

        then, using a wideband sensor, and with a tuning session, you can have the "perfect" amount of fuel, needed for each MAF/MAP on a   MAF-injection time   table...

if this is done, you can also add other functionality, like , accurate (not like the crapy oem) , fuel consumption
extra boost or economy, based on user demand.
some sort of diagnostics,
and even ignition, if all goes well..

the thing is, even though this kind of work has been done before, there has been little documantation about it... so, if anyone have any knowledge on the matter, it would be good, to add our expiriances here smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have look here,

http://cajinnovations.com/


The guy makes and sells DIY fuel injection ECUs for  Ducatis and Moto Guzzis.

There is loads of info and a good forum that will help you.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11158
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you looked at the Megasquirt open source project? Making a good EFI system involves a lot of complexity and a lot of data - an Arduino doesn't give you many resources to deal with any of that. You would also need to design your own I/O circuits - if you adopted the Megasquirt design, all this would be done for you. You also need to consider how much work is required to configure the ECU. There is a lot of software available to configure Megasquirt, provide logging support and do real time and post run analysis to tweak the maps.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Full Member
***
Karma: 0
Posts: 129
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes i have look at it, but if i wanted to buy a ready ECU,  i would by an OEM one. also, the project is to create an arduino Based ECU.
not convert your car to injection (otherwise this post would be on a car forum...)
 
so far my plan is this
first, each camshaft rotation, takes about 20ms to complete. each arduino analog read takes 0.1ms, so even with reading many analog sensors, i dont think it will have a problem. it's code stability that bothers me most..

first, you must use an analog multiplexer, or external ADC, because the analog inputs will be way more than 6... (or you can use another arduino board)

Engine speed- position : Cam position sensor :
Use a metal disk, mounted on the camshaft of the engine, with 36 holes (1 actually missing). a led behing the wheel, and a sensor on the front. every time a whole passes in front of the led, it will send a pulse to arduino. that way, by counting holes , you can know at precicce what degrees your engine cycle is. also, by looking for the missing hole, you can know, when the engine cycle starts again.on the Arduino part, you will have an attach interupt, which counts holes, and the time it took between signals, to mesure RPM.

fuel consumption - car speed :
a hall effect sensor on the rear wheel, with a magnet on the actuall wheel, will produce a signal, related to car speed. the think is, i dont want to have that signal, proceced by the main arduino, becouse, it will make the code more complicated. i plan to use an attminy that will:
Measure the car speed from that signal
also whenever the first injector is pulsed, there will be a pulse at the attminy as well, so it know how much fuel (x4) is injected.
so , every 1 second, it can calculate fuel consumption.   then, it will outpout two PWM. one will be the car speed, (so the main arduino can read it as analogread() ) , and the other will be the fuel consumption gauge.

Engine Load :  i still need some light shed on this matter, as i dont yet understand completly how it is determined by the MAF or MAP sensors... (any help??) ...

Wideband Lambda: there are many open source projects... willl post when i determine which one is the easier to implement

Logged

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11158
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes i have look at it, but if i wanted to buy a ready ECU,  i would by an OEM one. also, the project is to create an arduino Based ECU.
not convert your car to injection (otherwise this post would be on a car forum...)

It's apparent from your questions that you aren't familiar with how the conventional EFI sensors work, or the algorithms needed to run an engine well. There's absolutely nothing wrong with simply getting on with your project if you want to do it for the fun of it, but you ought to be aware that doing it well is going to involve a lot more complexity than you are outlining here and the Arduino is not really a suitable platform for that. If you are fired up about making your own EFI system, the Megasquirt approach would still give you a highly flexible DIY solution but give you a decent chance of working well, rather than sort-of working. As relatively minor points compared to the other problems you're facing, it is not sensible to use an analog input to read the cam position sensor, and the pwm/analog read communication mechanism you are proposing does not make any sense at all.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Full Member
***
Karma: 0
Posts: 129
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what are u talking about dude? i know , i dont know everything, but are you sure , you know what a car is?
Quote
If you are fired up about making your own EFI system, the Megasquirt approach would still give you a highly flexible DIY solution but give you a decent chance of working well, rather than sort-of working.

first of all, i never sed i want to make an EFI system. YOU sed it, and i arledy replied to you, i want to make an engine management system to control the EFI. if i go and buy the dollarsquirt, then what exactly is the DIY?
Quote
, it is not sensible to use an analog input to read the cam position sensor

1) where did i sed, i will read analog cam sensor?? the optical sensor, is digital, and uses attach interupt. its they same exact thing with the VR sensor, only it has a more clean signal, and is way easier to implement. in fact, even with megasquirt, its very comon to use cam triggers like that, and megasquirt supports them, but obviously you dont know what you are tallking about.

Quote
the pwm/analog read communication mechanism you are proposing does not make any sense at all.

2) what part about it you dont understand? it is as simple as it gets. maybe you want me to expnain  how you can use attach interupt to count RPM of a wheel??
if you know the speed of the wheel, in etc 10ms, you know the distance it traveled. by the  injector inpout, you know how much fuel has been injected, so you can calculate fuel consumption. why is it even hard?

i know it will be hard, or it will get complicated. But the project is as it is. if you dont like it , then you can simple not contribute... there is no need for advertisement.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11158
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

2) what part about it you dont understand? it is as simple as it gets. . maybe you want me to expnain  how you can use attach interupt to count RPM of a wheel??

You originally wrote:

Quote
it will outpout two PWM. one will be the car speed, (so the main arduino can read it as analogread() )

That won't work unless you make up a digital-to-analog converter, but even if you did that it would still be a silly way to transfer data between two digital microcontrollers.

i know it will be hard, or it will get complicated. But the project is as it is. if you dont like it , then you can simple not contribute... there is no need for advertisement.

Let's be clear about this. I don't care whether you do the project or not; it makes absolutely no difference to me. I'm bringing up these issues to advise you about problems that you don't seem to have taken into account, probably because you don't understand them. Nothing I've written makes it any harder for you to go ahead with your project, but if you read and understand my comments there is a chance that they will save you from a lot of wasted effort. At a minimum, I suggest that before you spend any significant time on your DIY solution you look at the tuning software for Megasquirt to get a feeling for how complex the behaviour of the ECU is. This isn't complexity for the sake of it, it's complexity that is required to run the engine well. Megasquirt is a relatively crude and simple ECU, and many aftermarket ECUs are much more complicated and sophisticated. In terms of hardware costs, you would need to replicate a lot of the Megasquirt I/O circuits in your DIY solution and I doubt you will do that any better or cheaper than the Megasquirt design does, so if you're thinking of this as a cheaper route then you'd be looking at savings of tens of quid on a project that is going to cost you hundreds. I've done this four times now with different setups and I think the hardware cost typically works out in the region of £1000 by the time you include all the myriad bits of wiring and sensors and connectors and accessories and so on that inevitably need to be replaced - that excludes the main fuel/ignition hardware and engine sensors, which you would obviously aim to reuse.

If you think this will be a fun project that you want to do as a learning exercise or for the challenge of it, that's all the reason you ever need. If you're doing it because you think it's a sensible approach and will give you a good cost-effective solution, with respect I disagree.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 37
Posts: 1146
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

if i go and buy the dollarsquirt, then what exactly is the DIY?

No offense intended, but that comment sounds like someone who doesn't have the first clue about what it takes to set up an ECU.  I'm pretty sure if you got yourself a Megasquirt, you'd find there is P-L-E-N-T-Y of DIY in store for you.  It is HARDLY turn-key.

If you attempted and succeeded in getting a Megasquirt (or any other non-OEM ECU) to run, then rolling your own might be a reasonable goal.  But it takes someone with strong skills in engine mechanics, electronics, programming, and all the maths involved -- which is a pretty heavy combo.  Right now, I agree with PeterH -- to a casual observer, it sounds like you're in WAY over your head.  Many of us around here point these things out to people whose ideas don't seem to be aligned with reality.  Not because we're jerks that like to rain on your parade, but because projects that far beyond someone's skill set never succeed, and often result in so much frustration and wasted money that the poor sap is soured on the entire hobby.  Which is a shame.

So, if you're bent on doing this, well... best of luck.  I would suggest you try for a few intermediate projects first though.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 129
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

  Many of us around here point these things out to people whose ideas don't seem to be aligned with reality.  Not because we're jerks that like to rain on your parade

and i find you guys pathetic! you dont have anything better to do, than to go aroudn pointing your opionion? no one asked you for your opinion.. the fact that this project would be way out of your league, or that you have hard time understanding the base lines, is your problem. but that dosent give you the right to come and say crap like " no you should buy megasquirt" or "its hard, don try".
when you say things like that, you just make yourself look rediculos.

and for the last time. this is not a car forum. stop propusing DIY tuning. that is what megasquirt has to offer (and allot of it) . DIY tuning. i dont want diy tuning. i want diy electronics how hard can it be to understand the difference?
Logged

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11158
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

no one asked you for your opinion

Actually, you did. You came to the Project Guidance forum and asked:

Quote
the thing is, even though this kind of work has been done before, there has been little documantation about it... so, if anyone have any knowledge on the matter, it would be good, to add our expiriances here

Since I do have some knowledge of the subject, and can answer based on the experience of having been there and done that, I can tell you that the project you're taking on is far more complex than you seem to appreciate and that if you do decide to go ahead with it the Arduino microcontrollers do not have sufficient resources to do the job properly. It ought to be possible to get something working well enough to get a specific engine running under specific conditions, assuming you can handle all the electrical, electronic and firmware design issues and then configure it correctly, but there's a massive step from that to an engine management system that runs the engine well enough to be driveable in the real world. Throwing your toys out of the pram because you don't like what you're being told is silly. If you don't want to hear people's opinions, you shouldn't have asked the question. Again: nothing being said here stops you from doing what you want or makes it any harder for you to do the project - all I'm doing is trying to save you frustration.
« Last Edit: January 29, 2014, 11:24:10 am by PeterH » Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Full Member
***
Karma: 0
Posts: 129
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

your fist post that dosent have the word "megasquirt" on it.

based on what you sed before, i doubt you have any experiance with the actuall build of the ecu electronics. Configuring an efi, with megasquirt, has nothing to do , with actually BUILDING a megasquirt.

and no, building a managment system, for the actauall word, is not so complicated OR hard either. you need to stop repeating non-sence. 
if you want to have an OBD2 diagnostic system which will tell you what your engine had for breakfast AND  have a system that is plug and play (or requires some configuration like megasquirt) for any car, then yes, it might get complicated.
But if you want to make a system, that works on your car's specifics, and it will make it run, just better than before (considering that no one with a new car will do experiaments on it.only in older cars)  then it is reather easy. 
hell. the only hard part is to make the widband  o2 controller.

and i got mad with your response, becouse, if people like you did not exist, to scare other people away from REAL diy (not like the diy you BUY with megasquirt), then there would be way more projects to show for.
plus, the only people who have actuall benefit from what you say, are the ones who make money selling Megasquirt.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11158
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

it is reather easy.  

I can't say I share your optimism, but clearly you aren't going to let that stop you. I hope you'll let us know how you get on.
« Last Edit: January 29, 2014, 06:12:53 pm by PeterH » Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Full Member
***
Karma: 0
Posts: 129
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

we have %^&^ up the post now, but yes, i will do smiley-wink
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

based on what you sed before, i doubt you have any experiance with the actuall build of the ecu electronics. Configuring an efi, with megasquirt, has nothing to do , with actually BUILDING a megasquirt.

I'm not sure i understand what it is you are saying here, the " DIY EFI system that shall NOT be named " (as it appears to irritate you)  can be built  and configured for a mostly diy experience. You can get ( or even build your own ) PCB, order the parts , and build the hardware, and even buy a blank chip to program. So the only part of this experience that would not be truly "diy" would be the code loaded onto the micro controller and the GUI used for interfacing with it.
So, to that end, if it is the code you are interested in developing, and if i understand you correctly, you want this code to be specific to your car, then I whole heartedly support your effort and i hope you are able to get it working, as i too would love to see an arduino based efi system developed.

As for the atmega 328 not having the resources required, i'm not sure i agree. the motorolla micro used on the  origional (and still available i think )   " DIY EFI system that shall NOT be named "  ( the MC68HC908GP32 ) has been around for a while, and i don't think it would be considered a powerhouse chip, lets compare a few specs:

Micro controller                   Speed         Program Memory           EEProm              RAM           I/O             A/D
MC68HC908GP32                  8MHz         32K (32x8)                       none               512x8           33              8 (8bit)
ATMega 328 (32TQFP)       20MHz          32K (16Kx16)                    1K x 8             2K x8            23              8 (10 bit)


So, looking at nothing else but the banner specs, it would appear that the only thing the MC68 has to offer over the ATmega is total number of I/O, however one only had to look at the ATMega1280 to get all the I/O pins you would need for a basic fuel injection system, though i think it could be done even with a 328. The original  " DIY EFI system that shall NOT be named " did not use all of the available I/O pins anyway.

I like your idea of multiple arduino boards too, there are many things related to controlling an engine that are not particularly time sensitive and would probably be easier to control with separate boards, rather than trying to write code that does everything all on one chip.
 
i personally have nothing against the   " DIY EFI system that shall NOT be named ", I was one of the first guys to build one way, way back in the day when it was much more diy, and it only controlled fuel and had a very crude fast idle. These days you can buy a kit, and dont have to spend an hour or two putting together a digikey order, or just buy on assembled. 

If i were to start trying to build an arduino based efi controller, i dont think i would use the 328, i would start with something like the DUE or perhaps a teensy 3.1, start with way more overhead than needed.
« Last Edit: February 01, 2014, 11:25:42 pm by joey120373 » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

f i go and buy the dollarsquirt, then what exactly is the DIY?

You get to build up the PCB, even order most of the components to populate the PCB if you want, decide what version of the system you want, put it in a box, wire it into your existing EFI system,  then start the glorious process of setting it up for your engine and then tuning it. That's a fair amount of DIY, trust me, i have done it a few times.
You could also design and build your own PCB if you simply had to, even modify the schematics if your adventurous.

read MAF or map sensor (havent figured out)  in order to establish an engine load.

        then, using a wideband sensor, and with a tuning session, you can have the "perfect" amount of fuel, needed for each MAF/MAP on a   MAF-injection time   table...


I think this question, and subsequent statement, have a lot to do with why other members are thinking that you may not understand the complexity of the task you are undertaking. Simply put, and with all due respect, it appears that you do not know what you do not know, so to speak.
but, to move the ball forward....

MAF  stands for Mass Air Flow. It is generically used to describe a sensor that measures the mass of air being pulled into the engine.
Most modern MAF sensors employ a "heated wire" technique, a current is passed through a wire (usually platinum) to heat it to a specific temperature, the current required to maintain that temp increases as the airflow through it cools the wire. that current is usually converted into a 0-5 volt signal. If you know the Mass vs Vout then calculating  fuel injector pulse width is fairly straight for ward, assuming you know the flow rate of the injector.

MAP stands for Manifold Absolute Pressure, and is generally a 3 wire sensor that measures the pressure inside the intake manifold, ideally relative to the atmospheric pressure. Using this type of sensor is called speed density, because it requires the ECU to calculate the Mass of the air going into the engine based on the engines speed (rpm) and the density of the air it is injecting (manifold pressure). All engines are not the same, but MAP sensor signals from a 600cc 4 cyl and a 8000cc V12 could be identical.
So the ECU needs to know how big the injectors are (flow rate), how big the engine is, Volumetric efficiency at different rpms as well ad desired air fuel ratio among other things. Generally though, there is an x-y look up table, RPM vs MAP, that the ecu uses to calculate required duty cycle.

As for a WBO2 being used to determine the "perfect" amount of fuel, this is possible, in theory but generally not in practice.
The O2 sensor is reactionary, its signal only indicates whether or not previous fuel calculations were high or low. The ECU can use this to adjust upcoming fuel calculations, but it is a moving target, so to get  an exact error compensation is a rather  tall order. Yes, it can be done but would require a lot of computing power as well as knowing little things like, for instance, how long it takes the exhaust gas from each cylinder to reach the O2 sensor at different RPMs, the response time of the O2 sensor etc. It is much easier to simply make small adjustments over time. The constants, the numbers programmed into the ECU, are used to try and get as close as possible to the "perfect" fuel delivery, the O2 sensor is used for fine tuning those numbers.

Here is what i would consider a minimalistic blue print for an ECU main processor:

Crank sensor input (RPM)          1 digital I/O // preferably on a hardware interrupt pin
Camshaft sensor input               1 digital I/O // same as above, however either one of these could be used alone, or both paired
Fuel injector(s)                    1 to 2 digital I/O // 2 should be considered minimum, but up to 16 would be ideal
ignition coil(s)                     1 to 2 digital I/O // again, 2 would be a good minimum, however 4-8 would be ideal
Fuel pump                                   1 digital I/O
Idle control                                 2 digital I/O // 1 minimum (PWM motor) but 2 recommended ( stepper motor )
Cooling fan                                  1 digital I/O // completely optional but recomended
coolant temperature                  1 analog
air temp                                       1 analog
throttle position                         1 analog
MAF/MAP                                    1 analog // some sensors are digital though, but not many
system voltage                           1 analog // for measuring voltage available to injectors and coils, NOT optional
O2                                                1 analog
BARO                                           1 analog // measuring barometric pressure, optional   

So by my reckoning, for a bare bones system, a uno could do it, but a pro mini might be a better choice as it would allow a baro sensor and one extra analog. if you had to you could multiplex the coolant, air temp and baro, but i wouldn't want to do that on any of the others.

However, I think it would be much smarter to start with a MEGA board, or better yet a DUE or even a Tensy3.1.
The Mega has pins to spare, but the DUE and teensy3.x offer more pins and more speed and computing power, the extra speed might well compensate for less than ideal coding.

I highly recommend ( as much as it will hurt ) that you find the online manual for the " DIY EFI system that shall NOT be named "
and study it, its very comprehensive, free, and to my knowledge the best resource for learning and understanding what is required to control an engine with an embedded computer.
Logged

Pages: [1] 2 3   Go Up
Jump to: