For any discussion not specifically related to your project
User avatar
By pelukkk
#27525
Let me first thank you all of you for this amazing project.
I know that some people request 8 channel injection and/or ignition and that would be very difficult with the 4 16bit timers available in the arduino but I think i found a way to make it possible without much hassle.

As at the moment 6 and 8 cyl operation is possible with wasted spark and semi sequiential ignition, I thought about using time demultiplexing and only using one extra pin on the arduino wich would be flipped every 360º of rotation to indicate which bank is operating. This could be achieved with 8 1:2 demultiplexers, two 74FST3257's for example.
As PSIG pointed out here viewtopic.php?t=600 that would not work as at high rpm's the dwell time from the coils that would fire just before and after the bank flip would overlap (5000rpm's in a v8 @3ms if I'm not wrong)

The solution to that would be easy, instead of grouping the four ignition channels in one ic and the four injector channels in the other, group two injectors and their respecting two ignition channels in each ic, and have two independent select lines.
Every time the two ignition cycles have ended flip their corresponding select line, continue with the other two and after these finish flip their select line. Now the first two channels will be operating in what should have been the two wasted spark cylinders from the first two cycles.

In a v8 with the firing order 1-8-7-2-6-5-4-3 you would have:
In IC A channels 1 (cyl1 and cyl6) and 2 (cyl8 and cyl5) with select line (Hi or Lo) SA
In IC B channels 3 (cyl7 and cyl4) and 4 (cyl2 and cyl3) with select line (Hi or Lo) SB

The operations would be:
1 - 2 - flipSA - 3 - 4 - flipSB- 1 - 2 - flipSA - 3 - 4 - flipSB...

And the fired cylinders:
1 - 8 - 7 - 2 - 6 - 5 - 4 - 3 - 1 - 8 - 7 - 2 - 6 - 5 - 4 - 3...

I think this would add little complexity to the code. Of course the select lines could be flipped in other moments like at the start of dwell or ignition.
One flaw this has is that a board with this layout wouldn't be too good for 4 cyl operation but this could be solved adding 8 jumpers between the IC input and one of it's outputs, and pulling output enable high which leaves the outputs floating. Aditionally if you want the board to be 4 cyl only you don't need to populate the IC's and just add 8 little pieces of wire.

Finally, why? I hate wasted spark: decreased plug life, more noise, higher power consumption and coil heat, etc

Why not?


