PDA

View Full Version : is TBI an option for our cars?



Buzo
05-23-2011, 08:15 PM
I did a quick search and found nothing about somebody trying a carb to TBI conversion. Need to say the following first:

1) I'm really happy with my carb performance. But I'm getting bored.
2) Not interested in the $600 USD aftermarket TBI.
3) Not interested in a FI donor car.
4) I know the advantages of a multi port FI over the single port FI. But I also know the advantages of the single port FI over the carb.
5) I will build my own ECU. I'm most worried about the mechanical portion of the system than the electronics.
6) I'm thinking this may be my next project.

I owned a chevy monza some time ago with the Single Port or TBI system (sold only in Mexico, I think), honestly, I never though about the fuel system it has, because it never gave any problem.

I have on hand an in-tank Fuel Module with a pump, filter and regulator, everything integrated in a bucket that fits my fuel tank. So check mark to this part of the project.

Then I'll need to:

a) Adapt a TPS and a Mass AirFlow Sensor to the Carburetor, and start collecting data while its still carbed. So when I start writting my code I know the range of the input values at all drive conditions.

b) Get a Chevy Throttle Body Asm from a JY, make and adapter plate and throw it into the OEM intake manifold.

The plan is to start writing the "default" program which every single ECU runs when any input goes bad, which estimates the missing signals just to keep the car running.

If that part of the project works, then I can think in compensate for temperature, altitude etc.

Buzo
05-23-2011, 08:31 PM
This picture tryes to explain what I just said below:

To begin, only the Throttle Position Sensor will drive the amount of fuel dispensed in the intake manifold. If that works, the other sensors will be added later, one at the time.

http://img593.imageshack.us/img593/5808/badasspic.jpg (http://img593.imageshack.us/i/badasspic.jpg/)

cygnus x-1
05-23-2011, 11:23 PM
I would recommend looking for an older Megasquirt, like an MS1 or MS2, for the following reasons:

1) Can be had for cheap now that MS3 is out.
2) Supports TBI or port injection and ignition if you decide to tackle that later.
3) VERY hackable since all schematics and source code are available.
4) There are some excellent tuning tools available for free.
5) You will NOT get bored.

At the very least check out the online manuals for MS as they have a wealth of information on how fuel injection works in general.


If you still want to try and roll your own ECU, the bare minimum information the ECU needs to run the engine is load and RPM. On a stock type engine load is best determined with a MAP sensor, not throttle position. You could also use MAF but those are more tricky to setup. To start the engine cold you'll also need a coolant temp sensor. Then if you want to play around with acceleration enrichment you can add a TPS, although you can do better by looking at the rate of change of the MAP instead.


Seriously, at least look into MS. It's well worth the effort.


C|

Dr_Snooz
05-24-2011, 05:26 PM
Didn't some of the older Civics have dual port fuel injection? They might provide some of the hardware you're looking for.

Buzo
05-24-2011, 07:49 PM
Didn't some of the older Civics have dual port fuel injection? They might provide some of the hardware you're looking for.

Thanks, i'll start looking for these civics as well as citations, cavaliers, etc. around the 1992 MY.

Buzo
05-24-2011, 07:53 PM
I would recommend looking for an older Megasquirt, like an MS1 or MS2, for the following reasons:

1) Can be had for cheap now that MS3 is out.
2) Supports TBI or port injection and ignition if you decide to tackle that later.
3) VERY hackable since all schematics and source code are available.
4) There are some excellent tuning tools available for free.
5) You will NOT get bored.

At the very least check out the online manuals for MS as they have a wealth of information on how fuel injection works in general.


If you still want to try and roll your own ECU, the bare minimum information the ECU needs to run the engine is load and RPM. On a stock type engine load is best determined with a MAP sensor, not throttle position. You could also use MAF but those are more tricky to setup. To start the engine cold you'll also need a coolant temp sensor. Then if you want to play around with acceleration enrichment you can add a TPS, although you can do better by looking at the rate of change of the MAP instead.


Seriously, at least look into MS. It's well worth the effort.


C|

I alredy read some stuff about the Megasquirt and all the FI theory they have in their site. If something fails, I will 100% follow your recommendation.

forrest89sei
05-24-2011, 08:48 PM
Yeah the 88-91 Civics with the D15B2 Came with DPFI, I've always wondered about adapting one of those TBI Setups to work on a A20

Buzo
05-25-2011, 06:10 PM
I found a TBI from a 4 cylinders Cavalier in a very small package that I believe will fit under hood.
The guys in the JY were supposedly to dismount it for me tomorrow because I went a little late today. The cost was 35 USD with all sensors, hydraulic connections and harnesses. So another check mark for the hardware.

I modified mi OBDZ by adding a Transistor that will drive the injector.
It can monitor 8 analog inputs at the same time at a clock speed of 20MHz, so speed or memory resources are not a problem.
It also can generate 0-100% PWM signal in 255 steps which I believe will give me enough resolution for the control of the fuel.
Check mark for the computer, the material cost of this thing is 50 USD If I remember correctly. (Check mark anyway)

The only pending so far is the software (almost nothing haha), I have written the basics already that should allow me to keep the engine idling.
Then from there it will be test, and retest, and retest (how do you say "prueba y error" in english?)

Buzo
05-25-2011, 07:08 PM
"The Computer"
http://img808.imageshack.us/img808/5184/imagen165a.jpg (http://img808.imageshack.us/i/imagen165a.jpg/)

2oodoor
05-26-2011, 02:16 AM
brilliant idea, has been discussed before but never has anyone here done it that I have read.

I would thinik that a small v6 would be a better donar for the hardware. Something that is capable, but hey I guess one from an old long stroke GM four banger would suffice. I would explore the likelyhood of other electronics donars such as AMC Jeep, VW, Escorts, something that is more retrofitted to keep up with the other makes would have more isolated wiring harness I would guess.
Getting it to work with OBD2 interfaces would be awesome since most oem TBI are not. I guess you are going to use a carbed distributor or what are your thoughts there for electronic ign advance?

cygnus x-1
05-26-2011, 09:58 AM
I really like this kind of pioneering work. Will be interesting to see how this works out!

For that TBI, you'll need the fuel pump from that car as well, or something similar. TBIs use a higher fuel pressure than carburetors, but lower than standard port injection. You *may* also have to run a return line back to the tank, but I'm not sure if the TBIs did that or not.

Looks like you have the electronics under control, but I'll throw out some random thoughts anyway. I think you'll need a heat sink on that driver transistor. Can't tell from the picture, is it a MOSFET? The injector will have quite a lot of inductance so you'll want a flyback diode on there.

Have you sorted out which sensors you'll be using yet? I have some voltage curves for the stock Honda MAP sensor and I think one of the temp sensors if you're interested. You actually don't need an O2 sensor to run although it will be helpful for tuning. If you have a wideband O2 it would be MUCH easier and more useful than a narrow band (stock type) sensor.


C|

Buzo
05-26-2011, 07:27 PM
I got the TBI from the 89 Cavalier with a 4 cyl 2.2L from the JY, barely above our Honda's 2.0L.

It has the Map Sensor, the TPS, and the Air Temp Sensor. It also has the air idle control solenoid which I don't know exactly what it does.

I am going to collect data from all sensors, even the stock ones, but to start really controlling the fuel I am going to use only the TPS signal as a first step. I have read that there are some racing cars that uses only the TPS to determine the quantity of the fuel. That will be to probe myself I am in the correct direction.

This is the little guy. Sorry for the quality of the picture, looks like my cel strugles to focus when there is some sun light in the pic frame.

http://img830.imageshack.us/img830/7779/hardwarea.jpg (http://img830.imageshack.us/i/hardwarea.jpg/)

Buzo
05-26-2011, 07:38 PM
I really like this kind of pioneering work. Will be interesting to see how this works out!

For that TBI, you'll need the fuel pump from that car as well, or something similar. TBIs use a higher fuel pressure than carburetors, but lower than standard port injection. You *may* also have to run a return line back to the tank, but I'm not sure if the TBIs did that or not.

Looks like you have the electronics under control, but I'll throw out some random thoughts anyway. I think you'll need a heat sink on that driver transistor. Can't tell from the picture, is it a MOSFET? The injector will have quite a lot of inductance so you'll want a flyback diode on there.

Have you sorted out which sensors you'll be using yet? I have some voltage curves for the stock Honda MAP sensor and I think one of the temp sensors if you're interested. You actually don't need an O2 sensor to run although it will be helpful for tuning. If you have a wideband O2 it would be MUCH easier and more useful than a narrow band (stock type) sensor.


C|

Thanks for pointing out your observations.
The fuel pump and the filter I got is from a returnless system, it means no return line is required since the pressure regulator and filter are in-tank type. I believe it has a working pressure of 400 kPa, but I can easily get a 350 kPa regulator (or lower) if needed.

From the electronics, you are right, there is a diode alread in the solder side. I am going to drive a coil that will damage the NPN transistor (TIP41) if the diode is missing. I will look for a heat sink as well.

In the near future, after I can control my engine with the TPS, I will add everything else, including the MAP sensor, Cololant and Air Temperatures, and of course our stock O2, which is a narrow band I know, but once you get it hot it will tell you if the mix is rich or lean. Good enough for me.

Forgot to say that any voltage curve you have that can share with me will be very helpful. Thanks a lot for your interest. I know this is going to work better and the project done faster than I expected. At this time I have everything but the adapter plate that I will take to the machine shop on saturday.

Buzo
05-26-2011, 07:45 PM
brilliant idea, has been discussed before but never has anyone here done it that I have read.

I would thinik that a small v6 would be a better donar for the hardware. Something that is capable, but hey I guess one from an old long stroke GM four banger would suffice. I would explore the likelyhood of other electronics donars such as AMC Jeep, VW, Escorts, something that is more retrofitted to keep up with the other makes would have more isolated wiring harness I would guess.
Getting it to work with OBD2 interfaces would be awesome since most oem TBI are not. I guess you are going to use a carbed distributor or what are your thoughts there for electronic ign advance?

The plan so far is to leave the carbed distributor.

For the momment I just want to hear it Idling. Then I can think in adding more and more capabilities.
A friend of mine works in a local company that makes the hand held OBDII diagnostics devices, so he has all the communication protocols and everything, I can get him engaged in this project and take us to the OBDII world with his help.

Buzo
05-26-2011, 08:14 PM
As a side note, I went tho the JY today and as expected the guys had not removed the TBI from the engine. They were told by their boss to fire up the engine first before removing the TBI, so they can clasify the engine as a good or bad.

You won't believe this but they connected a battery and fired it up (using a "direct" of course because they couldn't find the key) did put some gas directly in the throttle and the engine started and kept idling immediately. Of course there were dust everywhere, but It idled nicely. They got surprised that there was still some fuel in the tank.

Tell me if ANY carbed engine can do that without sputtering, vibrating and needing several tries, well this is going to be the great advantage if we can make the carb conversion to TBI to work.

After this quick test they could finally remove it and sell it to me!

Buzo
05-27-2011, 09:04 PM
The TBI height compared with the stock carburetor.
http://img694.imageshack.us/img694/4489/sidebysideb.jpg (http://img694.imageshack.us/i/sidebysideb.jpg/)
Yeah, its really dirty, I plan to clean it through before installing it.

Buzo
05-27-2011, 09:10 PM
The adapter plate I built myself. Not bad uh?
At this time I am ready to begin with the instalation tomorrow morning!

http://img199.imageshack.us/img199/1649/adapterplate.jpg (http://img199.imageshack.us/i/adapterplate.jpg/)

Buzo
05-28-2011, 04:34 AM
A visual aid of how the software in my home made ECU will work.
There is an Idle Air Solenoid in the TBI that I don't quite understand how it works (if it needs PWM or is only a on/off signal), so I am sure I need to add some code for such solenoid. But its easy in any case, not worried at all.

http://img692.imageshack.us/img692/6209/flowchartpic.jpg (http://img692.imageshack.us/i/flowchartpic.jpg/)

cygnus x-1
05-28-2011, 09:42 AM
The idle solenoid probably takes a PWM signal. It acts as a sort of computer controlled throttle to help keep the idle stable. You can do without it.

Your control scheme is missing a critical variable, RPM. Engine fueling varies significantly with RPM so you will need that to run. Probably the easiest way to do that is to get a signal off the tach line and count the pulses. The signal may not be very nice though so you might want it optically isolated. If your MCU has any hardware counters you could use those, or you could add a frequency to voltage converter and sample the voltage.

That's cool that the TBI has all the sensors included. It's a nice compact package.


C|

Buzo
05-28-2011, 02:43 PM
I removed the stock carb and emissions stuff and checked my adapter plate against the manifold.

http://img715.imageshack.us/img715/4460/holeinmanifold.jpg (http://img715.imageshack.us/i/holeinmanifold.jpg/)

Then removed some material to match the new TBI, also changed the 4 screws for a short ones

http://img600.imageshack.us/img600/8884/matlremoved.jpg (http://img600.imageshack.us/i/matlremoved.jpg/)

And this is the first wiew of the TBI installed, after adapting the "disc" for the accelerator taken from the stock carb. This was the most time consuming activity.

http://img713.imageshack.us/img713/6762/tbiinstalled.jpg (http://img713.imageshack.us/i/tbiinstalled.jpg/)

More pics later...

2oodoor
05-28-2011, 05:00 PM
wow, you are on task dude!

I am surprized the tbi throttle plate clears the partition plenum on the factory intake.

Buzo
05-28-2011, 08:04 PM
http://img685.imageshack.us/img685/462/afterq.jpg (http://img685.imageshack.us/i/afterq.jpg/)

http://img101.imageshack.us/img101/4683/closeupzq.jpg (http://img101.imageshack.us/i/closeupzq.jpg/)

http://img808.imageshack.us/img808/3752/driverside.jpg (http://img808.imageshack.us/i/driverside.jpg/)

http://img3.imageshack.us/img3/6521/passsideh.jpg (http://img3.imageshack.us/i/passsideh.jpg/)

http://img714.imageshack.us/img714/371/topwm.jpg (http://img714.imageshack.us/i/topwm.jpg/)

Buzo
05-28-2011, 08:11 PM
The pump and filter assembly. These guys are going to help me to fire it up...

The fuel pressure regulator is integrated to the TBI, so I have to add a return line. But in the other hand I don't have to guess which is the working pressure of the injector. Everything is OK to run the first functional test tomorrow.

http://img691.imageshack.us/img691/3091/pumandfilterasm.jpg (http://img691.imageshack.us/i/pumandfilterasm.jpg/)

Buzo
05-28-2011, 08:37 PM
Could a Moderator help me to add this pic to my signature Please? I tried in the edit signature option but I couldn't. For some reason none of the smilies to the right or the buttons above work in any screen of the forum. It is only to motivate myself, OK? because this project still can fail...

http://img232.imageshack.us/img232/8262/newsignature.jpg (http://img232.imageshack.us/i/newsignature.jpg/)

Thanks.

Buzo
05-29-2011, 04:32 AM
The first task today will be to acquire the TPS values at several throttle openings, so I can plot the TPS response from Idle to Wide Open Throttle.

The second, which finally includes some fuel, will be to apply a PWM % to the injector, fire up the engine and manually open the throttle until the engine is starving for fuel (just like in the old days when adjusting the mix screw). Capture the TPS and the engine RPMs vs the PWM % applied. Create a table and use it in the software. AND THAT'S IT, hahaha, sure. We'll see.

Buzo
05-29-2011, 05:52 AM
Upps, task 1 was too easy.

The chart represents the output of the Throttle Position Sensor as read by the ECU. I did two full sweeps, the first one was slow so you can notice the graph hessitating during the travel due to my hand not keeping the throttle steady. The second cycle was made a little faster.

Its clear that I am going to need to apply some software filters like averaging the signal or something.

http://img824.imageshack.us/img824/2571/tpssweep.jpg (http://img824.imageshack.us/i/tpssweep.jpg/)

Next...Add some fuel to the mix...

cygnus x-1
05-29-2011, 08:10 AM
That signal looks way too noisy, like something is wrong. Is there a ground loop somewhere?

I can tell you from experience that the fueling at idle will be very sensitive. Any noise in the signals will make the idle unstable. One trick to help with this is to have a flat area in your fuel table where small changes in load or RPM don't change how much fuel is injected. I use 100RPM on either side of the idle RPM and maybe 2-3% of whatever your using to measure load.

However, I suspect you will find that using the TPS signal for fuel control doesn't work so well at idle and low throttle. The problem is that the actual engine load can change significantly even with little or no change in throttle position. Race engines can get away with it because they don't care much about the idle or low throttle. This is why MAP (or MAF) is always preferred for street engines.


You're moving right along though! Keep up the good work!


C|

Buzo
05-29-2011, 02:01 PM
Thans for your comments Cygnus. Found the cause for the noisy TPS signal. I am acquiring all the 10 analog channels at the same time but the rest of the sensors are not yet connected, so I grounded all the unused channels inputs and the noise dissaperared.

I do have the MAP sensor. So as soon as I can make it Idle, the next sensor to add will be the MAP.

The problem I have right now is that the PWM step has not enough resolution (255 steps is enough, yeah sure).

For instance, if I apply 39% of PWM, the car idles but revs up and down from 800 to 100 and so on. then If i increase the PWM just to 39.6% the injector overflows.

So I believe there must be a combination of two PWM signals, or maybe apply 40% for one second and 0% another second, I'll see if one of those ideas work.

For now I'm going to take a another break though.

Demon1024
05-29-2011, 03:22 PM
Dude.... super impressive.

I'd say you got bored lol

I believe the phrase your thinking is "trial and error" ?

cygnus x-1
05-29-2011, 05:19 PM
Ahh, thought so on the noise. I've seen noise like that on data acquisition systems where the grounding wasn't setup properly.


What is your PWM timing like? I don't know what the typical timing for TBI is but I think I would start with a cycle time of 50ms. Then for idling start at 5% on and 95% off. That gives you 2.5ms of on-time, although you need to subtract the dead time from that. You ought to be able to find the dead time for that injector somewhere on the web. Then gradually increase the on-time until it idles. It would also help to know what the injector flow rate is. I would guess around 1000cc/min.


C|

lostforawhile
05-29-2011, 05:43 PM
it seems like a good idea, but why do you want to run a TBI setup, when there is so much info on here about making power with the MPI setup? plus many factory parts can be used

Buzo
05-29-2011, 07:05 PM
... if I apply 39% of PWM, the car idles but revs up and down from 800 to 100 and so on. then If i increase the PWM just to 39.6% the injector overflows...

