📜 ⬆️ ⬇️

Homemade control unit for diesel engine



Cars have long been overgrown with all kinds of electronics, so overgrown that it’s just terrible: there is a controller at the door, a controller in the headlights, a controller in the brakes, and of course in the engine, as without it. Usually, when it comes to the engine control unit (ECU), a gasoline engine is hung, hung with sensors, actuators and wiring harnesses. The control unit sensitively reads the parameters of the sensors, corrects the mixture and the start of sparking. Complicated! But enthusiasts create their own control units, write alternative firmware to squeeze out extra “pony”, get around some kind of malfunction or just to improve skills. And, as a rule, circumstances such as dissatisfaction with the contact ignition system of gasoline engines, a slight lack of electricians and so on push the authors into such a move.

It is about such circumstances and a diesel engine and will be discussed.
')
So, the statement of the problem:

Given:

Required: serviceable engine after the "fusion".

Some theory

Previously, when diesel engines were large, they were driven by high-pressure in-line pumps. It's very simple - for each cylinder plunger that presses the fuel through the nozzle. On the plunger presses the camshaft, which has a variable height of the cams, so engine control is obtained.

Then they began to make pumps more complicated, distributed type. There are one or two plungers; fuel under pressure is already distributed among the cylinders by a special mechanism. Management is more complicated, but still mechanical - the lever of gas and everything.

Fully electronic injection systems have changed mechanical ones - each nozzle is opened on command from the control unit, precisely metering the fuel and providing the most environmentally friendly and economical mode of engine operation.

My pump is stuck somewhere between a mechanical distribution and an electronic one. In essence, it is a rotary type distribution pump (manufactured by Lucas-Delphi), with one single actuating element: an injection advance valve.
When I first acquired a pump, I did not attach importance to the strange solenoid in the side of the pump, and decided to “become”.

What advance injection? As it turned out, an unusually important parameter in the operation of the engine. It depends on the acceleration, and maximum speed, and engine consumption. Analogue on gasoline engines - POPs (ignition timing).

The essence of this very injection advance angle is simple: it takes time to burn the fuel in the cylinder. The higher the engine speed, the less time the fuel has, and therefore it must be injected into the cylinder early, so that after the piston passes through TDC, the fuel already burns and gives off energy to the flywheel. At low revs, on the contrary, it is necessary to inject fuel immediately at TDC, so that it does not start to burn in advance, and does not create a load on the upward piston. In the cold engine intake must be done earlier, on the hot - later. Under load - before (more fuel), without - later. Here is such a science in one parameter.

A quick googling revealed a rather scant amount of information on regulatory options - obviously this is the lot of the developers of fuel equipment, even repairmen do not operate with a theory. Especially sad with the absolute values ​​of the angles - for different engines the values ​​are slightly different, and everything is covered with the darkness of mystery.

Understanding started to build with this chart:



Well, except for the absence of absolute values, nothing complicated.

Together with theoretical studies, it was worthwhile to look at the mechanical analogue of this whole system - the benefit is in the old pump. The injection advance mechanism there is very simple, even elegant. The piston, pushed by the pressure of the fuel in the pump casing, is propped up by a spring and is connected with an actuator - an advancing ring. With increasing speed, the pressure on the piston increases and it shifts the injection to the early side. With increasing load, the exact same thing happens. In addition, the spring stiffness changes when you press the gas pedal - the more the pedal is pressed, the weaker the spring, and the greater the angle. It now remains only to realize all the same in the form of electronics, which means it is time to evaluate what is available from sensors and actuators.

The easiest with the latter. They are exactly one thing, injection timing valve, two wires. It is a solenoid that unlocks the fuel line, thereby lowering the pressure on the advance ring in the pump. Fully open valve corresponds to the minimum advance, closed - maximum. Regulation is performed using PWM at a frequency of about 50 Hz. The degree of adjustment is high, this valve can stretch the whole tooth on the timing belt, a range of about 25-30 degrees. This is one of the advantages. Of the minuses - one corner corresponds to different values ​​of the filling of the control signal depending on the temperature of the fuel. This automatically eliminates the open regulation system, which means it’s time to look at the sensors.

So, the main parameter that is controlled by the system is the current ignition advance angle. Angle implies a value in degrees between something and something. In a diesel engine, these are two sensors: a crankshaft position sensor and a needle lift sensor in the nozzle of the first cylinder.

The sensors in my motor are inductive. Here is a picture that roughly corresponds to the crankshaft position sensor:



