Go Down

Topic: Motorcycle ignition advance, simple project? (Read 17111 times) previous topic - next topic


I've fiddled all night with Excel and the lot becomes more and more complex. And I seem to forget that the object of the excersize is to control the ignition timing, not necessarely make a very complex Arduino project. So, time to change the direction of thought.

Basic timing would be very simple:
If the starter button is activated, ignition should be at TDC.
Running rpm below 1650 rpm there is 20 degree static advance.
Running rpm between 1650 to 3500 rpm, static advance should increase from 20 to 40 degrees, linear with the rpm increase.
Above 3500 it should stay at 40 degree.
In addition, I want to advance extra due to part load, manifold pressure measured with a 555 sensor. Say 0V gives 0 advance, 5V gives 20 degrees advance.
So measuring rpm and pressure sensor value gives me an advance number.
Dwell time is 4ms.
All in all, not a lot of variables.

So what makes it difficult? Well, the accelleration does. And the high number of pulses to get an accurate rpm variance reading. Measuring only at TDC to estimate what to do in the next revolution is not enough. Measuring 32 times per revolution at 12k RPM gives a very small time between pulses to calculate anything.

But there are cars from way before the age of digital electronics with decent advance curves, arranged mechanically. But those curves are difficult to change / tune.

So, if I put a disc on the engine's crank with only one tooth and a sensor at TDC, I can register RPM. If I fit a second sensor on a (RC car) servo, which triggers the spark, I have a system which I can change.

What's the problem? Well, very little, as far as I can tell now. The only thing would be dwell time, as I should actually start charging the coil 4ms before sparking. This could be recalculated into the equasion, as 4ms at 1000rpm is 24 degrees, at 12k 4ms is 288 degrees. And that is linear through the rev range.

Mechanically I can fit the sensors, wheel and servo fairly easely. The system could be fairly simple and wouldn't require a lot of programming, I think.

Feel free to shoot at the idea.




You are able to show that maximum acceleration adds a small number of rpm per rev, yes?

And the change in advance ---

(3500 - 1650) / 20 = 92.5 is the range of rpms that get each degree of advance.

In that 1650 to 3500 rpm range you need to add 90 rpm to need any change in advance.

It is less than +90 rpm per advance degree at 10000 to 12000 rpm?

At 12000 rpm it takes 5000 usecs per rev, 13.8 usecs per degree timing to be exact but two things:

1) AVR micros() has a 4 usec granularity.

2) The timing will be 13.8 usecs x the more than 40 advance degrees of 3500 rpm, yes?

IF from one rev to the next, the rpm can't change enough to warrant extra advance then changes one turn to the next based solely on rpm should be fine.

Don't bother calculating rpm. What you want is time per rev (5000+ usecs) and how much advance goes with what time. You can pre-calculate that to give a delay between TDC and spark and then if manifold pressure indicates, add a little.
But forget rpm and degrees at run-time. Turning time to rpms and back is a waste of run-time.
Make everything into terms of time alone, even the coil charge time.
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.


Hugo - am I right in thinking your going to disconnect any centrifugal/vacuum advance and move a points plate using a Servo?  Are you still keeping the points?  Or you going to be using a 5v coil pack or CDI? 
There are lots of RPM and 0-5v MAP sensors/chips available.  Bear in mind that even blipping a  free revving bike engine with no load  the rate of change of the engine speed isn't massive.  On the road that rate of change of engine speed will be even slower.  Most of the old school point replacement systems just used a hall effect and a magnetic pickup in place of the old school cam follower - again neither of those are 100% accurate.   



Nope, I clear everything off the old engine, which has a CID already. No points, mech advance, etc. I will clear our the original system and mount a wheel to the crank where the original triggers used to be. I think I will use a disk with a narrow slit in it and optical sensors. One for TDC, fixed, one moving on a servo to trigger the ignition.



Ah ok so the Arduino is not going to trigger the spark - only lookup an RPM table and move the sensor plate?  If you use a trigger at maximum advance could you not use a trigger delay circuit to change the timing rather than a servo to move the sensor? No delay =maximum advance. 


My biggest problem is the accelleration. Racing through the rpm will increase RPM rapidly, even a considerable amount inside one rev.

To really do what I want, I consider a 20 tooth wheel and a separate trigger for TDC. Just from the top of my head:
Reset Fired value to 0
Reset TurnedAngle to 0

At eacht pulse:
1) Increase TurnedAngle value with 18
2 )Determine RPM by time elapesed from previous pulse
3) Convert rpm to us/degree of rotation
4) Look up advance value for determined RPM
5) Loop up advance value for load measuring (MAP)
6) Combine two values to become DeterminedAdvance
7) Compare total value to Turned Angle value.
8) If difference is smaller than 18 degrees and bigger then zero and Fired is 0, subtract TurnedAngle from Determined Advance.
9) Convert value to us by the value found at point 3 and trigger Spark at that timing from the puls that started it all.
10) Set Fired value to 1