I am using 12Volts to drive the injector... Can it be a 5V Injector?

I am searching the web and the only manual I could donwload (for free) was the chilton-like manual, so there is not much useful information other than what I though it was a Idle Solenoid is actually an Idle Stepper motor

Buzo
05-29-2011, 07:15 PM
Ahh, thought so on the noise. I've seen noise like that on data acquisition systems where the grounding wasn't setup properly.


What is your PWM timing like? I don't know what the typical timing for TBI is but I think I would start with a cycle time of 50ms. Then for idling start at 5% on and 95% off. That gives you 2.5ms of on-time, although you need to subtract the dead time from that. You ought to be able to find the dead time for that injector somewhere on the web. Then gradually increase the on-time until it idles. It would also help to know what the injector flow rate is. I would guess around 1000cc/min.


C|


I started with a frequency of 250 Hz, then increased to 500, 1000, 1500 Hz and there is the same switch point at 40% of duty cycle with any frequency.

I also started with a timing of 5% On 95% off but the injector does nothing until it reaches 39%, one can see a few fuel drops falling down to the throttle.
The normal though is to increase to 40% but the injector just get wide open (almost) with that 1% increase.

I can't blame the pressure being too high, because the regulator is integrated to the TBI. And my fuel pump is from a 88 Ford Ranger, its a low pressure one.

Buzo
05-29-2011, 07:20 PM
it seems like a good idea, but why do you want to run a TBI setup, when there is so much info on here about making power with the MPI setup? plus many factory parts can be used


The short answer is because a TBI conversion is simpler and cheaper than a MPI conversion.

If I had listened to Cyngus and use a Megasquirt ECU, this set up should be working at this time.

But I choosed the challenge of creating my own ECU. I know all the theory is right, but I think need to read more about this TBI. I assumed a few things, that now I have to go back and investigate.

Buzo
05-29-2011, 08:05 PM
Dude.... super impressive.

I'd say you got bored lol

I believe the phrase your thinking is "trial and error" ?

Exactly, trial and error is what I meant. Thank you.
Today was a trial and error day. Everything I did resulted in error, by the way haha.
It's clear that I need first to make this car to IDLE and start from there.

Next steps:
I am going to need my scopemeter to capture the waveform and make sure the signal to the injector is OK. I can hear it switching and varying with the changes in PWM, but I don't know if the amplitude is being sent OK.

I am going to make my ECU a variable PWM generator, so I need to add an Up and Down Buttons and report out the actual PWM thru the serial port back to the computer, so I can hopefully fine-tune the injector response. Still don't know how to fix that huge step from 39 to 40% PWM)

Since I can't mess with the Idle stepper motor at this time, I am going to remove one of the vacuum caps I added to the TBI ports, to make sure air is entering to the manifold. Then match the fuel quantity for that air mass.

Buzo
05-29-2011, 09:45 PM
Found the injector spec: 2.5 ms on over a 30 ms period! In other words It must be running a 33 hz, not 250...

http://img708.imageshack.us/img708/524/injectorflowrate.jpg (http://img708.imageshack.us/i/injectorflowrate.jpg/)

cygnus x-1
05-29-2011, 10:37 PM
I started with a frequency of 250 Hz, then increased to 500, 1000, 1500 Hz and there is the same switch point at 40% of duty cycle with any frequency.

I also started with a timing of 5% On 95% off but the injector does nothing until it reaches 39%, one can see a few fuel drops falling down to the throttle.
The normal though is to increase to 40% but the injector just get wide open (almost) with that 1% increase.


I think I see the problem. 250Hz is way too fast. That would give you a cycle time of only 4ms. The stock Honda port type injectors (240cc/min) have a dead time of roughly 1ms, so if you were using one of those with your 4ms cycle time, you would need at minimum 25% duty cycle to even get them to turn on. In general the larger the injector, the longer the dead time. Since yours seems to turn on at about 40% duty cycle I would say your dead time is about 40% of 4ms or 1.6ms. Try a frequency around 10-20Hz and see how that goes.

Another possible issue is the injector impedance. If the resistance of the injector is around the 10-14ohm range then it's a high impedance type designed to run directly off the 12V supply. If the resistance is more in the 2-5ohm range then it's a low impedance type and will need a series resistor to limit the current. A series resistor should bring the total resistance up to around 10-12ohms. The other way to deal with low impedance injectors is to use a current limited type driver that applies a higher voltage until the current gets to a set point and then backs off the voltage to keep the current constant.

I would bet that yours is a high impedance type but you should definitely check it.


C|

cygnus x-1
05-29-2011, 10:56 PM
Found the injector spec: 2.5 ms on over a 30 ms period! In other words It must be running a 33 hz, not 250...



Oh, well there you go! LOL! I also see in the spec sheet that it's a peak/hold type injector, which is the low impedance one I was talking about. You could use your PWM circuit to do the peak hold thing but you would need to control the on/off time in software. I think the easiest thing to do for now would be to add a series resistor to limit the current to 1amp. This is exactly the way the stock 3g injectors work.

One other thing I was going to mention is that usually with port injection the injectors are synchronized with the ignition, such that you get for example 1 injection event per engine cycle. With a TBI this won't be so important but it might make the calculations easier. But since that sec sheet mentions a fixed period my guess is that it's not synchronized to the ignition.


C|

Buzo
05-30-2011, 06:56 PM
I'm glad I have not toasted the injector yet, because I was using 12V directly without the series resistor.

So need to do some modificatios to the ECU to meet these new requirements.

I have found a lot of good information about TBIs and ECM's, I also found a memory map where you have different engine speed (rows) vs different engine loads as measured by the MAP sensor (columns). There is also a chart of predetermined idle speeds based on ambient temperature, etc. So I can start creating my tables with my best estimated values and fine tune in the road.

I made a set up in my work bench and installed the TBI over a container and a "fuel tank" (a 5 gallons plastic bottle), so I can continue using the car during the week (I put back the stock carb with the vacuum removed setup).

I can at least look at the spray pattern to determine if it is responding to the PWM variation.

I will also connect the MAP sensor and record its current behaviour.

Thanks Cygnus for all your help and interest in this project.

Buzo
05-30-2011, 08:39 PM
I was reading the story of one guy installing a TBI in a Jeep. Between all the problems he had during the installing and tune up process there was one that made me LOL. There was something wrong with his set up so it was overflowing the manifold, but suddenly after fixing some minor issues with the wiring, the injector didn't want to spray fuel anymore. He spent 3 hours looking for the source of the new problem until he realized he had run out of gas! He finally found the issue was the ECM he bought over EBay. Replaced it and worked OK from there.

The message is that anything can happen during a new instalation like the one I put myself into.

I am thinking in going back to the JY and buy the ECM from this Cavalier, so I can delete all the timing stuff and leave only the gas control portion. I found very detailed schematics to do so. I'll think about it $$$...

Buzo
06-01-2011, 03:11 PM
Bought the Cavaliers ECM. $40 USD + $35 USD I paid for the TBI asm. Still under $100 swap...If it works.

I am about to complete rebuilding the harness and hopefully run a bench test today.

http://img192.imageshack.us/img192/5632/harnessrebuild.jpg (http://img192.imageshack.us/i/harnessrebuild.jpg/)

Buzo
06-02-2011, 01:20 PM
Nothing done yesterday, as soon as I got ready to start, it started raining after 140 days in a row with no rain, so I stop working, sat back, relaxed and enjoyed the rain.

Something I would like to post before the swap:

Fuel economy
Stock carb and emissions control: 24 MPG :)
Stock carb with vacuum removed: 17 MPG :(
Swap to Single Port Electronic Fuel Injection: TBD

Buzo
06-03-2011, 05:28 PM
Everything is connected to the car at this time, but I need ideas as of what signal triggers the ECM to start injecting gas. In other ECM models there is a crank signal, but not in the one I am using.

It has not been easy to figure out the connections to this ECU (1228321) there is very little information about it out there. So I crossreferenced the pinouts to other models and came up with these schematics.

http://img231.imageshack.us/img231/5152/whiteconn.png (http://imageshack.us/photo/my-images/231/whiteconn.png/)
http://img845.imageshack.us/img845/691/blackconn.png (http://imageshack.us/photo/my-images/845/blackconn.png/)

Any idea will be greatly appreciated. I have the clue it is in the distributor signals, but which and how.

Buzo
06-03-2011, 06:33 PM
Here you can find the only schematic I found in the net for this ECM.
http://www.exatorq.com/ludis_obd1/1228321schematic.html

Ichiban
06-03-2011, 07:10 PM
I was thinking of doing something similar to this to my 20R/22R Toyota hybrid. Basically exactly what you're doing.

cygnus x-1
06-03-2011, 07:11 PM
I think you're going to have to find a schematic for the Cavalier ignition system. And then you need to know if the distributor uses VR sensors or something else like hall sensors. The Honda ECU looks for the TDC and the #1 cyl signal to figure out if the engine is cranking. I would imagine the Cavi' does something similar.


C|

Ichiban
06-03-2011, 07:22 PM
http://www.chevythunder.com/gm_throttle_body_injection_pg_1.htm

According to this, wire EST from the distributor triggers injection events. I recently worked on a 4.3 TBI engine that had no spark, no fuel. The Hall effect pickup in the distributor had rusted out severely, killing both the spark and fuel injection. A new distributor solved the problem.

Buzo
06-03-2011, 08:33 PM
http://www.chevythunder.com/gm_throttle_body_injection_pg_1.htm

According to this, wire EST from the distributor triggers injection events. I recently worked on a 4.3 TBI engine that had no spark, no fuel. The Hall effect pickup in the distributor had rusted out severely, killing both the spark and fuel injection. A new distributor solved the problem.

This is going to be the ultimate solution: put the coil and Ignition module from the cavalier into the stock distributor. I have seen guides that shows how to do that.

So far I am trying to use the stock, vacuum distributor and use one of its signals to drive the ECM.

Buzo
06-03-2011, 08:38 PM
I think you're going to have to find a schematic for the Cavalier ignition system. And then you need to know if the distributor uses VR sensors or something else like hall sensors. The Honda ECU looks for the TDC and the #1 cyl signal to figure out if the engine is cranking. I would imagine the Cavi' does something similar.


C|

The only one free manual I found for the Cavalier, have pretty good ecm schematics, except for mine's. And there is this Ignition Module that sends a signal to the ECU called "EST reference pulse Hi" I tryed connecting the tacho signal but the ECM doesn't activate the injector.

Buzo
06-03-2011, 08:52 PM
I was thinking of doing something similar to this to my 20R/22R Toyota hybrid. Basically exactly what you're doing.

From one side I got lucky this ECM does not have the VAT (alarm system that blocks the ECM), where you need to get it reprogrammed before you can start doing anything with it.

If you want to do something similar, go for the model with more aftermarket support and watch for this VAT system.

I can't find any write up online from people using this specific ECM.

So I figured out almost everything by myself, but the last unsolved question is "how the ECM realizes the engine is cranking?"

I wired the SES (Service engine soon light) and the Diagnostics Lamp and I can see the SES turning off when I add some gas thru the throttle and the car fires up. But never when cranking.

Even during those two seconds when the engine is running and the SES is off the injector sprays any fuel.

ShyBoyCA6
06-03-2011, 09:20 PM
Great work! i have a headache from reading about wiring lol. So far im liking where this is going.Keep it up.

Buzo
06-03-2011, 09:46 PM
Great work! i have a headache from reading about wiring lol. So far im liking where this is going.Keep it up.

Hey, thanks and here is one more schematic.
Can you believe that the only signal missing is the EST reference pulse hi? I don't know how that signal looks like, so I can probably emulate it by other electronic mean.

http://img220.imageshack.us/img220/4459/estrefhi.png (http://img220.imageshack.us/i/estrefhi.png/)

I will double check the wiring, sensors, grounds and everything tomorrow.

Buzo
06-04-2011, 07:14 AM
If I momentarily connect the EST Ref Hi input to the Battery+, I make the injector to make one spray and then stops. So it tells me the ECM is waiting the rising edge of a square wave signal to activate the injector.

Well, i have this PCB I built long time ago, it has a PIC1F86A and I can make a square wave signal with it. I will start with ~400 RPMs which is the engine cranking speed I think and use it to tell the ECM the engine is cranking/running.

http://img231.imageshack.us/img231/9343/estrefhisimulator.jpg (http://img231.imageshack.us/i/estrefhisimulator.jpg/)

cygnus x-1
06-04-2011, 08:58 AM
This page describes operation of the GM ignition modules.

http://www.megamanual.com/ms2/GM_7pinHEI.htm

So the pulse from pin R (reference high) is what tells the ECU that the engine is cranking. One way to do this would be to tap off the Honda distributor's VR signal (or maybe the tach signal) and convert that to a square wave pulse, which is essentially what the GM module does. An external pulse source might work too but I bet the ECU uses that signal to determine engine RPM, so a fixed frequency pulse probably won't work.

Is this ECU tuneable?

C|

Buzo
06-04-2011, 09:02 AM
I put the equivalent of a 700 rpm signal and the injector sends fuel and the car was able to start and idle really rough. I couldn't accelerate it by pressing the pedal, so I assume there is some sort of syncrony between the received pulses (engine speed) and the injector PWM.

So a little change in the PIC program to try to clean out the signal of the tacho and make it usable for the ECM.

As I said, If I connect the tacho signal from the stock coil directly to the ECM input, it is not detectable due to excessive noise.

A lot of fun already and it's only 11:00 AM!!

Buzo
06-04-2011, 10:24 AM
This page describes operation of the GM ignition modules.

http://www.megamanual.com/ms2/GM_7pinHEI.htm

So the pulse from pin R (reference high) is what tells the ECU that the engine is cranking. One way to do this would be to tap off the Honda distributor's VR signal (or maybe the tach signal) and convert that to a square wave pulse, which is essentially what the GM module does. An external pulse source might work too but I bet the ECU uses that signal to determine engine RPM, so a fixed frequency pulse probably won't work.

Is this ECU tuneable?

C|

There is very little information about tunning this specific ECU. I have my fingers crossed hopping I don't need to do anything to the memory. It belongs to a 2.0L engine, so I am OK to start.

I finally was able to clean the tacho signal and the car is running and accelerating pretty well. It won't keep Idling by itself but I have read the procedures to improve the idle speed.

Before I continue, I will fix the wiring mess I have to prevent making a short and damage something.

But It's finally working!!!!!!

Buzo
06-04-2011, 02:01 PM
I had run the car for 10 minutes in my driveway and got two error codes
15: Coolant temp high.- I expected it since I wanted to use the stock CTS, I think I need to buy the cavalier's CTS because the resistance vs temp ramps are different.
42: EST circuit fault. I also expected it since I am trying to emulate signals that i am not sure how they are. For instsance, I don't know if there must be a pulse every revolution, or 4 pulses per revolution.

Completed the re-routing of wires, and I will address the low idle speed and upload some pics later today.

cygnus x-1
06-04-2011, 03:22 PM
42: EST circuit fault. I also expected it since I am trying to emulate signals that i am not sure how they are. For instsance, I don't know if there must be a pulse every revolution, or 4 pulses per revolution.


It would be one pulse per ignition event, so every 180 degrees of crank revolution. The distributor turns at half of crank speed so it would be every 90 degrees there. There will also be a minimum pulse width that the ECU can detect, although I have no idea what that might be.

C|

Buzo
06-04-2011, 07:40 PM
I gave this little present to myself.

Buzo's Accord Fuel Injection LX.

http://img842.imageshack.us/img842/9393/fiaccord.jpg (http://img842.imageshack.us/i/fiaccord.jpg/)

Buzo
06-04-2011, 07:48 PM
The fuel pump module upgrade

http://img684.imageshack.us/img684/2980/oldnewv.jpg (http://img684.imageshack.us/i/oldnewv.jpg/)

I am going to put the filter in the engine compartment instead of using the in-tank filter

Buzo
06-04-2011, 08:09 PM
This is the wiring mess I was referring to. It looks complicated, but it is not.

http://img62.imageshack.us/img62/9738/messr.jpg (http://img62.imageshack.us/i/messr.jpg/)

The 10 ohms resistor that saved mi injector's life!

http://img818.imageshack.us/img818/9330/resistor.jpg (http://img818.imageshack.us/i/resistor.jpg/)

The guy that helped me to fire up the car for the first time. It only makes the coil signal perfectly square. four pulses per turn.

http://img850.imageshack.us/img850/7134/timingpcbandbox.jpg (http://img850.imageshack.us/i/timingpcbandbox.jpg/)

Finally something that didn't get complicated. A firewall hole right there where I needed it to be!!

http://img204.imageshack.us/img204/4346/firewallhole.jpg (http://img204.imageshack.us/i/firewallhole.jpg/)

And this is a general view of the engine bay. I forgot to buy the air filter. But there is plenty of room to intall it.

http://img69.imageshack.us/img69/3261/genview.jpg (http://img69.imageshack.us/i/genview.jpg/)

Buzo
06-04-2011, 08:21 PM
I think I never mentioned that I was using this "fuel tank" just with a couple of liters of fuel to run all my testing.
It was until now that the car runs that I finally reworked the fuel pump module and the fuel is sent from the tank.

Still pending to install the return line from the engine to the back of the car.

I am thinking to use the canister line as return line (need to remove the two ways valve) since the canister lost its function anyway.

http://img196.imageshack.us/img196/4339/fueltankm.jpg (http://img196.imageshack.us/i/fueltankm.jpg/)

Buzo
06-05-2011, 08:43 PM
I am thinking to use the canister line as return line (need to remove the two ways valve) since the canister lost its function anyway.


I thought about this and decided to make a returnless system, which means to put the pressure regulator in the tank.

According to Autozone, the cavalier's pressure regulator is 46 PSI or 317 kPa. I have a variable pressure regulator that can be set to that pressure. Then I just need to close the return line in the TBI.

There was no chance to work in the Honda today, so same status: rough Idle and pending to add a bunch of connections from the Stock ECU to the new ECM, now that both are inside of the car.

1) AC signal
2) Speed Pulser (our stock speed pulser gets saturated above 40MPH)
3) Park/Neutral SW
4) O2
5)...

I am going to visit that old cavalier one more time and buy the Ignition Module and why not, the distributor to get the pick up coil.
I need also the CTS to install it in place of the thermovalve C, close to the thermostat.

AccordB20A
06-05-2011, 09:49 PM
awesome project! good to see someones trying something really different! good work

cygnus x-1
06-05-2011, 10:42 PM
I thought about this and decided to make a returnless system, which means to put the pressure regulator in the tank.