The sensor winding is magnetized by a permanent magnet or a direct current through the coil. A change in the distance from the sensor to the magnetic obstacle causes a change in the current through the coil, and can be registered as a voltage pulse at the output of the sensor. It is remarkable that in this way it is possible to fix both the approximation of the mark (positive impulse) and the distance (negative).

However, on diesel cars, this sensor is made slightly different - in the picture the sensor interacts with the teeth on the flywheel, in my case there are two indentations on the flywheel opposite the sensor in diameter. They give two pulses per flywheel revolution, which means 4 pulses per revolution of the fuel pump shaft. I learned this simple wisdom by receiving a signal that is 4 times as high as the calculated frequency. In this approach, there is a plus: since pulse 4, you can remove the signal from any injector.



The needle lift sensor is made the same, but in the nozzle body. The fuel, under pressure, undermines the dispenser needle, while simultaneously injecting a weak impulse in the injector coil.

So, for the minimum system performance, two sensors are needed. In my car was (fortunately) one - the crankshaft position sensor. The nozzle with the sensor had to be purchased separately, good, for disassembly it costs nothing at all.

Now the signals need to be processed and entered into the controller, another difficulty. The difficulty is because the finished circuitry of the input circuits cannot be seen on the Internet. In the heat of construction, the simplest signal conditioner was assembled on the knee: a differential amplifier on the LM358 and a Schmidt trigger. The gain was chosen at random and was about 50. What a joy it was when I received a completely normal signal from both sensors!

It's time to evaluate the real parameters of the engine. Also on the knee was assembled the simplest angle gauge between the two signals with an acceptable accuracy of 1 degree. The design is an ATMEGA8A microcontroller and a seven-segment indicator for clarity.

The data turned out a bit strange. So, the maximum advance according to my device is 25 degrees, the minimum at which the engine does not stall - 8. This did not fit the schedule from the beginning of the article, where negative values ​​of the advance angle appear. I had to make a stroboscope to check, and who does not breach. It turned out that he would not breach, just the marks on the flywheel are shifted relative to TDC by about 10 degrees.
Oh, something a bit "about" to adjust one parameter. First, the dependency graph in parrots, and then the unknown constant. To help came tuning the engine "by ear", "on the smell" and the reaction to the pedal. Joy was added by the fact that experienced motorists on the forums give opposite advice on tuning. For many, the sound of pistons and the loud operation of the engine is an injection delay, but in fact just the opposite. Insane, diesel traction "on the bottoms" - a consequence of excessive advance injection, in fact - on the contrary. From my own experience were made the following conclusions:

At low revs, the angle should be minimal, the boundary can be detected when starting a completely cold engine. If stalls after turning off the glow plugs - too late angle, increase the lead. In my parrots it is 8-9 degrees. With this installation, the engine does not stall when abruptly releasing the clutch pedal, pulls at idle even in 4th gear, well, in general, beauty. Such a static angle is not suitable for comfortable work for one reason - it is impossible to unwind the engine above 1500 rpm, and at the same time it heats up terribly, throwing diesel fuel into the exhaust pipe.

The upper limit was also found experimentally, an angle of about 25 degrees allows the engine at high revs not only to spin, but also to accelerate the car. At the same time, there is no characteristic clatter of pistons, the smell of exhaust has a healthy, slightly "KAMAZ" smell, no sour and black smoke. This indirectly means that the diesel fuel has burned completely, while not at too high temperatures.

It's time to put it all together, beautifully arrange and roll back the control unit. However, the joy was short-lived. First, I found out that the simplest signal conditioner from the injector is very bad and gives a burst instead of one when raising the speed to 1800-2000 r / min, neither protective diodes, cable shielding, nor game with gain , nor the assembly of a typical driver circuit from a gasoline ECU. The search for a solution to this problem periodically pops up on the Internet. In the same place the correct train of thought was prompted - to use a specialized microcircuit.



It is called MAX9926, this is a whole line of specialized ICs for crankshaft position sensors, ABS sensors and other inductive sensors. According to reviews - well, just a panacea, pulls the useful signal from the noise level and in the presence of interference. However, I could not find it at the place of residence (they did not even hear it) or order it from China (expensive and only large lots). But there is a datasheet with an internal structure, so why not repeat it?

As a result, the following scheme was born:



Small explanation

On the chip U5 assembled a differential amplifier with moderate amplification. There are no features here, except that unipolar power without shear resistors, they are not needed for this OU.