And loop...

This however means we have to do this all at 12krpm in 250us. And how I would determine the loading of the coil 4ms before spark would be very difficult, as in 4ms the rpm could have increased or decreased a lot.



Are you sure your engine is going to accelerate that quickly?  I don't think the RPM of the engine is going to have increased enough in 250us to need a change in timing.   RPM increase is tied to your road speed - how quickly is this bike accelerating? 

For instance on my Emerald ECU the timing can be set in 500RPM blocks and the jumps in timing are between 1 and 3 degrees. 


I think I can see what your trying to do - you want to adjust the ignition timing per combustion cycle?   I would think an F1 ECU would be capable of that.  But  if your using a servo to control it I wouldn´t think a servo motor could move fast enough.  A bit like the mechanical bob weight advance system - it won´t move much in the micro second world. 


I think my bike engine can rev fairly quickly. I said 12krpm/s previously, let's be generous and say only 6krpm/s. I know under load it might not do that, but revving the engine without load shouldn't lead to serious misfires. It then increases 100 revs per second per second. So 0,036 degree per microsecond. So in 250 microsecond, I'd only be 9 degrees off. Good. Hence my 20 triggers chosen. Should I only trigger once per 360 degrees, it could be 9x20=180 degrees off. At lower revs with the same accelleration, it would be worse.

I know the sensor-move option is not overly accurate, and it probably wouldn't be that quick. But the trigger wheel speeds up with motor revs, as it is mechanically connected. So that part is taken care of 100% accurately.



So you are firing the coil from the Arduino?  Or just controlling advance? 

If your just controlling advance - you only need to know the RPM of the engine (within 100) which is easy to do with a frequency to voltage chip and  and a Hall effect or proximity switch.  Analgoue read for RPM.  Then a look up table to see how much advance you want.  You don't need to know tdc. 




You can turn time to rpm and rpm to advance but why bother with that middle step?

Also while lookup tables are fast they can get big.

Note that the longer the rev takes, the more time you have to process so how about...

pseudocode here:

if ( usecs < 5100 ) return advance[ 120 ];
if ( usecs < 5200 ) return advance[ 119 ];
if ( usecs < 5300 ) return advance[ 118 ];
if ( usecs < 5400 ) return advance[ 117 ];
if ( usecs < 5500 ) return advance[ 116 ];
... etc

Where the actual usec compare values equate to rpm bands.
The slower the engine is running, the longer to get a return value but it has more time to act as well.

Make a project to find out how fast your servo can turn the plate.

Try also to see how long the Hall sensor pulses when the magnet goes by at different revs. An analog circuit may be used to move the advance, one that you could feed MAP as voltage into?

Also note that the sensor does not have to be located at TDC.. unless there's some TDC magic?
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.


Sep 26, 2016, 07:44 am Last Edit: Sep 26, 2016, 08:48 am by trewjohn2001
Nothing special about TDC other than its easy to find and the reference for advance. Sensor can go anywhere as long as you use a degree wheel or protractor to know where it is.  I would put trigger for the sensor on the crank should go at the maximum possible advance you might want - 40 to 50 degrees?   

This guy is onto it Hugo:



I'll look at that link soon, here's what I came up with in the mean time:

Double trigger idea, keeping the advance electronic:

One sensor at TDC (because I like TDC) and one at maximum advance, say 40° full load plus 20° part-load = 60°
At TDC pulse:
Set coil high (start charging coil)
Restart TDC counter
Read previous TDC counter value to determine RPM
Determine advance in µs after 300° (360-60)

At 300° trigger:
Start counter
After counting the determined advance µs, set coil low (FIRE!)

To charge coil / fire coil, I'd like to use a IRGB14C40L. For triggering I found some nice Hall effect sensors.




For RPM change, you can take the difference between the last
reading and the next. Divide it in half and add it to the current timing.
You will be real close.
It won't misfire but it can detonate or ping as it is called.
You might want to bias it such that if accelerating, You only add
1/4 the difference while decelerating you subtract 3/4.
I do hope you've stopped calculating time to RPM and back to time.
If you plot is out with time, you'll see that the advance curves make
more sense. After some RPM, the advance is almost a constant
time ( burn time before TDC ). Use RPM and degrees only to create the time to time


Good morning,
Have you looked up Speeduino?
If you Google it then the guys on that site have run Vee 8's on Arduino mega's  as well as  a whole host of motorcycles running on their sketches too.
Good Luck

Go Up