According to Autozone, the cavalier's pressure regulator is 46 PSI or 317 kPa. I have a variable pressure regulator that can be set to that pressure. Then I just need to close the return line in the TBI.


One issue you may have with a return-less system is heat. Returning fuel back to the tank keeps the throttle body and injector cool, and keeps the fuel near the throttle body from boiling. The other thing is does is o purge air from the system. When I first did the Megasquirt conversion I tried making a return-less system by using the stock fuel pump in back to feed another high pressure pump in the engine compartment. The high pressure pump circulated fuel around a loop. It sort of worked but as soon as the engine warmed up the fuel in the high pressure loop got so hot that it boiled and got vapor locked. There was also no place for trapped air to go so it just circulated around the loop and kept building up. Basically it was a disaster.

You may not have the same problem with the TBI since the fuel won't be circulating around a fuel rail in close proximity to the head. But it's something to watch for.

If you do end up adding a return line to the tank, you will also need a vent somewhere so that excess pressure doesn't build up as the fuel gets warmer or cooler.


C|

Buzo
06-07-2011, 07:38 PM
The hot fuel is always a problem. Either you deal with the hot fuel in the TBI or you deal with it in the tank. The disadvantage of the return systems is that you are bringing the heat of the engine to the tank. If that returned hot fuel falls close to the pump inlet, then the vapor lock condition can happen.

I installed the in-tank regulator and found the cause for the rough idle: the mix is too rich. I created an intentional-huge vacuum leak in the manifold and the car Idles perfectly -at 1500 RPMs -. I was able to take the car for a ride in the neighborhood and it works nice, strong, responsive. Fires up immediatelly.

I have not bought the CTS yet, so hopefully it can bring the Idle down to 800-900 RPMs.

I investigated more about the tuning procedures for the ECM, but it looks that this ECM 1228321 is not very popular. I don't care. I can buy one of the common ones in the JY if that's needed. Everything else is compatible with any GM ECM.

Now that I saw the cavalier's ECM operating the engine, I am really confident that I can complete my own basic ECM as first planned.

Buzo
06-07-2011, 08:01 PM
I put the stock carb and fuel pump back in the car. :nuts:

I put a home-made Throttle Position Sensor to the stock carb in order to log the TPS, MAP and O2 at the same time, and use those values later as baseline for my (also) home-made ECM.

http://img812.imageshack.us/img812/4120/view3a.jpg (http://img812.imageshack.us/i/view3a.jpg/)

Buzo
06-07-2011, 08:17 PM
awesome project! good to see someones trying something really different! good work

Thanks for your comment! Honestly I am not sure where this is going to end at this time. Everyday I add a new wire, a new sensor, so everyday I get closer to the goal of converting a carbed accord in a reliable-modern car.

2ndGenGuy
06-07-2011, 09:06 PM
This is a really cool project! It's cool to see all your pictures and how you put things together! Very inspiring, and thought-provoking! Makes me wish I knew more about electronics, like signals and the like.

Dr_Snooz
06-08-2011, 07:00 AM
I think the 1227747 is the ECU everyone wants. Mostly because it's highly tuneable for heavily modified engines.

Another awesome project, Buzo! Can't wait to see it finished.

Buzo
06-11-2011, 07:08 PM
Now that I saw the cavalier's ECM operating the engine, I am really confident that I can complete my own basic ECM as first planned.

I finally was able to make the engine run with my own ECM.

What I did was to sense the tacho signal out of the stock coil. I had to filter it because there was some noise in the signal. See how there is a peak in the middle of each pulse.

http://img854.imageshack.us/img854/5973/4000rpms.jpg (http://img854.imageshack.us/i/4000rpms.jpg/)

Here is after the filter was added

http://img822.imageshack.us/img822/2765/fixede.jpg (http://img822.imageshack.us/i/fixede.jpg/)

Once I have a nice square wave output from the tacho, then I just programmed my ECM to open the injector for 5 ms at every falling edge.

The results is that if you press the pedal, the falling edges are more frequent, so the time between one injection of fuel and the other gets shorter, then more fuel is added to the intake manifold resulting in a nice engine speed acceleration that automatically feeds itself.

Buzo
06-11-2011, 07:28 PM
The next step is to control the idle speed with the stepper motor.
Need to define the frequency to use and the number of steps to bring it from open to close and viceversa. That's something that I can do in my workbench and not under the hood of the car though.

After that I will fine-tune the time the injector and Idle motor get open using all the sensors available: MAP, TPS, CTS, MAT, O2, P/N switch, A/C switch, etc. and the best of all, I will use the stock sensors available :)

To make things easier, I am using small microprocessors to make small tasks (they are cheap) for instance, one micro clears the tacho signal, then sends the waveform to another micro which is waiting for the falling edge of the signal to trigger the injector, but it also receives the time it should keep it open from the main micro who is (will be) reading the sensors and sending the info to the laptop.

obdriver6
06-11-2011, 09:31 PM
After reading some of the posts my head started to hurt, :confused: I wish I knew more about electronic and computers. The project looks hard (for me) but it looks like you know what you're doing, keep it up!

Buzo
06-14-2011, 08:52 PM
After reading some of the posts my head started to hurt, :confused: I wish I knew more about electronic and computers. The project looks hard (for me) but it looks like you know what you're doing, keep it up!

Thanks for your comment!

I have been capturing tons of data with the car and the carburetor as baseline to compare the performance later.

This is how the "computer" looks like as intalled in the car (for testing purposes only, of course!)

One lamp was installed (yellow circle) instead of the injector, so I can actually see how the intensity of the lamp changes with the acceleration of the engine. The higher the RPMs, the higher the intensity of the lamp.
I took this pic at Idle so the intensity is very low.

http://img687.imageshack.us/img687/7761/buzoscomputer.jpg (http://img687.imageshack.us/i/buzoscomputer.jpg/)


I also started working in the tunning software, I plan to give it the capacity to "tune on the fly". So no need to remove the chip.

Some of you may find this screen familiar...Yep, its based in an older project of mine.

http://img834.imageshack.us/img834/2741/softwarescreenshot.jpg (http://imageshack.us/photo/my-images/834/softwarescreenshot.jpg/)

Buzo
06-14-2011, 09:15 PM
I would like to clarify that I don't have the TBI installed in the engine at this time, but I do have all the inputs wired to my ECM. And the Lamp is just a visual aid for me to see if the internal sofware is driving the Lamp as commanded. At the same time I see the Lamp, I log the values of all inputs and outputs so I can make graphs and, you know, record what is going on with every sensor and get ready for the real test which is going to be the TBI.

At leas one of the goals I had at the beginnig has been met. I am not bored! I believe I haven't turned my TV on in a month!

cygnus x-1
06-14-2011, 10:32 PM
At leas one of the goals I had at the beginnig has been met. I am not bored! I believe I haven't turned my TV on in a month!


There's nothing on anyway. I have women's beach volleyball on right now, and I don't even like volleyball. Ok, so I suppose I'm just watching the women. :naughty:


Looks like your project is coming along though.


C|

Buzo
06-19-2011, 07:21 PM
There's nothing on anyway. I have women's beach volleyball on right now, and I don't even like volleyball. Ok, so I suppose I'm just watching the women. :naughty:


Looks like your project is coming along though.


C|

hahaha, right. Made a pause just to watch the Copa de Oro soccer games.

Spent some time making sure I always receive the correct RPMs, so added some software filters.

Also completed the PCB to control the IAC motor. When first connected to the batery, the motor will fully extend and then will count some steps back.

http://img828.imageshack.us/img828/4446/iacdriver.jpg (http://img828.imageshack.us/i/iacdriver.jpg/)

Buzo
06-19-2011, 07:37 PM
Here is the Final Computer. Final because it has all it needs to drive the car. I plan to design one single PCB with all three circuits integrated.


1 PIC 16F84 to control the Injector.
1 PIC 16F84 to control the IAC Motor
1 PIC 16F877 to read sensors, send commands to the two boards above and comunicate from and to the Laptop for tuning.

Right now I am working in changing the IAC position and Injector time from the Laptop to the Micro. I have never used before the TX function of the serial port, so I am spending quite of time to understand how it works.

I dropped the Idea of using the GM ECM because I found out it uses a Cranckshaft sensor with 4 pulses and a 5th one at a shorter distance to determine the Cyl#1 position. I also can not tune it due to the lack of information in the net.

Whaterver, as soon as I can "talk" to the Micro of my own ECU I will be able to tune the car on the fly.

http://img26.imageshack.us/img26/7626/computerii.jpg (http://img26.imageshack.us/i/computerii.jpg/)

Buzo
06-19-2011, 08:23 PM
At this time my ECM has a few tables already written as default, I can actually tune the car but I would need to remove the 40 pins IC for each adjustment, so I am waiting until I can change those tables in the screen of my computer and just send the new values down to the IC thru the serial port.

I would consider my project 90% complete at this time. Of course there will be open items, like the cold start tables where I need to wait until the winter, haha, but I foresee myself driving the car with the TBI permanently installed into a week from now.

Buzo
06-20-2011, 07:54 PM
Today was the first functional test, meaning the TBI in the car.

It fires up very nice. It revs up very nice.

It will Idle OK for 5 seconds, then it will start slowly increasing the RPMs by itself until 2500-3000 RPMs when I have to shut the car down.

Once again I lost the ability to read RPMS accurately. It worked OK with a simulated signal, but as soon as I get the real signal from the coil, it fails.

I do not have any sensor connected to the computer yet, I am developing the "default" stage of the software, which should give the ability to drive the car even if the sensors are not present.

But thinking about my statement above, I can correct the Idle issue if I connect the TPS and deal with the RPMs later... Sounds like a good idea.

Question for anybody that knows about alternators:

Is there any wire in the alternator that can give me non-regulated voltage?
Or should I open the alternator to get one of the coils directly?

The voltage generated by the alternator must be proportional to the engine RPMS.

cygnus x-1
06-21-2011, 10:34 AM
It will Idle OK for 5 seconds, then it will start slowly increasing the RPMs by itself until 2500-3000 RPMs when I have to shut the car down.


The only way it could do this is if your idle control valve is opening. You might try disabling that until you get the basic control working first.




Once again I lost the ability to read RPMS accurately. It worked OK with a simulated signal, but as soon as I get the real signal from the coil, it fails.

It's a noisy signal that's for sure, but it's how most ECUs get an RPM signal (that don't use a crank signal) so there is definitely a way. You could check the Megasquirt schematics to see how they do it.




I do not have any sensor connected to the computer yet, I am developing the "default" stage of the software, which should give the ability to drive the car even if the sensors are not present.

But thinking about my statement above, I can correct the Idle issue if I connect the TPS and deal with the RPMs later... Sounds like a good idea.

I can't say with 100% certainty that it won't work, but I think you will find it extremely difficult if not impossible to get the engine to run without some knowledge of the engine RPM and at least one indicator of load, be it TPS, MAP, whatever. The reason is that the fueling requirements vary A LOT with both of these parameters.




Question for anybody that knows about alternators:

Is there any wire in the alternator that can give me non-regulated voltage?
Or should I open the alternator to get one of the coils directly?

The voltage generated by the alternator must be proportional to the engine RPMS.

No to all of the above. The voltage output of the stator (stationary coil) in an alternator varies with the current input to the rotor (rotating coil). More current in the rotor makes a stronger magnetic field, which makes more voltage at the stator. The regulator adjusts the current to the rotor based on the output voltage of the stator, with no knowledge of RPM. If you were to supply a constant current to the rotor and spin the alternator, you would get a voltage out of the stator that is (roughly) proportional to how fast the rotor is spinning. So as engine RPM increases, the regulator automatically supplies less and less current to the rotor so that the voltage stays constant, assuming a fixed load.

Now, there are gizmos out there that can give you a tach signal by looking at the output of the alternator. These are used on diesel engines that don't have a coil or any other electronic means of determining RPM. They work by looking at the frequency of the noise at the alternators output, and have to be calibrated for your particular alternator. You could use something like this but I don't think they are particularly accurate, and it would be kind of the long way around fixing the problem you have.

I think using the coil signal for RPM is the way to go, you just need to get the circuit worked out. And I'm absolutely certain you can do it. :)


C|

Buzo
06-22-2011, 08:41 PM
Thanks for all your inputs Cygnus. You are right in the 100% of your answers.

I learned a lot today.

1) for the same IAC opening, the engine can vary almost 1000 rpms. It depends of how much fuel is injected. I always thought they had to vary together. So what I did was to set one IAC step and captured the range of fuel where the engine runs smoothly, so I can set limits sometime in the future. Did that for several IAC steps.

2) I wrote the software to control the fuel injection with a step of 0.5 % of duty cycle. Its a very long step.

3) I did .5 because I wanted to go up to 100% but I found its not needed, with 20% of the injector open will rev the whole RPMs scale. Something easy to change. I'm going to try with .1% step, but can go lower if needed.

4) My hardware is working perfectly.
Its a matter of fine tune the quantity of fuel vs the IAC openning for Idle, and the Fuel vs TPS Table for acceleration.

5) Got a pro oscilloscope to figure out whats happening with the Tacho signal. With the change to .1% step I can get the car to Idle at the speed I want. With .5 the lower i could get was 1200.

I have spent some time to set limits to the inputs un case of a failure. For instance, what happen if the TPS gets open, or if it gets short. I don't want the engine to fully accererate unexpectedly. I think writing that logic is what I most enjoy.

Buzo
06-22-2011, 08:51 PM
I think using the coil signal for RPM is the way to go, you just need to get the circuit worked out. And I'm absolutely certain you can do it.



C|

Thanks man! I wish I have some more vacation but I don't. So I am working in the car only in the evenings but still on target to be able to drive it again by the weekend.

Oldblueaccord
06-23-2011, 05:49 AM
Thanks for all your inputs Cygnus. You are right in the 100% of your answers.

I learned a lot today.

1) for the same IAC opening, the engine can vary almost 1000 rpms. It depends of how much fuel is injected. I always thought they had to vary together. So what I did was to set one IAC step and captured the range of fuel where the engine runs smoothly, so I can set limits sometime in the future. Did that for several IAC steps.

2) I wrote the software to control the fuel injection with a step of 0.5 % of duty cycle. Its a very long step.

3) I did .5 because I wanted to go up to 100% but I found its not needed, with 20% of the injector open will rev the whole RPMs scale. Something easy to change. I'm going to try with .1% step, but can go lower if needed.

4) My hardware is working perfectly.
Its a matter of fine tune the quantity of fuel vs the IAC openning for Idle, and the Fuel vs TPS Table for acceleration.

5) Got a pro oscilloscope to figure out whats happening with the Tacho signal. With the change to .1% step I can get the car to Idle at the speed I want. With .5 the lower i could get was 1200.

I have spent some time to set limits to the inputs un case of a failure. For instance, what happen if the TPS gets open, or if it gets short. I don't want the engine to fully accererate unexpectedly. I think writing that logic is what I most enjoy.

By thinking about writing a line of code to stop it from running away you just out thought an entire engineering team at Toyota. Congratulations.


wp

cygnus x-1
06-23-2011, 09:12 AM
By thinking about writing a line of code to stop it from running away you just out thought an entire engineering team at Toyota. Congratulations.



:bowrofl:

Of course if the ECU totally locks up it won't help, but still a funny comment nonetheless!

But seriously, you don't need to worry about sudden acceleration just because you lose a sensor or the ECU locks up. The reason is because you need fuel AND air to accelerate the engine. With the the throttle valve in the idle position you can dump in as much fuel as you want and it won't run away. It will just flood and die. Now I should qualify that by saying I'm talking about running the engine with the car in gear. Engine behavior with no load is VERY different from with a load.

This is not to say that a default sensor value is not still a good idea.


And when you say that you can change the engine RPM by changing the amount of fuel with the idle air valve at a particular setting, you've just discovered idle mixture tuning. :) For a given amount of air going in (fixed throttle and idle air valve positions) there is an optimal amount of fuel where the engine will operate most efficiently, thereby producing highest RPM for a given load (even no load). That is the sweet spot that you want to try and tune for. This is exactly how the idle mixture on a carb is tuned, you let the engine idle and tweak the mixture screw until you get the highest RPM (or best vacuum signal as they coincide).


Oh, and I just remembered, there is a recent thread on the MS forums where they found out that they needed more resolution for the calculations that determine the idle air valve position. I don't remember what they started with but they determined that 0.1% worked well and anything beyond that was really no better.


I have to say it's really cool watching you go through this. Fuel injection tuning is one of the coolest things because it covers so many aspects, computers, software, mechanics, physics, speed (lol!). When it all comes together and works it's incredibly rewarding. Especially when you do it all yourself!


C|

Buzo
06-28-2011, 05:58 PM
At this time the car runs as if you had just dropped a NEW carburetor. I Still need to find the propper "electronic jetting" for each load condition.

I spend the last two days writing the code for the Automatic Idle Speed Control, which senses the engine RPMs, compares it against the Target RPMS and decreases or increases the Time the injector is ON at each PWM cycle.
This Routine will run only when the TPS is all the way closed (=IDLE). I will copy the target RPMs for the different temperature tables I have seen in the Megasquirt website and hopefully this routine can just execut it.

I also updated the code to move the IAC and the PWM with a 0.1% resolution, so I should be OK.

Starting next monday I will take another vacation week, so I hope I can finally fine-tune the car.

Buzo
06-28-2011, 06:02 PM
Just for you guys to have an Idea of how the Assembler language looks like, here is a section of my code I described below. I just realized I made comments in the software in english and spanish hahah..




Automatic movlw ~.25 ; Once in Automatic, the Time_ON will be calculated
movwf TMR0
bsf INTCON,TMR0IE
bsf PORTD,1 ; Enciende Injector
Wait_Int_1 clrwdt
btfss Int_Done,0
goto Wait_Int_1
bcf PORTD,1 ; Se ejecuto la injeccion de gasolina durante el nivel bajo

movfw Time_ON ; Injector Open Time x .1ms
call EnviarW
movfw Period ; Periodo o frecuencia para sacar RPMs
call EnviarW
call msgCR

Wait_High_1 clrwdt
btfss PORTB,0
goto Wait_High_1

Count_While_High_1 call PDelay100us
decfsz Decimals
goto Keep_Counting_2
movlw .10
movwf Decimals
incfsz Period
goto Keep_Counting_2
goto Wait_Cranking
Keep_Counting_2 btfsc PORTB,0
goto Count_While_High_1
movfw Decimals
movwf Saved_Decimals