The interesting part is collected on the U6 comparator. In fact, this is a basic one-shot comparator with a latch. The hysteresis is introduced by resistor R24, and resistor R23 and diode D10 delay the leading edge of the signal by about 5 ms, which allows you to ignore all signals with a repetition rate above 200 Hz.

The reference input of the comparator hangs under a variable potential, thanks to the diode D11 and resistors R26, R27. The higher the signal level at the input of the comparator, the higher the threshold for its operation. This solves the problem of different levels of the useful signal, depending on the engine speed.

It worked! Now, without interference, the signal from the injector and from the crankshaft sensor is received. It's time to adjust the injection advance. Obviously, the PID controller just begs for regulation. The difficulty, as always, is in its setup.

Some numerical methods for calculating the PID coefficients are broken about the complete absence of any data on the pump response to control. So you need to pick up. They start everything with a proportional coefficient, having tried the value 1, I have already seen the operation of the regulator. The response time of such a regulator is depressing, the set angle is set in about 3-4 seconds and has a tendency to oscillate. All anything, but in this application, you can make a regulation error in the direction of advance, but you can not make a degree in the direction of delay. Especially painfully late angle affects high revs, the car just drove 100 km / h, but now it slows down the engine like brakes. Then I introduced the direct proportional coefficient and the inverse, 4 times larger. When the corner goes into a lag, the controller quickly returns it to safe values.
P- and I-coefficients were selected "by eye" by the criterion of the absence of self-oscillations.

The law of change of the lead angle from revolutions is not yet in the table, but obeys a linear law, without any frills. To check it comes down, and there it is possible to be confused.

The gas pedal sensor in the pump is made in the form of a variable resistor on the axis of the pump lever; the resistor slider is connected to the microcontroller's ADC. Pressing the pedal "in the floor" changes the angle by 2 degrees. It feels like that, the acceleration and engine speed are good.

About iron

Since the processes in this regulator are slow, then there is no need for special speed. The MEGA8A AVR microcontroller coped with the task at a frequency of just 1 MHz. He comfortably manages to read the PID, process interrupts on the sensors, display the current angle on a seven-segment display and output debug information to the serial port.

The device, first assembled on something and hung on the wires at the motor, migrated into the cultural building of the tachometer control unit, which, by the way, was freed. Freed not just like that, but together with the sealed 15-pin connector, where the engine's “braid” was connected, and the staff tachometer now receives a signal from the new driver.



In general, it is possible and necessary to sum up.

Development is definitely a success. A couple of hundred kilometers at the new pump showed no difference in behavior compared with the old, mechanical. Fuel consumption even fell a little, and amounted to a pleasant 7.5l per hundred in the urban cycle.

Skills were received countless, both on the theory of fuel equipment, and programming microcontrollers.

Future plans

Despite the law of life "the best enemy of the good," the control unit shine improvements. First, the algorithm does not take into account several parameters, namely: the temperature of the engine and the amount of fuel injected. With the first parameter, everything is clear, only it is necessary to connect a regular coolant temperature sensor, then with the second one it is necessary to change the controller circuit greatly. The fact is that the engine load can be caught by analyzing the negative outlier on the signal from the nozzle. It corresponds to the locking of the nozzle, and therefore, considering the length of the open state of the nozzle, it is possible to estimate both the fuel consumption and the load. Only for this current microcontroller is not enough, not enough interrupt inputs.

UPD:


The article forgot to mention the important difference between a diesel engine and a gasoline engine. In a gasoline engine, the preparation of the fuel mixture begins with air . Hence, the mandatory attributes of any ECU for beznina: air pressure sensor (relative or absolute), flow meter, temperature sensor. Engine adjustment is also air-choke.

On the diesel engine, the mixture is always depleted, and there is no question of any stoichiometric composition of the mixture. In any mode of air enough, it is laid down by the design of the diesel engine. Adjustment solely by the amount of fuel, and it is not necessary to take air into account when operating the computer. The situation has changed in Common Rail diesel engines, the air there is considered the same as on gasoline, although errors in the amount of air diesel engines are not critical.

Resources:

1. Hot debates on the forum about the lead angle with bits of information
2. Similar cares of the owners of gasoline engines, circuit engineering spied
3. Programming the PID controller
4. Charts from the live nozzle
5. Sources on GitHub
6. The controller circuit entirely

Source: https://habr.com/ru/post/258619/


All Articles