Maybe this is all flawed and I wrote this post for nothing :lol:
#29108
race_ready_z wrote: Sun Aug 12, 2018 7:10 am With a different board layout I've got a prototype atmega2560 operating 8 injectors and 8 coils all independently. In other words sequentially. It's basically a ground up fresh build with 99% different code.
how is work going on that ?, any chance we could see the code ?
#30650
Life got busy haven't really got to work on it much, well any. Maybe when things slow down some I'll get back at it. Anyways here's the rough draft of the schematic of the prototype. I'm certain some parts will get changed as time goes on and things get developed.
Attachments
Schematic_SEFIduino_Sheet-1_20181209010611.png
Schematic_SEFIduino_Sheet-1_20181209010611.png (873.57 KiB) Viewed 7736 times
#30699
The Atmega2560 has some great hardware features that make the 8cyl sequential injection a snap. You can use the Timers in a set it and forget it routine. Need 5.025 milliseconds of injector on time for the cylinder event. Just set whichever Timer output for that long, toggle it, and 5.025 milliseconds later it'll automatically toggle back. Thus turning that injector back off. It really takes a ton of processing overhead out of the routine. You can set all the Timer outputs for different durations. Different on times. And the hardware will toggle all the injector outputs off without the need to schedule it in your routines. So I used Timers 1, 3 and 4 for injectors. Timer 5 is used for ignition since none of the ignition "on" events overlap. Plus none of the ignition "off" events overlap. So Timer 5 "A" is used for turning on coils and Timer 5 "B" turns them off. Which coil is being manipulated is controlled with a sequencer routine. Technically there is enough hardware on the Arduino Mega to run 10cyl Sequential injection + coil on plug. You just have to skimp on other features.
I really don't understand why Arduino chose to breakout the chip like they did. I would of much rather used Timer 1 for the ignition, but it doesn't have all the pins I needed at the headers. So I went with Timer 5. Timer 1 has higher priority interrupts.
Another thing that I'm using in my design is parallel NVRAM. Using the memory controller on the Atmega2560 I added 32KB to the memory. Since it is NVRAM I treat it like EEPROM, but read it like RAM. Super slick. Though the chip I chose is very spendy > $15. You'll want one that is fast so you can read it quickly. I dumped all my tables into it and just read what I need at the moment. Gives me the option to have large tables. If they are 8 bit tables there can be 32 - 32x32 cell tables. If you double it to 16 bit tables then you still can get 16- 32x32 cell tables. Right now I'm experimenting with just a 16x24 cell tables. Problem is more cells in a table take more time to run through the sorting routine. Right now I have all my VE, Ignition, fuel trims and O2 (two of them) the same size. It saves time sorting.
Another reason to use the NVRAM chip. You don't have to load your tables into memory on startup. Saves a ton of time and programming. Once the chip gets power all the data is right there ready to access. Truly a powerful feature to use.
#30707
I like the new approaches, and not thinking about it much, have some questions and comments:
race_ready_z wrote: Wed Dec 12, 2018 10:20 am... Just set whichever Timer output for that long, toggle it, and 5.025 milliseconds later it'll automatically toggle back. Thus turning that injector back off. It really takes a ton of processing overhead out of the routine. You can set all the Timer outputs for different durations. Different on times.
So, does this method still allow for setting the crank end-point for the injections? And allow for fuel trim per-injector?
race_ready_z wrote: Wed Dec 12, 2018 10:20 am... Timer 5 is used for ignition since none of the ignition "on" events overlap. Plus none of the ignition "off" events overlap.
Ignition events do not overlap on single-coil with clipped events, but definitely do on multi-coil where 7 of 8 coils (or 3 of 4 waste-spark) can be dwelling and the 8th in spark burn. How is that handled?
race_ready_z wrote: Wed Dec 12, 2018 10:20 am... You just have to skimp on other features.
What would be lost? Idle, boost control, VVT? Would there be a choice of which to keep that are important to a particular setup?
race_ready_z wrote: Wed Dec 12, 2018 10:20 am... Gives me the option to have large tables. If they are 8 bit tables there can be 32 - 32x32 cell tables. ... Right now I have all my VE, Ignition, fuel trims and O2 (two of them) the same size. It saves time sorting.
With interpolation, table size is far less important and generally more burden (for the system as well as tuning) than benefit at this level, IMO. Have you dropped interpolation requiring large tables? Also, primary tables should be the same size, as they directly relate to each other; with ignition directly related to the VE condition, and O2 directly related to both at any given point of operation. Different-size primary tables makes tuning and coordination of function much more difficult IMO.