movfw Target_RPMs ; Target RPMs in ms = 28 = 1071 RPMs
subwf Period,W
btfsc STATUS,C
goto Increase ; If Period > 28, increase Injector time
decf Time_ON ; If Period < 28, decrease Injector time
goto Ready_to_go
Increase incf Time_ON
Ready_to_go clrf Period
movlw .10
movwf Decimals
Wait_Low_1 clrwdt
btfsc PORTB,0
goto Wait_Low_1
goto Automatic

Buzo
06-29-2011, 08:48 PM
This is the Temperature (TW or CTS voltage) vs RPMs I assigned.
Based mostly in the performance of my other fuel injection vehicles. I have been observing their start up in the mornings vs a start up after a brief stop and the chart in the screen more or less matches that performance.

I captured this temperature Chart in Jan 19th, so It started at 3 or 4 degrees C up to 80C when the thermostat opens.

http://img580.imageshack.us/img580/8508/tempvsrpmschart.jpg (http://img580.imageshack.us/i/tempvsrpmschart.jpg/)

This is going to be a busy weekend so no more work in the car until next Monday...

Buzo
07-04-2011, 08:13 PM
The car is now working with the GM ECM also, I mean, with the Cavalier's ECM.

The GM ECM was much more easy to implement than building an ECM from scratch. We all knew it hehe.

Neither of the two options are 100% working right now. The engine is wanting to die when accelerating, with both options

The secret to make the GM ECM to work was as simple as reducing the number of coil pulses per engine revolution. Our 3Geez gives 8 pulses per crankshaft turn and the Cavalier gives 7 pulses per turn, where one of them is not equally spaced. I used the small microcontroller PCB to digitally delete one of the pulses. The car does everything at Idle. Slowly reduces RPMs until it stabilizes at 1000. It stays at 1000 regardelss if the car is in shift or in P.

I can drive it, but there is lack of gas between 2000 and 3000 RPMs.

I believe the next step is to login with the Win ALDL program and see how much data I can get and find a way to reprogram this ECM.

I decided to switch back to the GM ECM because I can learn a lot from it and then just implement it in my own ECM.

Buzo
07-04-2011, 08:19 PM
Here is the crankshaft wheel of the Cavalier. The marks are spaced 60 degrees, while ours are spaced 45 degrees.

http://img6.imageshack.us/img6/1760/7xcrankshaftwheel.png (http://img6.imageshack.us/i/7xcrankshaftwheel.png/)

I have the option of adding a wheel in the crankshaft's pulley and a sensor(then I can give the ECM the timing control too), or simulate the signal with a microprocessor which is what I am doing right now, and leave the timing stock.

Dr_Snooz
07-04-2011, 09:23 PM
Admit it Buzo. You're not from this planet are you? You came from Krypton, shortly before it was destroyed.

lostforawhile
07-04-2011, 10:03 PM
just remember to carry an extra GM ecu lol, they have a self diagnostic feature, puff of smoke,burning smell, time for a new one, they are cheap to get though,so a spare is no big deal

Buzo
07-05-2011, 09:53 AM
Admit it Buzo. You're not from this planet are you? You came from Krypton, shortly before it was destroyed.

I just have some spare time... That's it.

Buzo
07-05-2011, 10:04 AM
just remember to carry an extra GM ecu lol, they have a self diagnostic feature, puff of smoke,burning smell, time for a new one, they are cheap to get though,so a spare is no big deal

Actually the ECM was more resistant than I thought. It has two connectors, same number of pins in each one. When I was installing it I connected some pin #s in the wrong connector. The car fired up for 5 seconds and died. Couldn't make it restart. When I discovered the error I though the ECM got damaged, but found the battery signal fuse blown out. I reconnected everything, make up the 7x signal and the car is running.

The computer seems to learn quickly, because I went today for a ride and some problems I saw before (lack of gas at 2000-3000 rpms) are gone.

When there is load in the car, it stays smooth at 900 rpms. But when in Idle, it is switching between 900 and 1000.

There are two possible causes for this:

1) the 7x signal to the ECM is not perfect, it doesn't look like the crackshaft weel, but it is enough to give the correct number of pulses per revolution.

2) I have always have a vacuum leak in the distributor's advance. So the signal the MAP sensor gives to the ECM is constantly changing.

But at the end you are right. Buying one extra ECM should not cost me more than 30 USD. Thanks for the advise!

Buzo
07-06-2011, 07:01 PM
I declare this project a SUCCESS using my home-made ECM!!

I solved the two main problems I had dividing the problem in two:

1) If I try to syncronize the fuel injection event with the pulses of the coild, I could never get below 1500 RPMs because the minimum open time I can give the injector is 2.5 ms.

2) Lack of fuel between 1500-2500 RPMs

So what I did is while the TPS is in IDLE, I do not syncronize the fuel injection event, so I can control the time the injector is open, the time the injector is closed and the position of the IAC stepper motor to get a nice idle speed (with or without load but with the pedal in rest).

As soon as the pedal is pressed, I immediatelly syncronize the fuel injection with the coil pulses, so the PWM is automatically increased as the engine speed increases for a fixed injector open time.

I plan to clean up this thread starting from here, so it may be useful for others

Buzo
07-06-2011, 07:16 PM
This has been my working area since some time ago, but today, finally got the idea that solved the issues.

At this point of time, I can do fuel compensations with the keyboard of my laptop only, for instance, If I see the engine stumbling at idle i compensate the IAC or the Time ON or the Time ON until it stabilizes, (just like if you were adjusting the needle in the old times), write down the numbers and reprogram the chip for those IDLE conditions.

http://img36.imageshack.us/img36/9219/successa.jpg (http://img36.imageshack.us/i/successa.jpg/)

I know megaskirt is still making improvements to their systems, i can keep doing the same while i use my car everyday.

Buzo
07-06-2011, 07:35 PM
By the way Lost... Found a use for the GM ECM: a brick to hold my laptop steady hahaha. (See the pic below if don't get the joke)

cygnus x-1
07-06-2011, 09:32 PM
I know megaskirt is still making improvements to their systems, i can keep doing the same while i use my car everyday.


This is exactly what happens when you have a tunable ECU. Every time you drive the car you end up tuning something. "Just driving" becomes impossible. Pretty soon you'll be planning trips just to "fix that lean spot at 3800 RPM". It never ends. :Owned:


C|

Buzo
07-07-2011, 10:47 AM
Thanks for all your help Cygnus, without your input making this project would be almost impossible, at least I would not finish in the "short" time I did. And you are right, I said finished just because I can drive the car. I made a pretty long drive last night and it worked "normal" all the time. (I can't say worked better yet).

The TBI system is working as I always wanted to (as a start point): No need of any sensor to run, except for the TPS who tells the car if it is idling or not.

The first sensor to add is the O2.
The chart below was taken when my car was 100% stock. I am going to use that O2 signal to find the best combination of air/gas for several IDLE conditions. Then, program the closed loop control.

http://img843.imageshack.us/img843/3427/o2stock.jpg (http://img843.imageshack.us/i/o2stock.jpg/)

Buzo
07-11-2011, 05:54 PM
There are too many variables that affects the fuel mix, the most important is the temperature.

The most difficult part for me was to "play" with the cold start during the mornings, because if the engine won't start at the first try, the engine will be already warmer for the second and third try, so when the engine finally runs, the conditions are already different.

In other words, there is only one chance per day to test the cold start. With cold I mean the morning start, regardless that we are at 90 Fs in the morning.

The second difficulty was to play with two variables at the same time, the Idle Air Control Stepper Motor and the PWM of the injector, varying the two at the same time was really complex.

The solution (thanks to the megasquirt manual) was to set the Idle Air Control oppening from completelly open at -45C to completelly closed when the engine is fully warm.

So the engine temperature sets the IAC position automatically, and then the only one variable left to play with is the Injector.

http://img717.imageshack.us/img717/2631/iactable.jpg (http://img717.imageshack.us/i/iactable.jpg/)

If I would know this before, I had saved myself two or three days of trial and error testing.

I would consider this as the very first step when tuning something, either a purchased ECM, or something you are building/modifying yourself.

Something else important about this chart, is that the Idle conditions are automatically updated with the engine temperature. So the conditions you set will be the same for the following day.

Buzo
07-25-2011, 09:44 PM
After struggling with the morning starts section of my code & hardware, I found out that the problem was due to the battery voltage getting as low as 7V when cranking.

So 7V divided between the 5 ohms resistor and the 4 ohms injector resistance results in not enough voltage to open the injector.

I made a lot of changes to the hardware and software during the last two weeks and could not explain myself why everything worked fine if forcing the input signals, but as soon as tryed to start the car, the injector just won't open.

Reading the megasquirt manual I learned how the 'peak and hold' circuit works and just implemented it in my code and removed the series resistor.

Problem solved. The peak and hold runs at 60% duty cycle when cranking and 30% duty cycle when running.

The red line in the picture shows the coil pulse and the blue one shows the peak and hold function. 1 ms peak of full voltage and then 8 ms of 30% duty cycle (4 volts)

http://img199.imageshack.us/img199/6823/peakhold.jpg (http://imageshack.us/photo/my-images/199/peakhold.jpg/)

Buzo
07-26-2011, 08:14 PM
Start up at High Idle - Done
Smooth decceleration until Idle - Done
TPS Enrichment - Done. Almost perfect, in fact.

I still don't quite understand how the MAP will compensate for the load of the engine.

All I know is that the Value when the engine is not running is 255
The value when idling is 125 (half of above)

So the question is what happen with the vacuum during different acceleration schemes. I have some MAP data captured before but it looks too noisy. (Captured before I fixed my vacuum leak in the distributor)

Does somebody have a chart of MAP vs RPMs that can share with me, please?

Buzo
07-27-2011, 08:56 AM
This is the only MAP chart I could rescue from all the data logs I made. It doesn't say much but the following:

When the engine is off, the MAP reading is at Maximum, as the engine fires up the MAP readings goes down. That's why I put the cranking pulse as reference, to tell when the engine got fired up.

With every pedal acceleration (3 TPS pulses) the MAP reading increases. (but then there is this noise that I don't think its normal)

Need help to understand what happen with the vacuum (MAP) at constant TPS position but when the load is being increased - lets say by climbing a hill in the road.

http://img21.imageshack.us/img21/720/mapvstps.jpg (http://imageshack.us/photo/my-images/21/mapvstps.jpg/)

I'm affraid I need to redo this log just as I said, when climbing a hill, just looking here for some clue. This MAP thing works in logic inverse (always happen to me with vacuum things) so my brain can not process it very well haha.

cygnus x-1
07-28-2011, 12:10 AM
So, I think to understand the significance of MAP (or Manifold Absolute Pressure) it helps to think about what is actually happening in an engine. You can think of an engine as a sort of air pump, that pulls air in through the intake and pushes it out through the exhaust. The purpose of the throttle plate is to control the rate of air flow into the intake manifold and thereby control air flow into the engine's cylinders. In order to have proper engine function (combustion in the cylinders) the fuel injection system needs to figure out how much air is going into the cylinders so that it can inject the proper amount of fuel. A popular way to do this is to measure the pressure and temperature of the air in the manifold and use those to calculate the mass of air that will end up in the cylinders during the intake cycle; assuming that when the valves close the pressure in the cylinders will be roughly equal to the manifold pressure. Once you know the air temperature and pressure, you can calculate the total air mass using the volume of the cylinders and the density of air at the measured temperature and pressure. Once you have the air mass you can calculate the required fuel based on the stoichiometric ratio (air to fuel) for whatever fuel you intend to use.

So, essentially the MAP is what determines how much fuel needs to go into the cylinders during each engine cycle. A consequence of this is that the throttle position really doesn't matter that much. Once you know the MAP the throttle position is largely irrelevant, because it's the manifold pressure that determines how much fuel is needed, not throttle position. The throttle position is also not a very good indicator of how much air mass gets into the cylinders because the flow through the throttle is dependent on the pressure differential between the atmosphere and the inside of the manifold, which changes depending on engine RPM, air temperature, engine load, and other things like plenum volume and intake manifold resonance effects. It's a very complicated system to model.


If you haven't already, it would be good to check out the Megasquirt documentation where they describe the theory of operation, e.g. the fueling equation. The fueling equation is really the heart of what a fuel injection system is trying to do. That is to determine how much air is going into the engine, and then inject the proper amount of fuel based on the air going in.


One other thing that I found useful in understanding this stuff is to forget about "vacuum". Vacuum is an artificial number that is dependent on whatever the atmospheric pressure is, not to mention it's backwards. What you really want to know is the absolute pressure. No air at all (full vacuum) would be an absolute pressure of 0 and normal atmospheric pressure (at sea level) is 14.7PSI, or 100kPa, or 760 mm Hg. So more air pressure means more air will go into the cylinders, which then means more fuel needs to go in as well.


Hopefully the above will help to explain things and not just add more confusion. :)


C|

Buzo
07-29-2011, 04:23 PM
Thanks a lot, the explanation helped me out to put things in order in my mind. I was kind of cycled into this. Thanks for the advise of forgeting the vacuum, so suddenly the MAP became a positive logic I can better process. That was key.

I added today two "new" features to my ECM:

1) Acceleration pump emulation based on TPS's (and/or MAP's) sudden change, so more fuel is injected when sudden TPS changes are detected. Just like the carb's accel. pump.

2) If the engine gets overflooded, I only need to press the pedal 80% of WOT while cranking and the fuel will be cut off, so it gives me the chance to restart the car after a flooded engine(a common thing for me in these days)

The problem I am working on right now is the after crank enrichment value.

If I control it by time, it works OK when cold, but stays too long in a hot restart.

If I control it by coolant temperature, it gets to zero too soon, before the engine can keep up.

So its obvious I need a combination of the two above. This is the best hobby I have ever had. (I left the other (women) hobby behind since I got married)

Buzo
07-29-2011, 08:56 PM
If you haven't already, it would be good to check out the Megasquirt documentation where they describe the theory of operation, e.g. the fueling equation. The fueling equation is really the heart of what a fuel injection system is trying to do. That is to determine how much air is going into the engine, and then inject the proper amount of fuel based on the air going in.
C|

I have this figured out already. I do not have issues when the engine has already run for 10 minutes or more.

Right now as I said in my post below, the task is to define the logic between the first start of the day and the restart after a quick stop in the road.

Its just a matter of getting to the right code that makes desicions based in start up cooling temp to determine the lenght of the after-cranck enrichment.

I really prefer to stay rev'd up for long time than needed, than having my engine killed due to lack of fuel when cold.

I am also thinking in adding a couple of TEMPORAL push buttons to increase/decrease the after crank enrichment, until I can get good numbers for each temp condition. That would be something easy to implement...
I can use my laptop, but somethimes I just get lazy to hook it up to the car.

cygnus x-1
07-29-2011, 11:43 PM
The temperature compensation stuff can be a challenge. My car doesn't go out when it's cold so I've never bothered to tune for colder temperatures.

The MS method for cold starts (all starts actually) is to use a time based after start enrichment. The time can be anywhere from a few seconds to a minute and changes based on temperature. So there are two tables, one to determine how much fuel to add during the ASE period, and another to determine the length of the ASE period. cold starts will use a long ASE period and hot starts use a short period. So it's pretty much what you were describing as a combination of time and temperature.


C|

Buzo
08-04-2011, 08:21 PM
The temperature compensation stuff can be a challenge. My car doesn't go out when it's cold so I've never bothered to tune for colder temperatures.

The MS method for cold starts (all starts actually) is to use a time based after start enrichment. The time can be anywhere from a few seconds to a minute and changes based on temperature. So there are two tables, one to determine how much fuel to add during the ASE period, and another to determine the length of the ASE period. cold starts will use a long ASE period and hot starts use a short period. So it's pretty much what you were describing as a combination of time and temperature.


C|

This was my personal fix for cold start and Hot-restart

The Car always starts at the same IAC openning, but the cooling temperature when the key is first open defines the lengh of the step for the IAC to close. This chart was taken in the car. Started in the morning, wait for the fans to come on, and an immediate restart.

I believe this has been my most brilliant idea for my ECM...

http://img819.imageshack.us/img819/6811/iacok.jpg (http://imageshack.us/photo/my-images/819/iacok.jpg/)

Buzo
08-04-2011, 08:30 PM
I captured some RPMs vs MAP charts to better understand how they react at different conditions


Chart #1.- Taken at start up. Its 2 seconds long.

Chart #2.- Shift in D, brake pressed and accelerating at the same time, The car didn't move, so I just simulated some load in the engine.

Chart #3.- Parking, then moved the shift to D, and back to Parking

Chart #4.- Getting out of my neighborhood. The computer got slow and couldn't take more good data, like hard accelerations, climbing hills or so.

Note that I changed the scales from one chart to another to separate one line from another. The RPMs scale to the left is accurate, while the MAP may have an offset...But the real MAP values are from 0 to 255.


http://img804.imageshack.us/img804/6109/rpmsvsmap.jpg (http://imageshack.us/photo/my-images/804/rpmsvsmap.jpg/)

Buzo
08-04-2011, 08:41 PM
This is how I am emulating the Mechanical acceleration pump of a carb.

The rate of change of the TPS is monitored around 50 times per second. If the change from the current value to the next is bigger than (tuneable value) then open the injector by (tuneable value) extra time

You can see the PWM OUT little squares. They apear only when there is a positive and sudden slopes.

http://img7.imageshack.us/img7/856/accpumpok.jpg (http://imageshack.us/photo/my-images/7/accpumpok.jpg/)

2ndGenGuy
08-05-2011, 03:39 PM
Dude, this is a ton of work! I love reading through this thread. I wish I had something more constructive to contribute. But please keep posting the updates!

Buzo
08-08-2011, 06:17 PM
Dude, this is a ton of work! I love reading through this thread. I wish I had something more constructive to contribute. But please keep posting the updates!

Wow, your coment got just in time, I was asking myself before posting the next graphs if this information would be useful or not, or if I was just filling the forum with some sh...

Thanks for posting, and based on your comment I will keep posting what I have found, so the data is documented in some place other than my computer haha.


Here is a chart of the engine RPMs vs TPS vs MAP in a short trip I made today.


http://img11.imageshack.us/img11/6339/rpmsmaptps.jpg (http://imageshack.us/photo/my-images/11/rpmsmaptps.jpg/)


And here is the same period of time, but only MAP and TPS.
Honestly I don't see any difference other than the MAP changing a lot faster when accelerating than the TPS.

I know Cygnus has told me before that fuel compensation using MAP is more accurate than using TPS, but in reality they are very similar to each other...

http://img29.imageshack.us/img29/2122/maptps.jpg (http://imageshack.us/photo/my-images/29/maptps.jpg/)

