Go Down

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

#### HugoW

#45
##### Sep 27, 2016, 10:18 am
Thanks for your, message; yes, I have. I think I can build something working good enough for under 20 bucks, Speeduino is about 300 all said and done. Very nice system, but not my route.

Cheers,

Hugo

#### HugoW

#46
##### Sep 27, 2016, 12:45 pm
Hi,

well, google and Excel have been used extensively (not necessarily faultless, feel free to check) but here we go, some screen shot bits:

So, with my proposed two-sensor system, calculating RPM from the previous rev and calculating firing timing from the sensor at 300° after TDC, I think the deviation from perfect will be negligible.

In the meantime I also set up an Excel sheet with some variables, setting up a table conform those variables. This means rewriting the table is easy, and I hope I can copy the table to the Arduino software (or maybe that won't be necessary, either, working on a solution there…)

Cheers,

Hugo

#47

#### GoForSmoke

#48
##### Sep 27, 2016, 02:05 pm
It's been too long for me.

Do the linear acceleration formulas apply to radial acceleration?
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
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.

#### noisymime

#49
##### Sep 27, 2016, 02:12 pmLast Edit: Sep 27, 2016, 02:17 pm by noisymime
OK, here's a couple of things to consider...

Like I said in my last comment, I would agree 100% that 1 pulse per revolution is not enough resolution for decent ignition control. That said, it can be done with as few as about 4 per revolution, though obviously more will be better.

One thing you haven't considered is including a 2nd derivative prediction into your angle calculation. Currently you're using the speed (RPM ) from the last full revolution, plus a position reference (your 300* ATDC marking) to calculate angle. What you can also be doing though is calculating the difference between the last full revolution and the one before that to give you the current acceleration (acceleration being the 2nd derivative of position) which you can then also factor into your angle calculation. Whilst still not perfect, it does improve accuracy doing periods of high acceleration.

Just a couple of other things to consider...
• Dwell time really should be increased and decreased depending on battery voltage. May not affect you too much on the bike, but if your cranking voltage drops significantly you will want to be taking that into account.
• You probably want to increase your dwell during cranking. It will make starts considerably easier
• Cranking is easily the hardest time to get the ignition angle accurate, particularly with a low resolution trigger. Cranking RPM can literally double from say 150 to 300 rpm within the space of 180 crank degrees as one cylinder comes off compression etc. If you do stick with the low resolution trigger, consider doing some sort of fixed timing that is aligned with the incoming trigger pulses.

For what it's worth, this is a bike running fueling and ignition on an Arduino Mega. Not sure how your acceleration would compare to this, but it's definitely possible:
https://www.youtube.com/watch?v=vP6OyaqV7WA[/list]

#### dafyddclaud

#50
##### Sep 28, 2016, 02:12 pm
Hello Hugo,
Thank you for your reply.
Due to my very poor internet facilities I am not able to stay on line for long periods so some what limited with regards to reading long strings of letters.
The engines that I usually play with are low revving engines & mainly very old ones.
However I do own a BMW R80 that I am building from a pile of bits in boxes, possibly similar to what you are doing from what I can understand from your posts.
I have got a fixed ignition sketch working that programs a Suffolk Punch lawnmower engine.
The system works OK & the ignition is fixed.
However I am writing another sketch although I have not finished it by far but like you I am working with two position sensors  at present they will be hall sensors but I may well experiment with two IR sensors.
One of the reasons why I have decided to use two sensors on the same annulus is because I feel that for low running engines or for starting an engine accurate plotting of TDC is important.
Especially when there is no starter motor available.
So if the two sensors are sharing the same parallel centre line & are located at say 3 & 9 o clock respectfully then they are going to sense at the same time.
So the way that I am thinking is this
That if at only one point in one cyclic revolution there is a missing magnet or blanked hole then the sensors will read some thing like this
***************************************************
int hallsensor1 = 2;
int hallsensor2 = 3;

hallstate1=digitalRead(2);
hallstate2=digitalRead(3);

void loop() {
int readsensor1 = digitalRead( hallsensor1 );
int readsensor2 = digitalRead( hallsensor2 );

if(readsensor2 == HIGH && readsensor1 == LOW )
***************************************************
This is my way of finding TDC quickly & accurately without  having to turn the engine a few times to find & locate it.
Because a whole load of engines do not have a starter motor fitted to them & I am aware of voltage drops & starters that turn engines too slowly for the processor to receive accurate data for plotting TDC for starting.
I am sure that it is not perfect but I hope that when time allows this sketch will give me a firm base to work from.
In this way I can use one sensor for plotting TDC whilst the other is counting & marking position for advancing the ignition.
I will be using time & a count of magnets or IR led detections per revolution to do this rather than use & plot RPM.

However, interestingly I am thinking on these lines too.
An ignition system where the ignition is set at say 30 degrees before TDC.
But to advance the ignition timing from a pot attached to the throttle pedal or twist grip.
So when the throttle is shut off the timing is at say 5 degrees BTDC
But as the throttle is advanced the timing is moved forward.
I am sure that it is possible to obtain about 40 to 70 degree advance through the above mentioned idea.
You are welcome to view my work if it is any help to you.
DafyddClaud

#### dafyddclaud

#51
##### Sep 29, 2016, 11:15 am
Good morning,
When I first started Suffuino the ignition timing was set at around 10 degrees before top dead centre.
She started on the second pull of the stating cord. However, she would not accept throttle, eventually I had to advance the static timing to around about 30 degrees before she would accept full throttle.
To add from my last letter.
Although at present I have not played with advancing the ignition timing. Possibly using an encoder would be more accurate than using a potentiometer for advancing the ignition timing.
DafClaud.

#### HugoW

#52
##### Sep 30, 2016, 01:32 pmLast Edit: Sep 30, 2016, 02:16 pm by HugoW
Thanks for sharing that, Dafydd. I will study it more later.

In the meantime, I have made a hideaous Excel sheet about deviations from desired igtionion timing using the TDC sensor to measure RPM, and count microseconds from a 300-degree after TDC pulse to trigger the spark. I don't know how to post an Excel, so you get a screen shot:

Let me try to explain:
In the top section, I calculate the difference between one revolution to the next, based on current rpm and acceleration value. So the engine turns one revolution @6k rpm, the next will be 1.10% faster with the mentioned accelleration of 225 revs per second per second.
I had the accelleration constant through the rev range, I now changed that to mimic the power curve.

The lower section compares where the ignition should be based on current rpm and accelleration value, and where it will be when we use the value of the previous rev and count from a trigger at 300 degrees after TDC.

So you see at 1k rpm (which is below idle, BTW) it deviates 3.5 degrees from ideal, about 18%. Above 3k rpm, both the degrees and the percentage are under 1.

So all in all, I think the system with two sensors, one at TDC and one at 300 degrees after, should work. This is all at maximum accelleration, less hard accelleration will decrease the deviation even further. And hard accelleration I never do at low revs, as the engine just doesn't deliver power in the range below 4k rpm. I have not included part load advance, as part load means lower accelleration to begin with.

Please chime in and let me know your thoughts...
Cheers,

Hugo

#### dafyddclaud

#53
##### Oct 03, 2016, 10:18 am
Good morning Hugo,
By the way is your engine a four stroke?
So why have you chosen 300 degrees after TDC as a starting point?
Interestingly 300 degrees is 10/12's of 360.

However, if one is to look into the larger picture then is 360 degrees to one cycle correct to be using?
Because the crankshaft has to be turning twice to complete a one full cycle so may be 720 degrees is more appropriate.

My Suzuki van does not use a crankshaft sensor, it uses a camshaft sensor only.
In My Suzuki's case 360 degrees is a very good way of calculating position & timing.

If you are after a simple ignition system that does work why not consider an encoder spliced into the throttle mechanism may be a good route to go down & to interrogate & to research into.

You ought to be able to plot & map with reference to counts according to throttle position only.
Later on one could then fit a pressure vacuum sensor inside the manifold to over rule the amount of advance according to engine load.

Hope that helps
Dafydd Claud.

#### HugoW

#54
##### Oct 04, 2016, 09:18 am
Hi Dafydd,

It is a 2 cylinder four stroke, 400cc Suzuki. But I want to use wasted spark instead of a double system which needs to keep track of which cylinder is at which stroke.

I choose 300 after TDC because advance will always be after that point, but not too far after that. So it cancels out a large portion of the mistake made by using the precious rpm time to calculate the new spark time under hard acceleration.

I am looking into not using a map, but a limited amount of if/else rules. Working on that in document form, no clue yet as how to translate that to Arduino language, but one step at a time.

Cheers,

Hugo

#### dafyddclaud

#55
##### Oct 04, 2016, 12:41 pm
Hello Hugo,
So your engine is a 180 degree twin?
If so a wasted spark system will work admirably.

If you read my posts in the Speeduino forums it will show you some of my fears & findings with regards to using permanent magnets Under '' First project''.

Some how I am not convinced about your ideas regarding using 300 degrees as a starting point though.
If you like I can post you my very simple sketch that I have developed.
But also the new sketch that I am working on with regards to using two hall sensors & 12 magnets minus one magnet to locate position & starting a count.
Obviously this sketch uses both ''if & else''.
However, I am also looking into using a sketch based on ISR's with the above system.

For me & because I am interrogating engines with no starter motor, an easy start is very important.
So a fixed position point for timing (spark & fuelling by injection)  is essential.
Because the engine on a cord or a starting handle can only be turned a certain amount of times before things get rather sticky.

Like I have said for my small engine to start easy & to rev up to say 3000 RPM I have to set the timing at around about 30 degrees before TDC.
Any further advancements to the ignition system, will result in engine damage, mainly on my small engines starting mechanism.
Due to kick back.

Hope that helps
Dafydd Claud.

#### HugoW

#56
##### Oct 04, 2016, 01:13 pmLast Edit: Oct 04, 2016, 01:20 pm by HugoW
Thanks, I'll look into your Speeduino forum posts. Would you be so kind as to 'shoot' (positively) on my write-up of my idea as I post below. It has a start function included, BTW, as my engine has electric start only.

Getting Arduino to spark…

Static timing of the engine defined in degrees vs revs:
Below 1650rpm advance is 20°.
Above 1650 and below 3500rpm advance goes from 20° to 40°.
Above 3500rpm below 12k rpm advance is 40°.

Load specific timing of the engine defined in degrees vs MAP below ambient air pressure:
Below 0.135 bar advance is 0°.
Above 0.135 bar and below 0.406 bar advance goes from 0° to 10°.
Above 0.406 bar advance is 10°.

Load specific timing of the engine defined in degrees vs volts from MAP 555 sensor:
Above 4.325V advance is 0°.
Below 4.325V and above 2.970V advance goes from 0° to 10°.
Below 2.970V advance is 10°.

There is one Hall sensor in the engine, mounted at TDC. On the crank, there is a trigger of 300 degrees of the rotation. So, the Hall sensor changes from low to high at TDC, and back from high to low at 300 degrees after TDC.

What the software should do:

Set all values to zero to start off with.
At TDC write RevTimeCounter value, reset and restart RevTimeCounter, and set Coil to high (coil starts charging).
Convert RevTimeCounter to RPM: devide 60 seconds though RevTimeCounter value.
If StarterPin = high, write MechAdvance is 5
else
If RPM < 1650, write MechAdvance is 20
else
If 1650 < RPM < 3500, write MechAdvance = map 1650-3500 / 20-40.
Else
If RPM > 3500, write MechAdvance = 40
Read MAP555 value.
If StarterPin = high, write LoadAdvance = 0
If MAP555 > 4.325 write LoadAdvance = 0
else
If 2.970 > MAP555 > 4.325 write LoadAdvance = map 4.325-2.970 / 0-10
else
If MAP555 < 2.970 write LoadAdvance = 20
Add LoadAdvance to MechAdvance to get TotalAdvance.
Subtract: 60 degrees - TotalAdvance = SparkDegree
Convert SparkDegree to SparkTiming using RPM value.
Wait for Hall sensor to become low; start SparkTimeCounter.
When SparkTimeCounter reaches SparkTiming value, set Coil to low and reset SparkTimCounter to zero.

I believe this should make a functioning program, although I have yet to find the Arduino functions to make it all work.

Hugo

#### dafyddclaud

#57
##### Oct 05, 2016, 01:14 pm
Good morning Hugo,
Thank you for your latest letter & your latest thoughts.
May I remind you of what I have discovered with regards to my findings.
1
Suffuino is a Suffolk Punch lawn mower engine that dates back to 1950.
She is a side valve engine delivering about 1 ½ hp at around about 3000 RPM.
2
I did set the timing at around about 1 - 2 mm BTDC. (Between 1/16 to 1/8 of an inch BTDC.).
Suffuino started on the second pull of the cord much to my surprise!
However she would not rev she just sat there idling, the moment I pulled on the throttle arm she coughed & stalled.
The only way that she would rev freely to around about 3000 RPM was for the ignition timing to be set initially at around about 30 degrees BTDC.
Now the manufacturers specify & set the timing for this engine at where I first set the ignition timing to occur!
3
Why I had to set the basic static timing to around about 30 degrees BTDC before the engine would rev freely is some thing that I am still investigating.
4
I do feel confident that it is possible to modify my basic sketch & to add an encoder to it to retard the signal from a set point.
So if I  was to set the ignition timing at around about 50 to 60 degrees BTDC then I ought to be able to retard the timing according to throttle position. That ought to give me an advance of about 30 degrees to play with.
5
What would be a huge benefit for me is to be able to simulate my sketches it would make life a whole lot easier & simpler. At present I simulate on a test bench physically & that consumes a lot of time.
At present I am using Linux Ubuntu & I personally will never ever use a windows or a Mac system if I can possibly avoid it.
6
The do feel though that my theory mentioned in paragraph 4 is a similar but possibly simpler version of what you are working towards.
At present this is only a theory that I have thought of after reading your latest letter that you have posted on the forum.
Time will tell if it is possible to add & to be able to modify my simple sketch to preform this duty. Although I do feel confident that it is possible.
From what I have read I do feel that it is possible for your system to work & to work properly. Although I do need a little more time to study your thoughts with regards to what you have written & posted before I make any comments or remarks.
In the mean time I will start to write a report for the forum & your good self as to where I am with Suffuino, it is time that I did write a report with regards to my findings.
Daf Claud.

#### dwightthinker

#58
##### Oct 05, 2016, 08:50 pm
Has anyone bothered to look at the time before
TDC instead of degrees.
I think you'll find the curve to be quite interesting.
Just a though.
Dwight

#### HugoW

#59
##### Oct 06, 2016, 08:31 am
Yes, I have after your remark a little while ago. And the graph nowhere near linear, so I went back to calculating in degrees, and convert to timing afterwards.

Cheers,

Hugo

Go Up