⬆️ ⬇️

rusEfi: opensource DIY injector project

I would like to continue the topic of the fuel injection unit based on stm32 and talk about the current status of the project rusEfi.









')

rusEfi is a opensource project to create a universal control unit for an internal combustion engine. Under the universal means the support of a wide range of configurations, sensors and actuators. This means that this unit can be installed on any engine and get complete control, without closed firmware, undocumented features and everything else. If you are a programmer, then the possibilities are even wider - you can edit the algorithms yourself, and not just the available maps and settings. RusEfi differs from other similar projects with an emphasis on powerful but inexpensive hardware and thanks to this the ability to write the most transparent and portable code.



A bit of history.



Four years ago, I accidentally became fascinated by very amateur circuit endurance racing. As time went on, I wanted to get faster and better, but there was no desire to go along the banal path of buying a BMW e30 - that’s how it was thought to install a turbine on the engine. Reliability in this configuration is possible only with proper control of injection and ignition, and according to the rules of my races, all this should also be very cheap. Analysis of existing solutions showed that prices for them are still high, and not always justifiably, and the possibilities are limited. A homemade unit is clearly cheaper than existing custom units.



image



After reading the available sources (and by profession I am just a programmer), I decided to write code from scratch. The initial task was to write clear, extensible, and minimally hardware-related code.



Choosing a hardware platform.



Currently, there are a large number of powerful and inexpensive microcontrollers, whose performance is enough not to take care of every clock cycle, concentrate on the high-quality code and high level of abstraction. All this will allow to obtain high-quality and portable code, extensibility and lack of binding to a specific hardware. All this promises the possibility of switching to other hardware platforms when it is done. As a result, the STM32 was chosen - inexpensive, but powerful.

For several reasons, I believe that at the current stage, and perhaps even forever, iron should be modular. Currently, the STM32F4DISCOVERY debug board and two modules are used - the power driver module and the analog input module.

The dimensions of the development board allow you to connect at least four small modules to it from different angles. We now have an analog input module.



image



control module solenoids (fuel injector - just a solenoid)



image



and wiring connector module



image



Boards are drawn in KiCad - again, an open and free package. But given the sufficiently flexible pinout settings, anyone can use their I / O boards, compatibility is not required.



Drawing boards is probably the bottleneck - several people are already involved in writing code, but with hardware everything is more complicated. There is a list of tasks, but there are no people. And already I want to try to order from the Chinese not only the board, but also to order the assembly of at least all the resistances.



Soft



For better modularity, the system uses a small RTOS ChibiOS / RT , which is also valuable due to the presence of abstraction from equipment. ChibiOS gives us, firstly, the threads and the lock primitives - this is the functionality of the RTOS kernel, and secondly - the iron driver with a convenient and uniform for different MK API. Due to this, it is not necessary to delve into the tires and registers and there is hope for portability. At the same time, there is no great connection with this particular RTOS, if you have to - you can move to another.



The main principle of this project: the most readable source code. Everything that can be done is as modular and straightforward as possible: I really want to not hack anywhere, but simply implement it honestly. With a minimum of sticking to the selected hardware platform, switching to another platform in the future should be fairly simple.



Integration with customization programs



As you know, to configure the control unit requires some software that allows you to write logs, analyze and edit various tables, calibrations and settings. This software often costs money and its purchase for a single setting is not always relevant.



To manage us, we use the popular TunerStudio, the integration is already working. TunerStudio is quite flexible and allows you to edit settings on the fly, create any tables, edit maps and so on. Everything works online. It should also be noted that integration with TunerStudio also promises integration with MegaLogViewer, which allows you to analyze logs and automatically adjust the fuel map, based on the log. Also from the same line there is Shadow Dash MS - android application from the creators of Tuner Studio, which allows all the same as Tuner Studio, but with android devices via bluetooth.

All of these software products implement the necessary mechanisms, they do not have to write from scratch. Right now, fuel maps and temperature adjustments are working in TunerStudio, mechanisms are established, further development in this direction presents no problems.



Current project status



Now the controller controls the supply of fuel, based on the gauge shaft position and readings of the air flow sensor. From a simple table, the pulse lengths are obtained depending on the current speed and air consumption, with additional corrections for coolant and air temperatures. This is a primitive and far from ideal algorithm that is used more for debugging.

There is no ignition control right now. At some point there was also ignition control, then it was temporarily removed - now ignition control will be the main direction of work on the firmware.



If you touch on the topic of analogs - then the first is usually mentioned Megaskvirt, which is "ajar" - the source code is open, but requires the use of their official hardware, otherwise use is a violation of the license. Megaskvirt worth very tangible money. Only FreeEMS can be called a truly open and at the same time living project - there are already about twenty machines running on this control unit, but this project is tied to a very specific hardware and the source code just jars my sense of beauty.



How much does it all cost? The project is open source does not cost anything. Iron is open - iron is worth as much as you spend on making it. Approximately the minimum control unit should be in the region of $ 100. By the way, a separate interesting direction for the future is to implant a new MK into the board of the original ECU. For the old blocks of the DIP era, this will be the most economical version - such an upgrade will cost only $ 20, with full compatibility with rusEfi.



Now you just need to debug the foundation - carefully handle all the variants of position sensors, carefully arrange the hardware modules for a wide range of vehicle configurations in the same style.



At the moment the project needs your support. You need to write code, work on electronics and do other exciting and useful things. Anyone can help!



The project code is located on Sourceforge - the tracker also lives there.

Schemes of the current version of iron

There is a forum



And now - slides!



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



All Articles