Warren 88 Accord
08-08-2011, 06:27 PM
Dude, this is a ton of work! I love reading through this thread. I wish I had something more constructive to contribute. But please keep posting the updates!

^^What he said^^

Buzo
08-08-2011, 06:52 PM
I believe a short video of the TBI working in the car would be nice at this point of time, right?

Even though its toasting outside, I will take a short videoclip during the weekend and will upload it here for your reference.

Buzo
08-08-2011, 07:29 PM
^^What he said^^

Thanks for your comment Warren!

cygnus x-1
08-08-2011, 09:34 PM
Wow, your coment got just in time, I was asking myself before posting the next graphs if this information would be useful or not, or if I was just filling the forum with some sh...


It's definitely interesting watching you go through this, and quite inspiring. You've made enormous progress in a short period of time.




And here is the same period of time, but only MAP and TPS.
Honestly I don't see any difference other than the MAP changing a lot faster when accelerating than the TPS.


That's big part of it actually. The MAP is a lot more sensitive than TPS, especially at low throttle. At higher throttle levels there isn't as much difference. But...



I know Cygnus has told me before that fuel compensation using MAP is more accurate than using TPS, but in reality they are very similar to each other...


Unfortunately when you look at the physics of what is going on (why acceleration/deceleration compensation is REALLY needed), it's far more complcated than just TPS and MAP. At all times there is fuel sticking to the intake manifold walls and also evaporating from the walls. Under static conditions the amounts of evaporation and sticking are the same, so there is no difference in how much fuel is injected vs how much gets into the cylinders. But when you open the throttle, the MAP increases, which makes the fuel evaporate as a slower rate, so for a short period of time there is more fuel sticking to the walls than is evaporating, so you need an extra shot of fuel to make up for this until the sticking/evaporation rates equalize again. Changing engine RPM changes the air flow rate through the manifold, which also affects the evaporation/sticking rates.

Much of the time, you can get pretty good results by using a combination of MAP and TPS based enrichment. But to really get it nailed down you need to use a wall wetting compensation scheme, like what the MS guys call X-tau, or EAE. These methods actually keep track of the fuel on the manifold walls (based on MAP, RPM, and the amount of fuel injected, with some adjustable curves that determine sticking and evaporation rates) so that the injected fuel can be compensated. It's a bitch to tune but when you do get it tuned right it works VERY well.


C|

Buzo
08-09-2011, 04:58 PM
I stole the Megalogviewer software from the megasquirt website and I am using it to view my own logs. Hope they don't care...

I captured a moment where there is a HUGE difference between TPS and MAP

The red circle shows how the TPS remains flat while the MAP starts high, and decreases as the RPMs increases.

With this, I am ready to write the code to add compensation based on MAP changes.

http://img713.imageshack.us/img713/7660/mpams.jpg (http://imageshack.us/photo/my-images/713/mpams.jpg/)

Buzo
08-09-2011, 08:32 PM
...But to really get it nailed down you need to use a wall wetting compensation scheme, like what the MS guys call X-tau, or EAE. These methods actually keep track of the fuel on the manifold walls (based on MAP, RPM, and the amount of fuel injected, with some adjustable curves that determine sticking and evaporation rates) so that the injected fuel can be compensated. It's a bitch to tune but when you do get it tuned right it works VERY well.


C|

Thanks for your comments, everything you said is accurate as usual.
However your last statement is too advanced for me. I only want my car to fire up every time without me pressing the pedal. I want the car to be at the same RPMS always, don't care if it is in P or D or if it is cold or hot, or if I had drove it for 5 minutes or 45 minutes. I want to be able to switch from fuel economy mode to power mode depending on how many beers I have had. That's something my carb was not giving me and I got by switching to my own EFI version. I have also had a lot of fun with this project and I am glad somebody is interested in what I have done so far, and in what's going to happen at the end...

Buzo
08-14-2011, 02:30 PM
I believe a short video of the TBI working in the car would be nice at this point of time, right?

Even though its toasting outside, I will take a short videoclip during the weekend and will upload it here for your reference.

Too short video but enough to show you guys the TBI working in the car.


http://imageshack.us/clip/my-videos/17/etqx.mp4/

Buzo
08-14-2011, 08:10 PM
Edit, I said today I worked fine tuning the acceleration algoritm, but it is actually the CRUISE algoritm...

I am writing my code in Assembler, so instead of making tables which is a little complicated in this language, I am assigning PWM/MAP values a little below from stoichiometric, then just let the O2 to add whatever PWM points are needed to reach the stoich line.

In the first chart, I am not using the O2 Signal to control, (but its being recorded for reference) so you can see how the O2 goes almost to zero when accelerating wich means the engine gets too lean. And it is too rich when idling in a stop sign.

In the second chart, I already added the code for the O2 to compensate the required PWM above and below the stoich line (0.5 Volts) and see how it stays in such mid line in average.

In both charts the O2 readings are in the Secondary (right) axe.

http://img62.imageshack.us/img62/4316/o2comp.jpg (http://imageshack.us/photo/my-images/62/o2comp.jpg/)

Above readings were taken in the same route through the streets of my neighborhood. The first chart with the O2 control disabled and the second with it enabled.

Buzo
08-15-2011, 06:41 PM
I need to fix a couple of problems,

1) There is a Purge Pulse sent each time the key is open. This is useful when starting up in the morning. The Manual says the pulse must be done before start cranking, so I am having fuel odor due to this pulse because sometimes I open the ign key just to open/close the windows and the purge pulse is send to the TBI.

I think I am going to send it at the first cranking pulse instead of at the ignition key open pulse.

2) Having problems to keep the stoich at Idle. For some reason my algorithm (or the engine response) is too slow, so I can feel the engine slightly rev'ing up and down while the closed loop is trying to control the stoich value.

I am going to play with delays, make and adjustment and wait a second until the engine responds.

Besides those two problems everything else is working great. I've been into several rush hours and the car has responded perfect. I will wait until the next tank refill to capture the new fuel economy, whatever it is.

Buzo
08-15-2011, 08:58 PM
It was raining today and took my car for a ride. It ran different at IDLE w/load, almost wanting to die, even though I made a pretty long drive this afternoon with no issues.

I believe its time to work in the Manifold Air Temperature compensation...

Done the purge pulse change I described below, by the way.
The engine is not purged until the first pulse from the coil is received so I am free to open the key at any time. No more fuel odor...Certifyed by my daughter who was the one that detected the fuel smell.

Buzo
08-16-2011, 05:29 PM
The following chart is an XY scatter of the Engine Speed vs the MAP sensor.

This helps a lot to manually build the VE table, since it defines the area where the car will be at at any given time/engine speed, and the areas where it will never be at. So the effort of tunning can be concentrated in such area while the surronding area can be just estimated.

I found a way (a painful way) to make a 16x16 table for the VE in assembler, so its what I am working at right now.


http://img37.imageshack.us/img37/4080/xyscatter.jpg (http://imageshack.us/photo/my-images/37/xyscatter.jpg/)

Buzo
08-16-2011, 05:38 PM
It was raining today and took my car for a ride. It ran different at IDLE w/load, almost wanting to die, even though I made a pretty long drive this afternoon with no issues.

I believe its time to work in the Manifold Air Temperature compensation...


This is the behavior of the Manifold Air Temperature and the Coolant Temperature Sensor during my 20 minutes trip this morning.
It was at 30 C when I fired the car up. Need to think a little bit what would be the best algorithm for MAT compensation and avoid what happened in a raining day

http://img51.imageshack.us/img51/2710/matvscts.jpg (http://imageshack.us/photo/my-images/51/matvscts.jpg/)

Dr_Snooz
08-16-2011, 05:57 PM
That video is awesome! Nice work.

cygnus x-1
08-16-2011, 08:51 PM
It was at 30 C when I fired the car up. Need to think a little bit what would be the best algorithm for MAT compensation and avoid what happened in a raining day



The MAT compensation doesn't need to be complex at all. Just need a compensation factor to multiply against the injector pulse width. The compensation factor would come from a single column table of maybe 4-5 values. You could use more values for better accuracy but you really don't need very many.

However, I would be surprised if you needed very much compensation for air temperature. Coolant temperature is far more important than air temperature in terms of fuel compensation.

I was also going to mention that trying to run with a stoichiometric fuel mixture at idle may not work very well. I know my engine idles far better at about 13:1 than 14.7:1. It might work better to just have a fixed idle pulse width that only gets compensated for coolant temperature. The 'oscillating idle' that you described is a common occurrence when the idle mixture is too lean.


C|

Buzo
08-17-2011, 09:37 AM
... I will wait until the next tank refill to capture the new fuel economy, whatever it is.

Wait a minute!!!!