David
#30726
So, does this method still allow for setting the crank end-point for the injections? And allow for fuel trim per-injector?
Yes, if you wanted to have a set end-point, or shut-off point for the injectors you can do that. It's done very much the same as with Speeduino's scheduling system. You calculate the pulsewidth needed. Say 5.025 milliseconds. State when you want it to close. Find Find your RPM. Figure out how many degrees 5.025 milliseconds are. Subtract that many degrees from the closing point to get the opening point. Set the Timer for 5.025 milliseconds. Trigger that injector at that opening (starting) point. After that the hardware takes control and turns that injector off 5.025 milliseconds later. Accuracy is better than any software timing scheduler in terms of injector on time. The best software schedulers can vary pulsewidths in the neighborhood of 100 microseconds or more, plus or minus. With the hardware timer if you want 5.025 millisecond duration. You will get exactly that reguardless what the processor is doing. And you save many hundreds of clock cylces leveraging the hardware timers for the injectors.
As for fuel trims. Absolutely. You can have a trim for every injector separately. You start with a base pulse width. Say 5.025 milliseconds. Injector "A" has a -0.025 trim. Injector "B" has a +0.025 trim. Injector "C" has a +0.050 trim. And so on. So say injector "A" in on Timer 4 "A", injector "B" is on Timer 4 "B" and injector "C" is on Timer 4 "C". You'll set Timer 4 "A" for 5.000 milliseconds. Timer 4 "B" for 5.050 milliseconds. Timer 4 "C" for 5.100 milliseconds. You just continue the process for as many injectors as you have. Course you have to calculate the starting point for every injector separate if you want your end points to all hit on certain "crank-end points".
Ignition events do not overlap on single-coil with clipped events, but definitely do on multi-coil where 7 of 8 coils (or 3 of 4 waste-spark) can be dwelling and the 8th in spark burn. How is that handled?
I guess I need to apologize for poor wording. What I was saying is that there are no points in a typical running 4 stroke automotive engine where more than one coil gets turned on at the same time as another. Nor will there be more than one coil that gets turned off at the same time as another. Once a coil is on there is no interaction needed from the controller until it is time to turn it off. So, yes you are correct there can be multiple coils charging (dwell) at the same time. You can turn coil "A" on, than 2 milliseconds later turn on coil "B", and so on. There are usually never multiple coils in similar state of transition at a given moment. At least none that will require super precision.
As for handling the ignition coils. I used a simple sequencer routine. Figure out how much charge time (dwell) you need. Get your RPM. Figure out milliseconds per degree. Get ignition timing point. Subtract total degrees (charge time and ignition timing). Set Timer 5 "A" to trigger the selected coil on. Then for the next cylinder do the same thing. Load that info into Timer 5 "A", and so on. The sequencer keeps track of which coil needs to be turned on. Timer 5 "A" keeps track of when.
What would be lost? Idle, boost control, VVT? Would there be a choice of which to keep that are important to a particular setup?
This is a question with the idea of a 10 cylinder sequential injection plus 10 coil ignition in mind. It really comes down to available pins and timers. Here's an example of the Arduino Mega and my current board pin usage.
Analog inputs = 8
External memory = 17
I2C = 2
SPI = 4
Serial Data = 2
Crank input = 1
Cam input = 1
Just with that I'm at 35 pins used out of 70 available. That's half of them and we still don't have injectors, coils or anything else.
Idle stepper = 2
Injectors up to 8
Coils up to 8
Fuel pump = 1
Fan relay = 1
Clutch = 1
High current = 2
Tach output = 1
Staged injector = 1
NOS switch = 1
Boost control = 1
PWM out = 1
That puts us up to 63 pins used. With no pin left for usable PWM functions. So than you have to decide what you want. Yes, I know there is a unused PWM still there. It's just that you'll need that timer for other routines. Other than the 1 usable PWM pin you have 7 other available I/O pins. So if you want VVT control, that's a PWM pin. Need PWM to run a coolant fan? Gonna have to skip either the boost controller or VVT. That's what I'm getting at when I say that you'll have to skimp on something. You just end up running out of pins. Add two more coils and another injector for 10 cylinders. That's 3 more pins. Puts you down to just 4 pins left open.
With interpolation, table size is far less important and generally more burden (for the system as well as tuning) than benefit at this level, IMO. Have you dropped interpolation requiring large tables? Also, primary tables should be the same size, as they directly relate to each other; with ignition directly related to the VE condition, and O2 directly related to both at any given point of operation. Different-size primary tables makes tuning and coordination of function much more difficult IMO.
As for the table size. I'm just giving examples. There is tons of flexiblity with the external memory. In my experience tuning a 8x8 table for VE and ignition just isn't enough. Yes, I know what you're saying about interpolation. You use it regardless of table size. Well, unless you have a really poorly designed ECU. A 8x8 table set will get the job done. Once you get into street engines that are really dialed up you end up having to compromise on tuning points. You'll be really surprised at how crazy a VE curve of an engine can get. Especially with turbo engines. Try getting a turbo running at 3+ bar to behave with just 8x8 VE and ignition tables. You end up having to dial the power back for safety. Drivability suffers. And you will spend a fair amount of time sliding tuning points around trying to balance things out. With 16x16 tables that same setup will make more power safely. Not to mention the street manners will vastly improve. Once you tune high power engines with larger tables you will not want to go back.
Going from a 16x16 table to a 32x32 table. That I will agree that you don't gain as much as going from a 8x8 to a 16x16. In terms of tuning.
From the processor side of things. Yes, increasing table size increases processor overhead. You have more points to sort through. Having different sized tables, primary verses other tables creates some difficulties. Which once you step up to larger primary tables. In ways it's better to make other related tables the same size (what I was hinting at originally and what you commented on). The external memory allows that. So you only need one sort routine for all equal sized tables with the same x and y identifier points. Once you sort things out grabbing the data is just as fast with a 8x8 table as it is with a 64x64 table, or a 4x4 table. With 32KB of external memory that gives you enough space for up to 32 tables with 1024 cells (32x32) in each table. Don't need that many cells. How about up to 128 different tables with 256 cells (16x16) per table. That's the kind of added power that gives you. Plus there is no rule saying all the tables have to be the same. You can have some 16x16, others 4x16 and yet others 8x8. It's all in how much time someone wants to spend in developing things. Plus what your needs are.

Hoping that I was able to answer your questions.
#30735
Awesome! Thanks for the comprehensive responses. I look forward to more background, dev and and direction on your ideas, and perhaps it deserves a new thread that that titles it more accurately.
8-)
David
Ignition Angle doubled?

I review each and every setting as you did, but I […]

Doesn't look like you can edit posts? Correct. […]

BMW E23 M30B28

Don't forget, you can always fall-back to the &[…]

The basetunes were on so old version that they did[…]

Still can't find what you're looking for?