I know the number and the length of every single (don't want to say 'squirt') so I'll say fuel injection event. So, just need to accumulate the quantity of fuel put into the engine, somehow record the miles or just watch the odometer, divide the two and I'll get the MPGs... Fascinating...

Buzo
08-17-2011, 09:44 AM
The MAT compensation doesn't need to be complex at all. Just need a compensation factor to multiply against the injector pulse width. The compensation factor would come from a single column table of maybe 4-5 values. You could use more values for better accuracy but you really don't need very many.

However, I would be surprised if you needed very much compensation for air temperature. Coolant temperature is far more important than air temperature in terms of fuel compensation.

I was also going to mention that trying to run with a stoichiometric fuel mixture at idle may not work very well. I know my engine idles far better at about 13:1 than 14.7:1. It might work better to just have a fixed idle pulse width that only gets compensated for coolant temperature. The 'oscillating idle' that you described is a common occurrence when the idle mixture is too lean.


C|

For MAT I was thinking in adding 1 or 2 % of the PWM Pulse and do not remove it until the MAT gets to the lower value in the chart I posted. That should take care of the shaking I saw that day. (I will re-deal with that number in winter.)

Now I just need to wait until it rains again ha-ha

Buzo
08-17-2011, 08:09 PM
That video is awesome! Nice work.

Thanks Dr Snooz, I was reading the starting date of this thread/project. It started on 5/23.
Starting this week, on 8/15, the carb is officially in my workbench and the TBI in the car, I daily drive my car from home to work and back with no issues. Edit.- I should say that I made an extensive validation before I drove my car into the traffic, so it has a lot more than 2 days on the top of the intake manifold... But whatever, for documentation purposes, I'll leave 8/15 as the official finish date.

But I just started. I finally could make the 16x16 VE table to work in assembler. So very soon I am going to start filling it just as any professional and costly ECM does.
The O2 is reporting to the computer the lean spots and the address where the PWM% was read from, So I just need to go to that specific address and increase the PWM%, and retest. Easy.
I can finally spend some time in the design of the PCB, so everything is integrated in one single piece instead of 3 seprated boards.

Speaking of the cost, well, I bought the TBI and Sensors for 35 USD, then the Cavalier's CST and fuel pump, another 40 USD... my ECM and components for 50 USD (home made, of course) and almost three months of development x my monthly salary... wow...

Buzo
08-17-2011, 08:28 PM
This is the instant of the car while cranking and the 'Address' line is exactly which table position (from 0 to 255) is being read in that given instant.

So if i want 30& of PWM during cranking, I just need to go to the address 110 and write a '30' (I assume I can write a 30 in the addresses 109 and 111 as well)

http://img233.imageshack.us/img233/7196/vetableaddress.jpg (http://imageshack.us/photo/my-images/233/vetableaddress.jpg/)

This is the same chart, but with a zoom out to see how the RPMs go down nicelly until stabilization. This deacceleration effect can be seen (or heard) in the video.

http://img804.imageshack.us/img804/7148/vetableaddress1.jpg (http://imageshack.us/photo/my-images/804/vetableaddress1.jpg/)


And this is the 16x16 table. Nice view in excel, but in assembler is from 0 to 256 lines. I can work out the RPMs intervals, that's a tuneable option as well.

http://img691.imageshack.us/img691/7015/vetable.jpg (http://imageshack.us/photo/my-images/691/vetable.jpg/)

Does anybody want to start learning Assembler?



; VE Table
ORG 0800h
Tablex256 addwf PCL,F
;************************************************* ***0 PWM 0, MAT 0 to F
retlw 0x7 ; 0 0 0
retlw 0x8 ; 1 1 333
retlw 0x9 ; 2 2 666
retlw 0xA ; 3 3 999
retlw 0xB ; 4 4 1332
retlw 0xC ; 5 5 1665
retlw 0xD ; 6 6 1998
retlw 0xE ; 7 7 2331
retlw 0xF ; 8 8 2664
retlw 0x10 ; 9 9 2997
retlw 0x12 ; 10 A 3330
retlw 0x13 ; 11 B 3663
retlw 0x14 ; 12 C 3996
retlw 0x15 ; 13 D 4329
retlw 0x16 ; 14 E 4662
retlw 0x17 ; 15 F 5000
;************************************************* ****1
retlw 0x7 ; 0 0 0
retlw 0x8 ; 1 1 333
retlw 0x9 ; 2 2 666
retlw 0xA ; 3 3 999
retlw 0xB ; 4 4 1332
retlw 0xC ; 5 5 1665
retlw 0xD ; 6 6 1998
retlw 0xE ; 7 7 2331
retlw 0xF ; 8 8 2664
retlw 0x10 ; 9 9 2997
retlw 0x12 ; 10 A 3330
retlw 0x13 ; 11 B 3663
retlw 0x14 ; 12 C 3996
retlw 0x15 ; 13 D 4329
retlw 0x16 ; 14 E 4662
retlw 0x17 ; 15 F 5000
;************************************************* ****2
retlw 0x7 ; 0 0 0
retlw 0x8 ; 1 1 333....

cygnus x-1
08-17-2011, 09:17 PM
Does anybody want to start learning Assembler?



; VE Table
ORG 0800h
Tablex256 addwf PCL,F
;************************************************* ***0 PWM 0, MAT 0 to F
retlw 0x7 ; 0 0 0
retlw 0x8 ; 1 1 333
retlw 0x9 ; 2 2 666
retlw 0xA ; 3 3 999
retlw 0xB ; 4 4 1332
retlw 0xC ; 5 5 1665
retlw 0xD ; 6 6 1998
retlw 0xE ; 7 7 2331
retlw 0xF ; 8 8 2664
retlw 0x10 ; 9 9 2997
retlw 0x12 ; 10 A 3330
retlw 0x13 ; 11 B 3663
retlw 0x14 ; 12 C 3996
retlw 0x15 ; 13 D 4329
retlw 0x16 ; 14 E 4662
retlw 0x17 ; 15 F 5000
;************************************************* ****1
retlw 0x7 ; 0 0 0
retlw 0x8 ; 1 1 333
retlw 0x9 ; 2 2 666
retlw 0xA ; 3 3 999
retlw 0xB ; 4 4 1332
retlw 0xC ; 5 5 1665
retlw 0xD ; 6 6 1998
retlw 0xE ; 7 7 2331
retlw 0xF ; 8 8 2664
retlw 0x10 ; 9 9 2997
retlw 0x12 ; 10 A 3330
retlw 0x13 ; 11 B 3663
retlw 0x14 ; 12 C 3996
retlw 0x15 ; 13 D 4329
retlw 0x16 ; 14 E 4662
retlw 0x17 ; 15 F 5000
;************************************************* ****2
retlw 0x7 ; 0 0 0
retlw 0x8 ; 1 1 333....




Eeeww. This is why I never really liked programming in assembly. It's just so much easier to do things in higher level languages like C and such. And most compilers are good enough that efficiency of the compiled code isn't an issue. Although quite a bit of the Megasquirt II code is in assembler, since the gcc compiler isn't the most efficient.


C|

Buzo
08-19-2011, 06:05 PM
I finally could make the 16x16 VE table to work in assembler. So very soon I am going to start filling it just as any professional and costly ECM does.
The O2 is reporting to the computer the lean spots and the address where the PWM% was read from, So I just need to go to that specific address and increase the PWM%, and retest. Easy.

This is the Buzo's tuning procedure.

1.-Start the car and wait until the O2 gets hot and ready.
2.-Drive the car while logging the data
3.-Open the log file in excel, identify those address points where the O2 got below AFR
4.-Edit the corresponding address in the table
5.-Retest!

http://img191.imageshack.us/img191/9003/tuningaf.jpg (http://imageshack.us/photo/my-images/191/tuningaf.jpg/)


Where does the VE (or AFR or calibration) table come from?

Its a combination of the RPMS (vertical) and the MAP Sensor (horizontal).

The RPMS are the first digit from 0 to F in hexadecimal (0-15 decimal)
The MAP is the second digit from 0 to F

So if you are cruising at 2500 RPMS your table address will be 74, and assuming you start climbing a hill (and keeping 2500 rpms), the MAP value will move to the right to 79 due to the increased load, giving the car the extra power needed.

So before injecting the fuel, the software checks for the instant engine speed and load and gets the corresponding table address, and such address is like a box containing the time the injector should be open. And the process is repeated every single turn of the crankshaft

The following picture is my current AFR calibration table.

http://img29.imageshack.us/img29/2174/exceltable.jpg (http://imageshack.us/photo/my-images/29/exceltable.jpg/)

Buzo
08-22-2011, 04:44 PM
This is exactly what happens when you have a tunable ECU. Every time you drive the car you end up tuning something. "Just driving" becomes impossible. Pretty soon you'll be planning trips just to "fix that lean spot at 3800 RPM". It never ends. :Owned:


C|

This is actually happening to me right now. In my daily trips I get a 60 MPH highway and I feel some fuel odor from the engine bay (it my be my imagination too). It only happens at high speed. The car responds OK without bugging off or anything.

Since the narrow band O2 is already saturated at that speed, I know it is rich, but don't know how rich it is. So, right now I am planning a trip to someplace with no traffic to be able to slightly reduce the PWM while driving above 60 MPH (with a helper, of course).

All start up, acceleration and cruise settings are already tuned. Only that slight fuel odor I noticed today is pending.

Buzo
08-22-2011, 06:48 PM
Oh-oh, a problem just came up. My power inverter just got damaged and I need it because my laptop's battery lasts for 20 mins or less.

Well, I'm afraid I'll have to drive my backup truck this week :hmph:

87roach
08-22-2011, 07:26 PM
Problems suck :( sorry to hear about that.

Buzo
08-27-2011, 04:33 AM
Problems suck :( sorry to hear about that.

Still have not had chance to buy a new power inverter.
Instead, I invested some money this week in a brand new coil and the guy at autozone asked me, Is your car carbureted or FI? and I hesitated about my response.

My car is actually Fuel Injection now, so I am wondering what the differences are between a coil for a Stock FI and a coil for the carbureted cars.

I bought the coil that match my distributor, so I bought the carburetor type coil.

And I have been using my computer and logging data for the time the battery lasts. I have been able to use the data to tune my car and develop a process to do so. I started from guessing the table numbers and testing by accelerating the engine in my garage and now the car is correctly tuned for a highway drive.

Buzo
08-27-2011, 04:58 AM
This picture is really interesting.

Its a chart of the TPS (ADDRESS line) compared vs the MAP (MAP line) respectively against the RPMS.


So both TPS and MAP give a Voltage value from 0 to 5 V which is measured by the ECM as 0 to 255 steps (0 to FF hexadecimal)

To make my explanation simple**, I divided 255/16 to get the step of my 16x16 table, so if a 15 is read from the ECU, it will return a 0, if it reads 30, it will return a 2, if it reads a 33, it will return a 3, it it reads 254 it will return a 15, etc.

So I assigned the same steps for the MAP and the TPS and put them in the X axis, and compared both to the RPMS in the Y axis (I divided 8000/16 to calculate the RPMS steps)

Hard to explain, but the conclusion here is that Compensating by MAP or TPS is exactly the same!!

As you see in the chart, they change almost together as the engine accelerates. This is contrary to what we have said before here in this thread, where we said that compensating using the MAP was more sensitive, but it isn't. The address where the quantity of fuel will be read from, changes at the same time in the TPS table than in the MAP table.

Of course there is one advantage using the MAP instead of the TPS, the TPS is a mechanical device that can give false contacts and the MAP is a contactless device.

MAP and TPS are directly proportional.

http://img705.imageshack.us/img705/720/mapvstps.jpg (http://imageshack.us/photo/my-images/705/mapvstps.jpg/)


** In reality any of the MAP or TPS change from 0 to 255, they are more or less from 20 to 230, so I divided the real range by 16, and that's why they got the accuracy we see in the chart.

Buzo
08-27-2011, 08:38 PM
OK, my car is working with the TPS signal as driver to determine the quantity of fuel needed for each driving conditions. It is working great, but I want to exercise my tuning procedure so I am going to practice it by switching to a MAP-driven system.

Let's see how well I learned to tune my own system though. I will start tomorrow morning and count the time it takes me to tune a car from scratch.

I'll start with this Table, all filled with 10's which is equal to 1+10*.104 = 2.04 ms of injector open time. (this equation comes from the Peak and Hold system, 1 ms is the peak and one complete hold cycle is executed in .104 ms)

If the engine idles at 1000 RPMS, each injection will occur every 30 ms
So, 2.04/30 = 6.8% of PWM - Good enough to keep any engine idling.

All the cranking, cold start, after crank and warm up enrichment will remain the same as my TPS system, so the real tuning will start after the car is warmed up.

This is the Table to begin tuning the car. The ranges of the RPMS are the same as the TPS, and the The Ranges of the MAP were determined from previous logs:

http://img89.imageshack.us/img89/395/mapcomp1.jpg (http://imageshack.us/photo/my-images/89/mapcomp1.jpg/)

Next is to wait until tomorrow morning. I will document here every step and will be filling the above table with the correct values per my tuning procedure.

Buzo
08-27-2011, 09:03 PM
Once the ranges are set in the software I don't need to worry about the individual MAP and RPM values, since the software gives the resultant Address by combining the two signals.

RPMS=1000, MAP=80 ADDRESS=22
RPMS=2331, MAP=149 ADDRESS=69, and so on.

The computer is going to be reporting the calculated ADDRESS and will send the number found in such table address.

There must be a way to keep the pedal steady, in my case I am going to use the nut of the accelerator cable to set one rpm range at the time.

With the laptop's keyboard I can increment or decrement the value that is being read in the resultant address. In the case of the MAP system, once you add or substract fuel, the address will start jumping, so need to keep trying until a steady speed can be achieved, then look the O2 reading in the computer and add or substract again until the O2 is in the mid-range.

Just Write down that number and address to update the table later.
The most addresses found the better, however, with one single address achieved, the surrounding values can be estimated. So its OK to capture one address in the line 1, and one in the line 4, etc.

Once the table has the basic numbers, it will be time for a ride while logging ( or log while driving).

With a 20 minutes log I will be able to fine tune some more addresses values.

I didn't expect this, but I found a lot of linearity in the behavior of this fuel injection system.

Buzo
08-27-2011, 09:33 PM
Before I forget, I need to disable the closed loop control while looking for table addresses and values, The closed loop control is the O2 moving the quantity of fuel being injected in an effort to keep it at stoich. The O2 has a limited range, it can add or substract +/- 5 only, so if it is too rich, the O2 can not lean it out. That's why the importance of getting the most accurate values in the table.

Micro-controller burned with the new table and closed loop control disabled!
Time to go to bed!

First thing I noticed in my first test in the morning was that I should disable the acceleration pump as well.

Buzo
08-28-2011, 09:04 AM
Its 10:30 in the morning and my car is now calculating the fuel using the MAP signal instead of the TPS signal.

It took me 2 hrs to start from a scratch table to something driveabable including hard accelerations.

The engine follows two acceleration paths, one is when you are accelerating in your driveway (Parking/Neutral) and another when accelerating in the street (Driving ).

When in P/N the table follows the RPMs 1 to F and the MAP stays in 1 or 2.
So the table places 10, 11, 12, to F0,F1,F2 must be filled with small values for acceleration without load. This path is used for de-acceleration as well.

In order to simulate some load and bring the MAP out of the 1's and 2's I put the shift in D and accelerate while pressing the brake pedal at the same time.
Then I could add fuel in the Addresses 24, 35, 37 and 49

With those four values, the rest of the table can be estimated.

Of course longer drives will be required to fine tuning, but at this time you can ride the car and it will not cof or anything.

This is the log for the short ride after I built the table.

As you can see, there is no lack of fuel in any place during the accelerations.
There may be excess of fuel, but we will work that out later.

http://img846.imageshack.us/img846/9389/map1oc.jpg (http://imageshack.us/photo/my-images/846/map1oc.jpg/)

Buzo
08-28-2011, 02:38 PM
This is an example of what is what we are looking for...
In the red circles are bad spots where there is a huge step in the % of PWM in this case.
You can feel the engine when you cross that spot.

So you know from which table address needs to be reduced and surrounding areas smoothed out.

This was an acceleration log in the driveway. Those Spots have been Fixed already. I ran the car with this brand new program for half an hour and didn't bother to connect the laptop. I used my 5 senses to determine the car is working great.

http://img546.imageshack.us/img546/9566/badspots.jpg (http://imageshack.us/photo/my-images/546/badspots.jpg/)

Buzo
08-28-2011, 06:57 PM
A view of the car and tuning software this morning, and the computer in its metal case with an opening to change the micro-controller. It is normally installed under the glove box, but I put a long pigtail to be able to put it in the seat while debugging a program.

http://img849.imageshack.us/img849/2618/tuningsetup.jpg (http://imageshack.us/photo/my-images/849/tuningsetup.jpg/)


http://img824.imageshack.us/img824/5413/compuz.jpg (http://imageshack.us/photo/my-images/824/compuz.jpg/)

Buzo
08-29-2011, 07:42 PM
Thanks for all your help Cygnus, without your input making this project would be almost impossible, at least I would not finish in the "short" time I did. And you are right, I said finished just because I can drive the car. I made a pretty long drive last night and it worked "normal" all the time. (I can't say worked better yet).

The TBI system is working as I always wanted to (as a start point): No need of any sensor to run, except for the TPS who tells the car if it is idling or not.

The first sensor to add is the O2.
The chart below was taken when my car was 100% stock. I am going to use that O2 signal to find the best combination of air/gas for several IDLE conditions. Then, program the closed loop control.

http://img843.imageshack.us/img843/3427/o2stock.jpg (http://img843.imageshack.us/i/o2stock.jpg/)

This is the Oxygen Sensor reading when my car was stock.

...And this is my car with TBI as of today. Pretty close, uh?

http://img594.imageshack.us/img594/7952/closedloopcontrol.jpg (http://imageshack.us/photo/my-images/594/closedloopcontrol.jpg/)

I have the closed loop control disabled when the pedal is in rest position. It used to be to slow and I noticed the engine rev'ing up and down, but now it is fast enough to keep the speed pretty stable. I will enable it later so the graphs will look even more similar.

Buzo
08-31-2011, 09:20 AM
This is me and my car with TBI in a rush hour.
Engine vibrating at low RPMS? No more!!

http://img189.imageshack.us/img189/9338/buzoinarushhour.jpg (http://imageshack.us/photo/my-images/189/buzoinarushhour.jpg/)

A video of the car accelerating coming soon!!

Buzo
09-02-2011, 04:58 PM
I believe its time to reconnect the canister.

My tank has been building some pressure, and a failure can occur. It also changes the pressure of the injector, so I don't know whats going to happen with my calibration after I relieve the pressure.

First thing I got to do is to run a real return line from the engine to the tank. I used the canister line as a return because it was not being used anyway.

I need to go back to the old carburetor schematics and see which thermovalves were used by the canister to decide when to purge.

Or maybe somebody already knows when its good time to purge the canister that can help me out with some ideas. The TBI has an input for the canister vapors where I can discharge it through. I only need to know when and for how long to apply vacuum to the canister's valve.

Buzo
09-06-2011, 06:52 PM
Still have not had chance to buy a new power inverter...

What the heck, if I was able to build a ECM why not building a silly power inverter?

I just completed it today, still some heat sinks and a fan needed, but it works.
I can finally complete the calibration table at high speeds.

http://img215.imageshack.us/img215/8599/buzospowerinverter.jpg (http://imageshack.us/photo/my-images/215/buzospowerinverter.jpg/)

87roach
09-06-2011, 07:01 PM
Haha that's very cool man! Are you going to make a box for it or something with a more secure plug at least?

Keep up the great work.

2ndGenGuy
09-06-2011, 07:36 PM
You make this all look too easy! Haha! I need to go back to school...

Buzo
09-06-2011, 07:48 PM
...
Something I would like to post before the swap:

Fuel economy
Stock carb and emissions control: 24 MPG :)
Stock carb with vacuum removed: 17 MPG :(
Swap to Single Port Electronic Fuel Injection: TBD

I was dying to auto-respond this comment.

Swap to Single Port Electronic Fuel Injection: 22 MPG. (City drive).

Measured with the normal system, start with an empty tank, put some measured fuel in the tank and reset the odometer, then divide the two when the tank gets empty again.

And I'm still running open loop (rich) while the pedal is released. Its clear I can improve that 22 by making a better routine for idling. This is something I would like to ask the megasquirt guys, I mean, how they do it. Because i have tried several ways and none seems to work fine.

So far 22 is more than enough, besides of course the elimination of the shaking when cold and high revs when hot.

Buzo
09-06-2011, 08:00 PM
Haha that's very cool man! Are you going to make a box for it or something with a more secure plug at least?

Keep up the great work.

Thanks for your comment! Yes, I will put everything in a box with a fan. All you see in the pics was already available at my house. Too many years in electronics makes you store components "just in case" and here is the result, a freebie power inverter and 30 bucks (assuming the cheapest one) back to my pocket to be better spent in :beer:

Buzo
09-13-2011, 10:20 AM
I have one problem that I have been unable to solve:

The system gets too lean when i take a U turn, so I feel like lack of power for a couple of seconds and then the car resumes to normal power.

If I take the U turn with calm, I don't see the effect, but if a car is getting close and I need to take the U and accelerate, then i notice the problem.

This has nothing to do with the level in the fuel tank, because it was my first guess and I refilled the tank and the car did the same.

everything else, like accelerating in a straight lane is normal. So its clear the car needs more power when the wheels are turned to one side.

I can not solve it because the table addresses (MAP vs RPMS) involved in taking the U turn are the same for cruising, so if I make those addresses more rich, I will run richier when cruising too.

I am still looking for what's different in the data log when taking the U turn so I can add a special enrichment for that situation.

The picture shows the log when making the U-turn. the O2 going to zero and the RPMS with a little hesitation there due to the lack of fuel.

http://img835.imageshack.us/img835/5388/uturn.jpg (http://imageshack.us/photo/my-images/835/uturn.jpg/)

87roach
09-13-2011, 11:21 AM
Well that's a pickle, not even sure what would cause that.. let us know what you come up with.

lostforawhile
09-13-2011, 11:33 AM
I have one problem that I have been unable to solve:

The system gets too lean when i take a U turn, so I feel like lack of power for a couple of seconds and then the car resumes to normal power.

If I take the U turn with calm, I don't see the effect, but if a car is getting close and I need to take the U and accelerate, then i notice the problem.

This has nothing to do with the level in the fuel tank, because it was my first guess and I refilled the tank and the car did the same.

everything else, like accelerating in a straight lane is normal. So its clear the car needs more power when the wheels are turned to one side.

I can not solve it because the table addresses (MAP vs RPMS) involved in taking the U turn are the same for cruising, so if I make those addresses more rich, I will run richier when cruising too.

I am still looking for what's different in the data log when taking the U turn so I can add a special enrichment for that situation.

The picture shows the log when making the U-turn. the O2 going to zero and the RPMS with a little hesitation there due to the lack of fuel.

http://img835.imageshack.us/img835/5388/uturn.jpg (http://imageshack.us/photo/my-images/835/uturn.jpg/)

is it a low speed turn? most FI Hondas use a sensor on the power steering pump to increase idle speed with the ecu when the pump pressure goes up, I can't remember if the three g has a pump pressure sensor or not

2ndGenGuy
09-13-2011, 12:33 PM
Have you checked for puddling in the intake manifold under your throttle body? I have noticed it when you swap out to a Weber Carb sometimes, and I think it actually causes this puddle to slosh over to one of the cylinders under hard cornering. I dont know if maybe the steep bend going to the runners causes it or not. Perhaps its another reason the stock Carb has a spacer and the heater there to help reduce that and improve the emulsification to prevent puddling. Maybe a throttle body spacer could help in this case.

cygnus x-1
09-13-2011, 01:16 PM
You have a fuel starvation problem somehow. The O2 sensor reads full lean in that log. You're certain that it only happens when you turn, and not when you apply the same acceleration in a straight line?

I don't remember now, how do you have the fuel system setup? Are you still using the stock fuel pump or the one from the Cavalier? Do you have a return line back to the tank? If the fuel pickup is always submerged even when turning, then there may be an intermittent electrical problem that causes the pump to shut off momentarily. Or it could be with the injector itself not turning on.

I think first I would make sure that the pump and injector are getting consistent power. If you can measure the current draw of the pump you can also get an idea if it's sucking in air. The current draw should drop significantly if that happens. If you can rig up a fuel pressure gauge to watch while driving that might be helpful.


C|

Buzo
09-26-2011, 07:32 AM
I had a very busy weekend working in the car. No chance to even update this thread.

As a summary this is what I did:

1) Forgot about adding a return line from the engine to the tank and used my original idea of a returnless system.
So added a stronger fuel pump and a 317 kPa pressure regulator inside the tank. This of course changed the injector's flow so I had to re-calibrate my fuel tables. I also changed the tiny filter attached to the tank and replaced the little wire clamps with screw clamps all the way to the engine.

2) I updated my ECM with an optoisolator to avoid the coil spikes to induce noise in the tach reading. I was using a 5V zener to limit those spikes, but the optoisolator thing is a proven system. (Thanks MS).

3) Getting more and more practice tuning the system, so with one single log I can estimate most of the table values.

4) I am currently working in an autotune routine, so it basically will do what I do manually: look at the graph and highlight those points crossing the stoichiometric zone to later update the fuel tables with such values.

Buzo
09-26-2011, 07:40 AM
is it a low speed turn? most FI Hondas use a sensor on the power steering pump to increase idle speed with the ecu when the pump pressure goes up, I can't remember if the three g has a pump pressure sensor or not

Based in your comment here I added a new test to my tuning procedure.
When Idling, (when in park and D) I turn the steering wheel left and right and at the same time look at the engine load through the MAP sensor. The engine load increases in the extremes, so I add some some more fuel in those table addresses affected by turning the wheels.
Thanks for your input. It is the easiest way to add load to the engine while tuning it.

Buzo
09-26-2011, 07:52 AM
Have you checked for puddling in the intake manifold under your throttle body? I have noticed it when you swap out to a Weber Carb sometimes, and I think it actually causes this puddle to slosh over to one of the cylinders under hard cornering. I dont know if maybe the steep bend going to the runners causes it or not. Perhaps its another reason the stock Carb has a spacer and the heater there to help reduce that and improve the emulsification to prevent puddling. Maybe a throttle body spacer could help in this case.

I need to finish tuning the car, there are still rich spots that can cause puddling and now that you told me what the puddling can do, I will pay more attention to that. I was more worried for the lean spots than for the rich ones. But both cases can cause problems as I just learned.

Buzo
09-26-2011, 07:59 AM
You have a fuel starvation problem somehow. The O2 sensor reads full lean in that log. You're certain that it only happens when you turn, and not when you apply the same acceleration in a straight line?

I don't remember now, how do you have the fuel system setup? Are you still using the stock fuel pump or the one from the Cavalier? Do you have a return line back to the tank? If the fuel pickup is always submerged even when turning, then there may be an intermittent electrical problem that causes the pump to shut off momentarily. Or it could be with the injector itself not turning on.

I think first I would make sure that the pump and injector are getting consistent power. If you can measure the current draw of the pump you can also get an idea if it's sucking in air. The current draw should drop significantly if that happens. If you can rig up a fuel pressure gauge to watch while driving that might be helpful.


C|

Consistent power is exactly what I am trying to achieve by switching to a new fuel pump and regulator. I know pretty well how a hard bend in a fuel tube can easily add 5 kPas restriction, so even though I was using the cavalier's fuel pump and regulator, the fuel lines configuration is not the same in my car.

Its time for more u-turn testing, so hopefully that problem is gone with the new fuel supply system.

Buzo
09-26-2011, 08:05 AM
Well that's a pickle, not even sure what would cause that.. let us know what you come up with.

Thanks for following the progress. Still a lot to do until I can get this system right.

87roach
09-26-2011, 06:25 PM
You are a very thorough fellow, the accord is in good hands :D

Buzo
09-27-2011, 08:28 PM
Consistent power is exactly what I am trying to achieve by switching to a new fuel pump and regulator. I know pretty well how a hard bend in a fuel tube can easily add 5 kPas restriction, so even though I was using the cavalier's fuel pump and regulator, the fuel lines configuration is not the same in my car.

Its time for more u-turn testing, so hopefully that problem is gone with the new fuel supply system.

Yep, the U-Turn problem is gone. It may be the better position of the new strainer inside the little bucket in the tank or I don't know, but same U-turn places, same speed as before and the car not longer hesitates.


And I finally could keep the car in the stoichiometric zone when idling.
Thanks again to the MS site, I read how they wait 8 engine cycles before doing the next correction. Just implemented it in my code and here is the result. A flat O2 reading instead of the "Honda style" switching from zero to 0.8 V and back at high speed.

http://img703.imageshack.us/img703/1162/o2right.jpg (http://imageshack.us/photo/my-images/703/o2right.jpg/)

Buzo
09-27-2011, 08:36 PM
You are a very thorough fellow, the accord is in good hands :D

Thank you! This is an example of what one can do with some spare time.

Hazwan
10-04-2011, 06:00 PM
Moar updates!

Buzo
10-10-2011, 06:30 PM
I've been busy translating my code from Assembler to C.
Used to program in C a few years ago and just had to re-learn the modern compilers.

I also created this table in the tuning software, unfortunately I don't have a picture when its actually working in the car, but it displays the Average O2 reading along your trip for each RPM/MAP combination. So its easy to identify lean or rich spots.

http://img36.imageshack.us/img36/5475/3geezecm.jpg (http://imageshack.us/photo/my-images/36/3geezecm.jpg/)

Buzo
10-12-2011, 08:43 PM
My new ECM version is now programmed in C. I also updated the Microcontroller to the 16F887, same processing capability than the one before, but this is running at 8Mhz with no startup issues. (sometimes, I opened the key and saw no activity in the ECM after 5 or 10 seconds. The problem was related to the microcontroller design itself, so that was the driver to get the newest micro)

I also found that programming PICs in C is much less painful than programming in assembler, a lot of functions out there already written and ready to use.

I made a type of simulator where you can create the coil pulses throughout all the engine RPMS range, just to make sure the software doesn't get lock up, and to avoid the need to rev the engine up to the redline during testing.

Everything is ready for this upgrade. There were no hardware changes involved, by the way.

Buzo
10-17-2011, 06:37 PM
This is how the O2 average helps to tune the car.

The Ideal situation would be to read 0.5 in every single cell, but I had the O2 closed loop control disabled when made this run, so my car is set rich and the O2 pulls the mix down.

Anyway, I just wanted to show you the underlined cells, the average for those cells is lower than 0.5, meaning lean spots.

What I have to do is to go to the fuel table and increase the PWM baseline for those addresses. I usually increase the PWM by 5 or 10 (X50 u-secs).

http://img266.imageshack.us/img266/9515/o2average.jpg (http://imageshack.us/photo/my-images/266/o2average.jpg/)

Buzo
10-17-2011, 06:46 PM
And this shows how many time each cell has been "visited" during the same run than below.

The squares show how the RPMS and engine load change just by moving the shift from Park to Drive.

Those addresses are the ones to tune for Idle speed.

http://img706.imageshack.us/img706/7885/parkneutralares.png (http://imageshack.us/photo/my-images/706/parkneutralares.png/)

Buzo
10-19-2011, 07:31 PM
I've been thinking during this week in the Automatic Idle Speed control algorithm.

Currently I use my computer to put the Idle speed where I want, the IAC stepper motor moves one turn in when the key '5' is pressed and one turn out with the key '6'. I'm about to add two push buttons in the dashboard so the computer won't be needed (I plug it everyday anyway for data logging purposes). I do have a default IAC position for start up and slowly closes with the coolant temp, but it is not exactly an automatic control.

Anyway, I am posting this to ask for advises of how "other" systems control the IAC.

For example:

You can assume you are Idling while the pedal is released. Then I read the rpms once per second, compare against the target rpms and adjust the IAC accordingly. Easy.

But what happen when you are deaccelerating? you release the pedal, but your rpms are higher than Idle because your car is moving, so the IAC will try to reduce the rpms...by the time you stop, the IAC will be completely closed and will kill the engine.

So I can not use the pedal position alone to trigger the IAC adjustment.

I am afraid I need to add the speed sensor, so I can tell the ECM to adjust the IAC until the pedal is released AND the car is not moving.

Actually I just got and idea... I have never adjusted the screw for minimum Idle speed, so my IAC valve must be ~5 mm open to get ~900 RPMS. If I open the throttle plate with the screw, it will not care is the IAC gets closed all the way...

cygnus x-1
10-20-2011, 09:47 AM
You can assume you are Idling while the pedal is released. Then I read the rpms once per second, compare against the target rpms and adjust the IAC accordingly. Easy.

But what happen when you are deaccelerating? you release the pedal, but your rpms are higher than Idle because your car is moving, so the IAC will try to reduce the rpms...by the time you stop, the IAC will be completely closed and will kill the engine.

So I can not use the pedal position alone to trigger the IAC adjustment.



You need to watch throttle position and RPM. Closed loop idle control would kick in when throttle position is closed and the RPM is below say 1200. That way it will only activate when you have decelerated to a near stop.

I think you will need to sample the RPM far more frequently though, like maybe 10 times a second. Otherwise it will oscillate. I think usually a PID algorithm is used, with RPM as feedback and IAC valve as control. For fuel control at idle I think I would have it set at a fixed value (somewhat rich too) and not use closed loop control, at least until you get the idle air control working well. Otherwise the closed loop idle air and closed loop fuel control may fight each other.


I like the Labview tuning panel. You've essentially duplicated Megasquirt's TunerStudio program. ;)

C|

Buzo
10-20-2011, 05:37 PM
I found the solution for this problem.

a picture says more than a thousands spanglish words.

http://img37.imageshack.us/img37/1870/howtob.png (http://imageshack.us/photo/my-images/37/howtob.png/)

Above data log says that the MAP and Pedal position can be used together to determine when the car is at full stop, so the IAC can be adjusted only when those two signals are in the shown range.

And this picture shows how the code can be implemented, comparing the "addresses" resulting of the combination of the RPMS and MAP

http://img546.imageshack.us/img546/1108/solutionp.png (http://imageshack.us/photo/my-images/546/solutionp.png/)

Buzo
10-20-2011, 05:48 PM
You need to watch throttle position and RPM. Closed loop idle control would kick in when throttle position is closed and the RPM is below say 1200. That way it will only activate when you have decelerated to a near stop.

I think you will need to sample the RPM far more frequently though, like maybe 10 times a second. Otherwise it will oscillate. I think usually a PID algorithm is used, with RPM as feedback and IAC valve as control. For fuel control at idle I think I would have it set at a fixed value (somewhat rich too) and not use closed loop control, at least until you get the idle air control working well. Otherwise the closed loop idle air and closed loop fuel control may fight each other.


I like the Labview tuning panel. You've essentially duplicated Megasquirt's TunerStudio program. ;)

C|

This panel has been really useful, in a couple of trips I have my car almost perfectly tuned.

I read all the signals once every 2 ms and RPMS once per engine turn. What I meant with read RPMS every second was to actually move the IAC and wait one second to let the engine respond to the new IAC position.

But I found that 1 second was too long so now I wait only 100 ms and it is working great.


Again, this is the screen of how many times one RPM/MAP address has been visited during my 30 minutes trip today. The horizontal addresses corresponding to my target RPMS were the most visited.

http://img842.imageshack.us/img842/5500/idlespeedready.png (http://imageshack.us/photo/my-images/842/idlespeedready.png/)

Buzo
10-22-2011, 03:57 PM
OK Buzo, don't be f****** lazy. Remove the seat and run a wire from the speed pulser to the ECM. Your ECM deserves to have the ability to know when the car is moving or at full stop. I mean, the speed sensor is already there. Can't be more easy. (Please ignore me, just getting myself motivated :) )

cygnus x-1
10-22-2011, 11:18 PM
OK Buzo, don't be f****** lazy. Remove the seat and run a wire from the speed pulser to the ECM. Your ECM deserves to have the ability to know when the car is moving or at full stop. I mean, the speed sensor is already there. Can't be more easy. (Please ignore me, just getting myself motivated :) )


You don't need a speed sensor for idle control. RPM and throttle position will work just fine.


C|

Buzo
10-25-2011, 06:32 PM
You don't need a speed sensor for idle control. RPM and throttle position will work just fine.


C|

My code was working with the TPS and RPMS as you said. However, when approaching a stop, there was a slight stumble due to the IAC getting too much closed, then 1 second later it gets back to the target RPMS.

With the speed sensor, I just monitor an input port for switching on and off without care about its frequency. If the speed pulse stays on or off for more than one second, then the car is at full stop.

This is the resulting chart of what I tryed to explain above. I cut off the name of each item in the chart, but they are RPMS, TPS and the stop bit which turns on when the wheels stop moving.

http://img810.imageshack.us/img810/2355/stopbit.png (http://imageshack.us/photo/my-images/810/stopbit.png/)

And actually it wasn't that painful to add the signal of the speed pulser, I had some wires already connected from the ECU to the ECM, (I planned to use the P/N shift switch but is not needed if you have a MAP sensor) so I just changed it to the speed pulser signal.

Buzo
10-25-2011, 06:42 PM
Hey Cygnus, Could you please do me a favor?
Do you have a log of your megaskirt system that you can send me?

I've been searching in their site but I found only logs that were posted because they had a problem, so I need a log of something working OK.

I needed because I've been struggling with the O2 sensor closed loop control.
With 0.1% of PWM variation I bring it from rich to lean, so I don't know if that's normal and I am wondering how another car looks like. Thanks.

cygnus x-1
10-25-2011, 08:38 PM
Hey Cygnus, Could you please do me a favor?
Do you have a log of your megaskirt system that you can send me?

I've been searching in their site but I found only logs that were posted because they had a problem, so I need a log of something working OK.

I needed because I've been struggling with the O2 sensor closed loop control.
With 0.1% of PWM variation I bring it from rich to lean, so I don't know if that's normal and I am wondering how another car looks like. Thanks.



I have lots of logs but they won't be of any help because I have a wideband O2 sensor, which operates differently from the stock sensors (narrow band type). What you're describing with the mixture going from rich to lean with very small changes to pulse width is exactly why narrow band sensors are not used so much anymore. The AFR to voltage curve of a narrow band sensor is very steep, so tiny changes in the mixture create a large voltage swing. For measuring AFR they really aren't very useful. About all they are good for is telling you if the mixture is richer or leaner than the stoichiometric point.

What the OEM computer does is oscillate the mixture around the stoichiometric point by increasing the fuel when it's lean and decreasing the fuel when it's rich. It happens fast enough, and the fluctuations re small enough, that it's not perceptible in how the engine runs.


C|

Buzo
10-27-2011, 08:21 AM
So far my car has been running using statistical/empirical data. It means that I start with a flat fuel table, and using the computer keyboard I command more/less fuel or more/less air until I get a nice idle. Then I apply some load and repeat above step. Now that the weather is getting colder, I repeat above steps from time to time.

The car runs great. I have tables where I can hear a little knock while driving, but I get the best fuel economy, and I do have tables where there is no knock, but the fuel economy is just like the carb was.

So I started investigating how to do a better fuel calculation and here is my personal interpretation of the whole thing: How to Measure the air flow getting into the engine to later add the correct amount of fuel.

I'll start with the formula of the air density or in other words, how much air we have in a container at given pressure and temperature.

Hope the step by step description don't confuse things more than they are.

http://img593.imageshack.us/img593/2733/airflowcalc.png (http://imageshack.us/photo/my-images/593/airflowcalc.png/)

Buzo
10-27-2011, 08:35 AM
If we apply below formula directly, the car may not even work.
There are losses like fuel sticking to the walls, and a lot of other physical events that occur with the kinetics of the engine .

Here is where the VE tables come into play. They can compensate for above physics for all combinations of speed and load. So the VE is a percentage of fuel to add or substract depending if you are idling, cruising or at WOT.

I'll let you know if all this theory works, because I am in the process to test it.

Buzo
10-27-2011, 08:56 AM
What the OEM computer does is oscillate the mixture around the stoichiometric point by increasing the fuel when it's lean and decreasing the fuel when it's rich. It happens fast enough, and the fluctuations re small enough, that it's not perceptible in how the engine runs.


C|[/QUOTE]

This is exactly how my car is working now.
I just expected I could make the O2 to be flat at 0.5V.
So I believe I can leave my NB O2 alone as it is. It isn't actually bad, uh?

http://img192.imageshack.us/img192/737/bettero2.png (http://imageshack.us/photo/my-images/192/bettero2.png/)

cygnus x-1
10-27-2011, 02:01 PM
If we apply below formula directly, the car may not even work.
There are losses like fuel sticking to the walls, and a lot of other physical events that occur with the kinetics of the engine .

Here is where the VE tables come into play. They can compensate for above physics for all combinations of speed and load. So the VE is a percentage of fuel to add or substract depending if you are idling, cruising or at WOT.

I'll let you know if all this theory works, because I am in the process to test it.


You're on the right track. The VE table will compensate for static differences between ideal and actual conditions but it can't deal with dynamic changes. The fuel sticking to the wall stuff can only be dealt with by looking at the rate of change of how much fuel is added. The amount that sticks to the walls and evaporates from the walls changes with pressure and RPM, and can only be determined empirically. Megasquirt does this by separately keeping track of the (projected) amount of fuel on the walls based on your input parameters, and adjusting the injector pulse width to compensate. The more simplistic way to do this is to use the rate of change of MAP or TPS to add or subtract a little extra fuel beyond what the VE table does. These would also have to be determined empirically.


C|

cygnus x-1
10-27-2011, 02:03 PM
This is exactly how my car is working now.
I just expected I could make the O2 to be flat at 0.5V.
So I believe I can leave my NB O2 alone as it is. It isn't actually bad, uh?

http://img192.imageshack.us/img192/737/bettero2.png (http://imageshack.us/photo/my-images/192/bettero2.png/)


Nope, it's working exactly like it should. You can play with the control parameters to try and reduce the oscillation , but you won't get rid of it completely. What kind of algorithm are you using for closed loop control? PID or something else?


C|

Buzo
10-27-2011, 05:37 PM
Nope, it's working exactly like it should. You can play with the control parameters to try and reduce the oscillation , but you won't get rid of it completely. What kind of algorithm are you using for closed loop control? PID or something else?

C|





if(O2>O2target && O2_ready && TPS<0x70 && o2control)
{ PWM_Sent = PWM_Sent-O2_sub;
if(O2_sub<7)
O2_sub++;
}
else
{ O2_sub=0;
}




Where:
O2target changes with the engine conditions (idling, cruising, etc)
O2_ready its a flag that turns on until the O2 is ready and hot
TPS<0x70 disables the O2 control when the TPS is 3/4 open
o2control is a flag that I can set/clear with the computer's keyboard
O2-Sub is a counter that pulls the PWM from rich to lean and is limited to 7 (so the minimum PWM never gets to zero)
and the code is executed at every program cycle.

cygnus x-1
10-27-2011, 07:56 PM
if(O2>O2target && O2_ready && TPS<0x70 && o2control)
{ PWM_Sent = PWM_Sent-O2_sub;
if(O2_sub<7)
O2_sub++;
}
else
{ O2_sub=0;
}


Where:
O2target changes with the engine conditions (idling, cruising, etc)
O2_ready its a flag that turns on until the O2 is ready and hot
TPS<0x70 disables the O2 control when the TPS is 3/4 open
o2control is a flag that I can set/clear with the computer's keyboard
O2-Sub is a counter that pulls the PWM from rich to lean and is limited to 7 (so the minimum PWM never gets to zero)
and the code is executed at every program cycle.


Ok, so at each program cycle the correction amount is essentially fixed (at 1). To make the response time faster you can change the correction amount based on the difference between the measured AFR (O2) and the target (O2target). A larger difference means more correction. You can also make it go in either direction. (My C is quite rusty, hope I get this right)



if (O2 != O2target && O2_ready && TPS<0x70 && o2control)
{
O2_correction = (P * (O2target - O2));

if (O2_corection > 7)
O2_correction = 7;

if (O2_correction < -7)
O2_correction = -7;

PWM_Sent = PWM_Sent + O2_correction;
}


O2_correction is the correction amount to be applied.

P is a tuning constant that scales the correction value to how aggressive you want it to be. P would be determined empirically and fixed once you find a value that works.


I don't know if your controller has floating point math available so you might have to modify this if it's limited to integers. The point is that the amount of correction applied changes depending on how far off the mixture is. If you set P too large though it will always over correct and the mixture will oscillate. If it's too small the correction will be ineffective.


C|

Buzo
10-30-2011, 05:30 AM
O2_correction = (P * (O2target - O2));

If we leave P alone in the equation, and I want 8% of PWM steps as the maximum control when the car is rich, then...

O2target=0.5
O2_correction=-8 (less PWM)
O2=0.9 (the richest value I can get with the NB sensor)
P=?

P = O2_correction/(O2target-O2) = -8/(0.5-0.9) = 20.

Let's try it!

By the way, I added another flag to the O2 control and it really improved the response of the car

if (O2 != O2target && O2_ready && TPS<0x70 && o2control && !acc_pump)

I found the O2 and the acceleration pump enrichment were fighting each other, so there was a delay in the response of the pedal. Now its fixed.

Buzo
10-30-2011, 06:44 AM
I don't know if your controller has floating point math available so you might have to modify this if it's limited to integers. The point is that the amount of correction applied changes depending on how far off the mixture is. If you set P too large though it will always over correct and the mixture will oscillate. If it's too small the correction will be ineffective.


C|

It does. But at the end the PWM is an integer value, so everything is scaled to 1ms of peak + PWM_Sent * 50 µs of hold time

I use floating variables to get the MAP and Temperatures so the calculated Air flow is as accurate as possible, so at the end one single float to integer conversion is needed.

All the code is written to get the air flow and fuel flow from the maths in my previous post, I am just getting my temp sensors calibrated to the different atmospheric temps of the day, based in the wonderful weather-NOAA site.

Buzo
10-31-2011, 09:02 PM
My ECM is already calculating the air flow entering the engine and therefore, the required fuel.

The last thing to determine is the injector flow so I can define the PWM based in the req. fuel above.

Almost there!

Buzo
11-02-2011, 04:27 PM
This is a proof that my interpretation of the general gas law and how its used to measure the engine's air flow is correct.

I downloaded a log from somebody using the megasquirt fuel system.

Took his MAP, CLT and RPM readings, applied my formula and there you go! the "shape" of the calculated Fuel Flow using my formula matches his Megasquirt's Duty Cycle shape as can be seen in the chart.

My Fuel Flow value still needs to be converted to PWM by dividing the calculated flow by the injector's flow rate, but it is a constant that will just transport the trendline up or down but it will not affect the waveform shape.

The first chart is the fuel qty his system is injecting to the engine compared with what My ECM would inject. -Same except for small. -

The second chart is his data that I used to calculate the fuel flow.

I don't know if he is using a 4 cylinders engine, but it doesn't matter because this fuel flow shape just needs to be multiplied by a constant factor to match any engine.

I did a quick test yesterday and contrary to what i expected, the car runs perfect without any type of enrichment. Just the calculated fuel and that was it. More testing today.

http://img259.imageshack.us/img259/4336/proofofsuccess.png (http://imageshack.us/photo/my-images/259/proofofsuccess.png/)

Buzo
11-02-2011, 07:46 PM
Let's the real tuning begin!!!!!!!

I am ready to create the Air/Fuel Ratio and Volumetric Efficiency tables.

my Fuel Equation is great by itself! the car accelerates and idles really smooth. Of course I can lean out the Idle/Neutral and enrich the Idle/Drive so that's exactly the tune's purpose. With my previous experience I know which MAP/RPM combination is used for idle, accelerate, cruise, etc, so it will be easy for me to find the areas and look for the optimum values for each condition.

This is great man, if I keep the same motivation on this project, early next year I am going to need volunteers to test it in other cars!!

Buzo
11-02-2011, 08:34 PM
1ms of peak + PWM_Sent * 50 µs of hold time

I noticed something that I don't like... The car can idle with just the 1 ms peak and the PWM_Sent=0.

That tells me the fuel pressure is set too high and therefore I can't fine tune in the low side.

Its time to put my adjustable pressure regulator in the car and set it to 250 kPa... Current pressure regulator was set to 317 kPa, per autozone's datasheet.

Buzo
11-07-2011, 07:08 PM
I was having some fuel odor in the car, after being in the car for some time and got inside the house my wife told me "you have some gasoline smell" is when I realized I needed to do something about.

At the beginning I thought it was a software issue, some rich spot or something but I found the cavalier's pressure regulator installed in the TBI as the source of the leak.

This regulator was not being used anymore since I put a regulator inside the tank and blocked the return line off. But I left the original regulator in place to plug the circuit in the TBI. Well the diaphragm finally gave up causing this fuel odor.

So I cut a piece of sheet metal and replaced the diaphragm. The fuel odor is gone with all my efforts to "fix" it by software.

Buzo
11-07-2011, 07:24 PM
Its incredible how far away I was from the real solution for this project.

You can use empiric data to run your car, but at the minor temperature change (even 5 degrees C), something needed to be compensated again.

However, using the simple equation MAP*RPMS/TEMP you get the air flow that just need to be multiplied by your tuning number.

I can do hard accelerations and the engine responds like a champ. The Oxygen Sensor routine works great at 0.6V, I get some vibration when I try 0.5V but still its a lot better than the carb that never was below 0.8V.

These days have been cold so it has been a great opportunity to tune the cold starts. The solution was to add the double of the calculated fuel while the Manifold temperature is below 45 degrees C + playing a little bit with the IAC motor position.

Finally my car is working just like any other fuel injection car in the street. :thumbup:

Dr_Snooz
11-08-2011, 06:16 PM
I swear to God, Being and Nothingness was easier to understand than this thread.

Buzo
11-08-2011, 06:52 PM
I swear to God, Being and Nothingness was easier to understand than this thread.

It might be due to my poor English.

Buzo
11-08-2011, 07:08 PM
I was using a local weather station to calibrate the MAP, but I realized today that they always report the same pressure like if you were at the sea level...

For my city's altitude of 3000 feet, the max pressure I can get is 88 kPa, instead of the 102 kPa reported in the weather site.

Let's see how this new change affects my tuning.

cygnus x-1
11-09-2011, 09:34 AM
I swear to God, Being and Nothingness was easier to understand than this thread.

LOL! I've not read that one but I did read some pretty thick philosophy in College. The worst I think was from a philosophy of religion class. I forget what it was reading but after a couple pages my head nearly exploded. Ultimately I had to drop the class because I was just too overloaded that semester.



It might be due to my poor English.

It's not. It's the jargon. The workings of fuel injection can get pretty arcane until you understand the language and concepts.




For my city's altitude of 3000 feet, the max pressure I can get is 88 kPa, instead of the 102 kPa reported in the weather site.



88kPa sounds about right for 3000 feet. This won't matter much as you can just tune it out with the VE table.


EDIT: I can't remember now if I sent you the MAP calibration I did with a vacuum gauge. Anyway here it is again:



kPa // Volts
100 2.9
90 2.63
80 2.36
70 2.06
60 1.78
50 1.51
40 1.23
30 0.95
20 0.67
10 0.41



C|

Dr_Snooz
11-09-2011, 04:14 PM
It's not. It's the jargon. The workings of fuel injection can get pretty arcane until you understand the language and concepts.



Yep. Completely over my head. Sigh.

Excellent work Buzo. Hopefully someday I'll be able to understand it. :thumbup:

Buzo
11-09-2011, 05:38 PM
Got the new pressure regulator calibrated at 250 kPa (couldn't get less)
Got all the weak points in the fuel line re-enforced

But the car is running like never before. Even with a 317 kPa regulator and a little mistake in the volts to kPa conversion the car runs great.

As you said Cygnus, the VE calibration table can do whatever you need with the calculated fuel in order to get all combinations right.

So I don't know if I want to put the new regulator, The mayor benefit will be to protect my injector of the higher pressure, so if I decide to do it I will also fix my volts to kPa conversion and start over a new VE table.

Buzo
11-11-2011, 06:53 PM
I've been playing all this week with the IAC initial position for startup.

I can't find the best combination. Too much air is not good and neither too little. Everything worked OK until we started to get temps below 40 F.

I am also struggling with a re-start after 30 minutes. I'm adding extra fuel for 9000 extra program cycles and sometimes it works OK and sometimes it's not enough.

I'm kind of stuck here, but as always happens, as soon as I post my problem somebody say something and a solution comes to my mind.

Buzo
11-11-2011, 07:25 PM
22 MPG in the city!!

The next thing to do, besides my action items below, is to implement the fuel cut-off feature. I just read that it can save up to 4 MPG.

If that's truth, I will finally be better in fuel economy than the old days when my car was stock and gave me 24 MPG.

cygnus x-1
11-11-2011, 11:36 PM
I've been playing all this week with the IAC initial position for startup.

I can't find the best combination. Too much air is not good and neither too little. Everything worked OK until we started to get temps below 40 F.


When it gets below freezing you will need a LOT of extra fuel to get it going. Closed loop fuel control won't work because the mixture needs to be so rich that it's beyond the useful range of the O2 sensor. The O2 sensor also won't read properly until it warms up. It will also take quite a bit of air too. You'll need enough air to get the idle up to 2000RPM or so and enough fuel to get the AFR up to 12:1 or so.




I am also struggling with a re-start after 30 minutes. I'm adding extra fuel for 9000 extra program cycles and sometimes it works OK and sometimes it's not enough.


Hot restart problems are common. Probably the IAT sensor is getting heat soaked when the hot engine sits without running for a bit. The ECU then thinks the air temp is higher than it is and injects less (not enough) fuel. Also the fuel stuck to the intake manifold walls evaporates and has to be replaced, which makes the lean condition worse. Moving the IAT sensor to a cooler location usually helps.


C|

Buzo
11-17-2011, 06:42 PM
22 MPG in the city!!

The next thing to do, besides my action items below, is to implement the fuel cut-off feature. I just read that it can save up to 4 MPG.

If that's truth, I will finally be better in fuel economy than the old days when my car was stock and gave me 24 MPG.

This is how the fuel cut-off looks like:
http://img266.imageshack.us/img266/1734/fuelcutoff.png (http://imageshack.us/photo/my-images/266/fuelcutoff.png/)

The injector gets shut off when the TPS is released and the RPMS are higher than 1500, and restarted when the RPMS get below 1500.
In this case I am leaving the injector open with 1% of PWM. It will save fuel per sure.

Buzo
11-18-2011, 08:05 AM
I've been playing all this week with the IAC initial position for startup.

I can't find the best combination. Too much air is not good and neither too little. Everything worked OK until we started to get temps below 40 F.


I found the solution for this:
If the IAC position is more open than the position at Idle, I add 5 points of extra fuel, independently of the tables and the calculated fuel. Assuming IAC=150 when Idling, then.

if(tpsoff)
{ if(IAC>151)
PWM_Sent+=5;
if(IAC>152)
PWM_Sent+=5;
if(IAC>153)
PWM_Sent+=5;
if(IAC>154)
PWM_Sent+=5;
if(IAC>155)
PWM_Sent+=5;
if(IAC>156)
PWM_Sent+=5;
}




I am also struggling with a re-start after 30 minutes. I'm adding extra fuel for 9000 extra program cycles and sometimes it works OK and sometimes it's not enough.

The program cycles counter only decreases when the TPS is released, so it depends of how many "stops" you make in the beginning of your trip, as more time the TPS is released (i.e. in a stop light) the 9000 program cycles will end sooner. That's the reason why it sometimes was not enough. So I will put a bigger counter that is not dependent of the TPS but the time elapsed after startup.

Buzo
11-23-2011, 07:04 AM
This is the Oxygen Sensor Log during my trip this morning.
It is the best Closed Loop Control for the air/fuel mixture I have ever reached.
I added a line in yellow indicating where the O2 stoichiometric target for a Narrow Band (0.5 V) is at.

I set a target of 0.6V so that's why the average is slightly up from the 0.5V, first of all I wanted to make sure the software was able to stay around any given target. Then I can set it to any value I need.

Most of the trip was highway cruising at 60 MPH and 2500 RPM.

Dam! I should stick with this software revision for a while! Because I am already thinking in improving something else...

http://img21.imageshack.us/img21/6813/o2chart.png (http://imageshack.us/photo/my-images/21/o2chart.png/)

Buzo
11-24-2011, 07:08 AM
The only one thing that is holding me to test this system in another car is the cold start.

The problem seems to be how the IAC motor responds to the commands, it looks like there is some inertia in the motor that makes the IAC to loose a few pulses or something. There is no other feedback but the engine speed to assure the IAC is actually moving. And for the time the engine responds, the IAC is too much open that leans the mix out so the engine can't accelerate any more, then the IAC opens even more until the engine dies...

Any suggestion is welcomed.

cygnus x-1
11-24-2011, 04:20 PM
The only one thing that is holding me to test this system in another car is the cold start.

The problem seems to be how the IAC motor responds to the commands, it looks like there is some inertia in the motor that makes the IAC to loose a few pulses or something. There is no other feedback but the engine speed to assure the IAC is actually moving. And for the time the engine responds, the IAC is too much open that leans the mix out so the engine can't accelerate any more, then the IAC opens even more until the engine dies...

Any suggestion is welcomed.


The IAC should be closed-loop controlled just like the fuel. The control loop needs to be tuned to the IAC such that it won't try to adjust it too quickly. This would involve a PID loop like I mentioned before for fuel control. It also sounds like maybe the fuel control is not reacting fast enough either to keep up with the extra air. Using PID loops would allow for tuning the short and long term response.

It's also possible that the IAC doesn't like the type of control signal you are sending it. Have you checked to make sure your PWM frequency is correct for it?

C|

Buzo
11-24-2011, 08:17 PM
The IAC should be closed-loop controlled just like the fuel. The control loop needs to be tuned to the IAC such that it won't try to adjust it too quickly. This would involve a PID loop like I mentioned before for fuel control. It also sounds like maybe the fuel control is not reacting fast enough either to keep up with the extra air. Using PID loops would allow for tuning the short and long term response.

It's also possible that the IAC doesn't like the type of control signal you are sending it. Have you checked to make sure your PWM frequency is correct for it?

C|

I found a bug in the software. I was commanding the next turn of the IAC before it finished the current turn. That's why I was loosing the number of "ticks" sent.

A simple if IAC_moving then wait... has solved the last issue I had. Still need to test the car tomorrow morning. I know where IAC must be according to the ambient temperature and the software is ready to execute it. The problem was the tick counter was lying to me so I assumed it was in certain position when it actually was in a different position.

Thanks again for your response. I'll let you guys know how this works.
Happy thanksgiving day!

Buzo
11-25-2011, 02:58 PM
I knew it shouldn't be that hard to get the car started in a cold morning.

It was cold and raining today - two factors that affect the air density - and the car fired up at the first attempt.

So some time ago when I checked the IAC for correct traveling, correct frequency, etc., I removed the TBI from the engine to look at the opening and created a table of Ticks vs IAC Position, but once you put it back you can't longer see if the IAC is moving. Except for the response of the engine speed. Somehow I changed the code and removed the "wait for the IAC to finish the current adjustment" it was in place when I created the table.

Just did a little more work with the after-crank enrichment this morning and that was it. Now just need to wait for the one-digit temperatures and I should be all set.

Buzo
11-26-2011, 05:41 PM
The semi-autotune function I created works pretty good.

What I did was to start with a flat table of 100% and take the car for a ride in a highway, then the autotune will correct each table address according to the O2 response, while everything is being logged with the laptop.

At the end of the ride the table must be manually updated (that's why I called it semi-automatic). One ride is enough to fill the whole table. Even the O2 could be disabled after that and it will work much better than any de-vacuum'd carb.

Currently I am working in improving the period where we don't have the feedback of the O2, because the car is slightly rich in that period of 5 minutes, at the point that I can see a black mark in the floor right below the exhaust pipe. But I consider that as a part of the tuning process and not part of the development process.

One option I am thinking of at this time is to replace the stock O2 with a electrically heated O2 sensor, so I can reduce that time in a half at least...

Buzo
11-27-2011, 07:46 AM
This is how the fuel cut-off looks like:
http://img266.imageshack.us/img266/1734/fuelcutoff.png (http://imageshack.us/photo/my-images/266/fuelcutoff.png/)

The injector gets shut off when the TPS is released and the RPMS are higher than 1500, and restarted when the RPMS get below 1500.
In this case I am leaving the injector open with 1% of PWM. It will save fuel per sure.


Just by adding this feature improved from 22 MPG to 28 MPG.
And still the car is too rich during the warming up time, so there is still chance for improvement.

I am trying to monitor a signal other than the O2 to do the closed loop while the O2 is warming up.
I am thinking in the RPM, so I'll start with a 20% of PWM, then reduce it one by one until I detect a change in the RPM, then stop there, wait a few seconds and reduce the PWM once again, and so on and stop just before the engine dies. OK, let's do it!

Buzo
11-27-2011, 12:47 PM
I never bought the idea of paying 50 USD for the conic shape air filter, (remember I paid 35 for the TBI and sensors) so ended up with the following design for only 5 bucks...

http://img191.imageshack.us/img191/3849/50269873.jpg (http://imageshack.us/photo/my-images/191/50269873.jpg/)

http://img412.imageshack.us/img412/6421/74364103.jpg (http://imageshack.us/photo/my-images/412/74364103.jpg/)

http://img221.imageshack.us/img221/9636/20848692.jpg (http://imageshack.us/photo/my-images/221/20848692.jpg/)

http://img442.imageshack.us/img442/9576/11730860.jpg (http://imageshack.us/photo/my-images/442/11730860.jpg/)

http://img836.imageshack.us/img836/3538/92963139.jpg (http://imageshack.us/photo/my-images/836/92963139.jpg/)

Buzo
11-27-2011, 01:14 PM
Cont'd...

http://img851.imageshack.us/img851/3929/32455131.jpg (http://imageshack.us/photo/my-images/851/32455131.jpg/)

http://img802.imageshack.us/img802/2138/52393654.jpg (http://imageshack.us/photo/my-images/802/52393654.jpg/)

http://img811.imageshack.us/img811/6669/64530981.jpg (http://imageshack.us/photo/my-images/811/64530981.jpg/)

http://img266.imageshack.us/img266/9892/43459283.jpg (http://imageshack.us/photo/my-images/266/43459283.jpg/)

Buzo
12-02-2011, 09:02 AM
By reading over the internet I found that the EMCs from GM have one Idling target RPM table vs. coolant temperature for Park/Neutral and another for Idling vs. coolant temp for Drive.

As of today I have one single table for both, P/N & D so I usually wait until the RPMS go down to ~1200 to start my drive in the mornings. I don't have to do that if I just implement a second table of target RPMS specifically for D.

It will take me a couple of extra lines of code, and a couple of cold mornings to test it!

I don't know if someday I am going to really finish this project though. But for now, It's been 7 months of lot of fun since I started it.

Buzo
12-05-2011, 07:36 PM
I passed the cold start test today.

It's snowing and the car fired up just like a new car. It is very interesting to see how the IAC motor needs to open double the length to reach the same Idle Speed than at hot temperature.

That brings me an Idea of connecting the hot air hose that goes from the muffler to the filter cover of the stock carb. Certainly warming up the manifold air will same some extra fuel.

Dr_Snooz
12-08-2011, 07:05 PM
That air filter is epic! Glad to see you making progress.

cygnus x-1
12-08-2011, 07:19 PM
http://img811.imageshack.us/img811/6669/64530981.jpg




Just noticed that your cam pulley is rather unusual looking. I haven't seen one like that before.


C|

Buzo
12-09-2011, 05:22 PM
Just noticed that your cam pulley is rather unusual looking. I haven't seen one like that before.


C|

It is a piece of sheet metal that i put in front of the stock pulley. It was from the days when I was trying to generate the 7x signal for the GM ECM. So I cut some holes to get 7 pulses each crankshaft turn 6 even and 1 uneven pulse for sync. It didn't work. The idea is good but needs more refined machining skills.


That air filter is epic! Glad to see you making progress.

Thanks Dr., Just saved 45 USD and my engine is well protected from the elements!

Buzo
12-10-2011, 07:04 PM
Currently I am working in improving the period where we don't have the feedback of the O2, because the car is slightly rich in that period of 5 minutes, at the point that I can see a black mark in the floor right below the exhaust pipe. But I consider that as a part of the tuning process and not part of the development process.

One option I am thinking of at this time is to replace the stock O2 with a electrically heated O2 sensor, so I can reduce that time in a half at least...

The issue I described above is still present. I just got a heated wide band O2 sensor so its time to install it. I just didn't expect so many wires coming out of the sensor.

Step 1) how it works?

cygnus x-1
12-11-2011, 10:12 AM
The issue I described above is still present. I just got a heated wide band O2 sensor so its time to install it. I just didn't expect so many wires coming out of the sensor.

Step 1) how it works?


Which one did you get?


C|