Arduino Forum

Using Arduino => Project Guidance => Topic started by: HugoW on Aug 24, 2016, 01:59 pm

Title: Motorcycle ignition advance, simple project?
Post by: HugoW on Aug 24, 2016, 01:59 pm
Hi,

I've fiddled a bit with Arduino basic stuff, and my bigg plans for an EV controller have stumbled upon legislation, so that has never really taken off. I am in the mean time working on a custom motorcycle, and I feel the ignition needs some improvement. It has no part-load advance. Here's what I like to do with Arduino:
Measure revolution time (1 puls per revolution generated).
Look up standard advance the ignition degrees conform a table as a result of rpm
Devide measured revolution time by 360 degrees and multiply by advance value just looked up plus 180 degrees (sensor opposite to TDC), and subtract dwell time.
Wait for next pulse, start revolution time counter again and start counting the just calculated number of ms, write ignition pin high, wait dwell time, write ignition pin low, done.

It will rely on two tables that I can make as detailed as possible, but could be simple to start with:
RPM < 1000 advance 18 degrees
RPM 1000 - 4000 advance 18 - 10 degrees (linear)
RPM 4000 - 8000 advance 10 - 5 degrees (linear)
RPM > 8000 advance 5 degrees

MAP value 0 - 1,5V advance 0 - 4 degrees (linear)
MAP value 1,5 - 3,5V advance 4 - 7,5 degrees (linear)
MAP value 3,5 - 5V advance 7,5 - 10 degrees (linear)

And I could split the tables into more fractions as desired.

Can this be done? The max RPM of my engine is 12k rpm (in theory, never go there) and I require only one spark, it's a 2 cilinder and I will fire a dual coil with waisted spark. Hooking everything up mechanically and sensor-wise I can do.

Thanks for input,
Cheers,

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: MorganS on Aug 24, 2016, 02:15 pm
An Arduino is possibly not the best choice for this. There are chips specifically built as ECU computers. They build in a lot of hardware features that make this work easy.

There have been many other Arduino ECU projects successfully completed. Most of them I know of were student projects on single cylinder lawnmower engines. Google can find them for you.
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Aug 24, 2016, 02:35 pm
Thanks, I have found some projects googling, even 'complete' EFI projects. Why would Arduino not be the best choice?

Cheers,

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: MorganS on Aug 24, 2016, 02:56 pm
Dedicated ECU chips keep a clock synchronized with the crankshaft. So if you want to do something at 359.9 degrees, it is only one simple instruction. They also have memory optimized for large lookup tables. There are probably other features I am not aware of.

The Arduino is a general-purpose processor that is relatively old and slow. It may not be able to reach your relatively high RPM with the accuracy you require. But it is a great way to learn because it is so easy to program. There is also a good upgrade path to faster processors so you can run the same code on a processor 5 or 10 times faster than the original Arduino.
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Aug 24, 2016, 03:16 pm
Ah, OK, I understand, thanks. I will look into the faster processors, and stick to Arduino to begin with. I used MicroSquirt a long time ago when it was still open source, but that seems to be closed source now. It will be a fun project.

All input is welcome of course.

Cheers,

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: GoForSmoke on Aug 24, 2016, 03:26 pm
If you go with rolling your own gadget, time in microseconds instead of milliseconds.

Also why convert to RPM in the code? Make it time to turn, which saves you converting back and forth.

1000 rpm = 60 seconds / 1000 turns = 60000 microseconds per turn.
Halfway around is 30000 usecs, 1 degree is 167 usecs but only use that to calculate advance times!

At 12k rpm, the time from TDC to TDC will be 5000 usecs.

You can make a table with entries for how long since the last TDC, starting at 5000 and going up to 60000 by 100's and the time to delay for each (8 bytes per entry) and it should fit into a corner of flash (PROGMEM) memory instead of RAM.  In this case, lookup is a LOT faster than calculating.

So for each engine cycle the time to turn makes the time to wait, etc, directly.

Those other processors, a Teensy 3.2 safely overclocks to 96MHz (6x Uno speed) and costs less than $30 with pins, $4 less if you solder your own in (very close to tiny leads, scares me!) and is Teensy-small.

At 12k rpm, a single degree takes 14 usecs to cover. Your code has to be extremely fast to match that with an Uno. You may find the advance to be a bit late.

Note that it is possible to run 20 MHz AVRs at 24 MHz without getting them warm (I have a 24 MHz 1284P-Pro board, it rocks.) That board is 50% faster.. my fast code that runs loop() at 86 KHz on the Uno runs loop() at 125 KHz on the Pro-Badio.

125 KHz is 8 micros average loop time where 86 KHz takes 12 (11.62...). If it misses, the bit off will be about 1 degree off at 12k rpm engine speed and that is worst case right there.
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Aug 24, 2016, 03:30 pm
Great input, thanks. I also found the due R3 board at 84Mhz standard, and I will look into the Teensy 3.2. I also read about speeding up by replacing read and write comands, but I don't understand that, yet...

Keep it coming!

Cheers,

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: GoForSmoke on Aug 24, 2016, 03:48 pm
Quote
I also read about speeding up by replacing read and write comands, but I don't understand that, yet...
Many Arduino commands like pin read/write have extra 'safety' code so that they're easier to use for beginners. But it's not so hard to learn to make code that doesn't need the extra, you can read/write ports directly in less than a microsecond.

But in your code, the read should be done by an interrupt that copies the time it fired and sets a flag for the regular code to see and act upon.

I like the part where the signal happens 180 deg from when the reaction must occur. This is because the interrupt saves the time more than a millisecond before the action is taken, the code has a lot of time before it has to be ready. For an Uno, I liken 1 ms to an hour for a human, 16000 clock cycles per ms.

Be sure that there are gate-array chips that could do this job down to nanoseconds accuracy.
Title: Re: Motorcycle ignition advance, simple project?
Post by: GoForSmoke on Aug 24, 2016, 04:22 pm
If you do try with AVR's, this could probably run on an 8-pin ATTiny85 with crystal. We have the core files, you can program it on a breadboard with an Uno for programmer using the MIT High/Low tech site instructions.

Nick Gammon has an excellent, full-help blog page on making breadboard 'duinos with the best software I've used for the job yet. He is thorough, not just every step but alternate paths and hardware covered fully.

Nicks Microprocessor blogs menu page. (http://www.gammon.com.au/scripts/forum.php?bbtopic_id=123)

The breadboard duino page. (http://www.gammon.com.au/breadboard)

If you go through Nick's site you will find the full how-to and why for loads of AVR apps. He even shows how to drive TV and VGA interfaces using 328P chips (used in Uno, Mini, Nano).

One thing I find helpful is keeping my Arduino bookmarks in a folder. When I open the IDE to code I also open a browser and a tab for each web page I reference. When I need to double-check or look anything up, it's usually a tab away if not right up front. Best part, I can zoom the pages to where I don't have to squint or grab the magnifier visor like I do with books (so easy to read 20 years ago!) and boards -- that's right, I need a magnifier to get the jumper in the right 10 per inch hole.
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Aug 24, 2016, 04:26 pm
I still have a lot to learn... But loving it already! Can I let you all in on a little secret? I 'm thinking of a board that can hold for instance two Teensies. One doing the ignition timing, the other actuating some injectors for say, fuel... The board would hold all electronics to convert and clean up signals going in and coming out. At first I would only use the ignition module with the carbs still on the bike, adding the fuel system later. I made a very simple MegaSquirt variant a long time ago, running only RPM, MAP and O2 sensor (and motor temp, to avoid use of the O2 sensor with a cold engine). It didn't even have a TPS! It only gave problems when revving up too quickly, opening the butterfly valves to quick. I fixed that my mounting an RC car coil-over damper to the mechanism, avoiding the opening going to quick. I could press the pedal as quick as I liked, the damper would reduce the speed if it was too quick to the EFI's liking. I am thinking of doing the same this time... But that is still a long way away.  Let's get the sparky project going first.

Cheers,

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Aug 24, 2016, 04:53 pm
Hmmm, cannot edit previous post;

just wanted to add that although very interesting, with items like the Teensies for sale I will not go and build my own boards. Maybe later, but I feel I have set myself quite a challange already with the spark project, and going to full (basic) EFI would be next and a lot more difficult.

Cheers,

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: GoForSmoke on Aug 24, 2016, 04:59 pm
The fuel injectors don't fire anywhere near spark time, a single Teensy 3.2 should be more than enough to handle that engine. That's a 32-bit ARM with 64K RAM, it should be overkill.

Do you have a regular Arduino now?
If you read the magnet sensor (please use a Hall switch, not a reed switch!) and generate a strobe with a led that only fires at spark time, is there somewhere on the engine you can see if it synchs steady? That would give you a measure of how well that chip can keep up... or not.

Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Aug 24, 2016, 07:38 pm
Haha, a reed switch at 12k rpm would be funny! Hall of course it is.

I am looking at making a wiring tap on the current ignition module and sending data to my regular Uno. Tap the signal coming from the sensors on the crank, and tap the signals sent to the coils. I cannot see if having any form of load adjustment, but I think it might have some basic curve in it. I would like the Arduino to tell me the rpm and the degrees of crank rotation difference between crank pulse and coil pulse. This way I can see if it has a curve, and if so what it is. And since (again) I think there is no load adjustment, I can do this revving the engine without riding the bike. Which in itself will be quite a challange, as the bike is in 34856724934762847539 pieces on the floor. But it will be a bike again within the next few decades weeks.

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: GoForSmoke on Aug 24, 2016, 09:34 pm
When current flows it makes a field, a linear Hall sensor might pick up even weak pulses.

I like the idea of using the controller to read the operation of the bike before using it to control the operation. How well you do at the one job may tell if the other is possible.

Remember that all of these events take enough time that you can probably get that data too and not just a set of start points.

Be aware that printing to serialwill impact your sketch speed if you overfill the serial output buffer.
Best to do is use the highest baudrate you can (running 1.6.9 my serial is 250000 baud), keep the messages short and don't print lines per milli.
Title: Re: Motorcycle ignition advance, simple project?
Post by: dwightthinker on Aug 25, 2016, 01:15 am
You might also look into using one of the analog
sensors used to pick up wheel motion on car's ABS
systems.
These are ruggedized to handle both vibration and
temperature.
You need to have something like a zero cross circuit
to read into the uP.
Dwight
 
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Aug 25, 2016, 03:00 pm
The engine aleady has some sort of sensory system instead of point, so I hop to use those. That would be the easiest.

And with a bit of help I found the basic curve on the motor (without vacuum advance):
20 degrees below 1650 rpm
40 degrees above 3500 rpm
So I won't make a table for the rpm vs advance numbers, making five if-then-else rules will already make it possible to make the curve more detailed then it is now!

Cheers,

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Aug 26, 2016, 11:53 am
Well, starting the count / setting the trigger signal at 180 degrees from TDC proves not to be very useful, I better start counting. With a dwell time of 4000us (micro symbol?!?) I get a negative amount of us about 6.700 rpm! Setting the trigger / starting the count at TDC leaves a bit more time. I'll see if I can post the excel I made about it.

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Aug 29, 2016, 04:38 pm
Spanner in the works; on a forum about the bike I am building I am advised to say away from tuning these engines. They are air cooled and prone to cracking the heads even without tuning. Adding advance ignition will increase combustion efficiency, and therefor temperature. Without controlled cooling (liquid cooling with a thermostat) it is best to stay away from tuning...

Bummer...

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: GoForSmoke on Aug 30, 2016, 06:16 am
Time to find an old engine to improve. Perhaps a lawnmower or chainsaw engine.
If it breaks, not a big loss and you won't be riding it.
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Aug 30, 2016, 02:25 pm
Well, I am looking into adding oil cooling to the engine, see whether that makes a significant change to running temperatures. If I can manage the temperature, I feel comfortable adding performance.

Cheers,

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: dwightthinker on Aug 30, 2016, 06:29 pm
You might include temperature of the heads as one of the
parameters of timing.
Dwight
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Aug 31, 2016, 04:17 pm
True, but it kinda voids the idea. I wanted to add 'vacuum advance' to make it run more efficient. When the engine is cold it is not running efficient because it is cold, and when it gets warm I get to cancel the added advance to avoid it running hot, cancelling the effect of making it more efficient. Hmmmm, I'd like some experience numbers on this engine when it gets to tune-ability. Back to the GSResource forum...

Cheers,

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: GoForSmoke on Aug 31, 2016, 06:28 pm
See about water-methane injection to cool the air charge going into the cylinder, it worked on supercharged fighter engines in WWII.
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Aug 31, 2016, 08:28 pm
Or add nitrous. No, I'd like to stick to pump gas. I have some plans but until I feel comfortable the engine is up to it, the electronics bit is in the waiting room.

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: GoForSmoke on Aug 31, 2016, 10:33 pm
Nitrous is a whole nother thing. MW only mediates heat.
I remember seeing water-injection for my old Type-3 VW. It ran best in rain as it was.

Title: Re: Motorcycle ignition advance, simple project?
Post by: trewjohn2001 on Sep 03, 2016, 10:01 am
Spanner in the works; on a forum about the bike I am building I am advised to say away from tuning these engines. They are air cooled and prone to cracking the heads even without tuning. Adding advance ignition will increase combustion efficiency, and therefor temperature. Without controlled cooling (liquid cooling with a thermostat) it is best to stay away from tuning...

Bummer...

Hugo
Tuning means a lot of things to a lot of people.  One of the biggest advantages of Electronic ignition and fuel injection  vs Clockwork timing and "leaky bucket" fuel mixing is the drivability.  Peak power might not be higher but you don't get as many flat spots or dips in the delivery.

There are a lot of dedicated RPM chips that use inductive pickups that you could use to take the load off the Arduino. 
Title: Re: Motorcycle ignition advance, simple project?
Post by: noisymime on Sep 05, 2016, 03:59 am
Whilst the AVRs obviously have a disadvantage when it comes to pure clock speed, MCUs like the 2560 do have a bit going for them compared to a lot of the newer ARM chips. They're 5v (Automotive sensors are traditionally almost all 5v), have a heap of built in EEPROM and a stack of timers available.

If you are going down this path, it's the timers that make the whole thing possible on an AVR. There is definitely enough accuracy and speed to do it on these chips, but if you try to force it all in the main program loop then you're going to have a bad time.

With you're triggering, if you want proper advance control, you're going to need more resolution than 1 pulse per RPM. The bare minimum I'd recommend for ignition control is 4 per RPM, but more is better. Wheels like the 36-1 are common as they give you both the crank position and the RPM with good resolution.
Title: Re: Motorcycle ignition advance, simple project?
Post by: dwightthinker on Sep 07, 2016, 02:29 am
One thing you might want to plot out before doing much more.
Plot out the time delay for the different advances.
You might be surprised at how flat the time delay was.
Dwight
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Sep 23, 2016, 04:18 pm
Well, I've done some math (actually Excel did...). I do'n't quite know how to put it in words decenlty, but I hope you'll understand. Working with only a TDC sensor will not work at all:

Maximum accelleration:
12000 revs per minute per second =>
200 revs per second per second =>
0,000200 revs per second per µs                                    
                                       
At 1k rpm one rotation takes 60.000 µs, so with 0,00002 revs per µs, maximum of 12 revs is added in the estimated revolution following the one at 12k rpm.                                       
At 12k rpm one rotation takes 5000 µs, so with 0,00002 revs per µs, maximum of 1 rev is added in the estimated revolution following the one at 12k rpm.                                       

So a decent 64-1 wheel is certainly required, maybe 32-1, and the thing will need to do the math VERY quickly.

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: GoForSmoke on Sep 23, 2016, 11:06 pm
12000 revs per minute per second
That is an acceleration term with mixed time units

Quote
200 revs per second per second =>
0,000200 revs per second per µs      
Is the max acceleration at 12K rpm 200 revs/sec/sec?
                        
Quote
At 1k rpm one rotation takes 60.000 µs, so with 0,00002 revs per µs, maximum of 12 revs is added in the estimated revolution following the one at 12k rpm.                                       
At 12k rpm one rotation takes 5000 µs, so with 0,00002 revs per µs, maximum of 1 rev is added in the estimated revolution following the one at 12k rpm.   
Except that acceleration compounds the speed. The increase will be *moar*.

What's the difference between spark advance at 12000 rpm and 12001 rpm and why does that need special handling?

Fast calculations? You don't need to calculate at run-time what you can pre-calculate and table in flash and look up in a few cycles at run-time.
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Sep 24, 2016, 12:47 pm
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.

Cheers,

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: GoForSmoke on Sep 24, 2016, 02:01 pm
You are able to show that maximum acceleration adds a small number of rpm per rev, yes?

And the change in advance ---

Quote
Running rpm between 1650 to 3500 rpm, static advance should increase from 20 to 40 degrees, linear with the rpm increase.
(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.
Title: Re: Motorcycle ignition advance, simple project?
Post by: trewjohn2001 on Sep 24, 2016, 04:27 pm
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.   

 
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Sep 24, 2016, 04:43 pm
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.

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: trewjohn2001 on Sep 24, 2016, 08:03 pm
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. 
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Sep 25, 2016, 10:32 am
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:
At TDC:
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.

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: trewjohn2001 on Sep 25, 2016, 12:09 pm
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. 
Title: Re: Motorcycle ignition advance, simple project?
Post by: trewjohn2001 on Sep 25, 2016, 12:30 pm
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. 
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Sep 25, 2016, 01:07 pm
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.

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: trewjohn2001 on Sep 25, 2016, 01:53 pm
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. 

LM2907:


http://www.ti.com/lit/an/snaa088/snaa088.pdf



Title: Re: Motorcycle ignition advance, simple project?
Post by: GoForSmoke on Sep 25, 2016, 02:35 pm
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?
Title: Re: Motorcycle ignition advance, simple project?
Post by: trewjohn2001 on Sep 26, 2016, 07:44 am
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:

http://scottsnowden.co.uk/category/arduino-ecu/
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Sep 26, 2016, 01:02 pm
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.


Shoot!

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: dwightthinker on Sep 26, 2016, 10:03 pm
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
table.
Dwight
 
Title: Re: Motorcycle ignition advance, simple project?
Post by: dafyddclaud on Sep 27, 2016, 10:04 am
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
Dafydd
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on 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
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on 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:

(http://i1215.photobucket.com/albums/cc511/hugoenmonique/Hugo%20s%20vliegalbum/Accelleration%20deviation%20at%2001000%20rpm_zpsc9cmfkx5.jpg)

(http://i1215.photobucket.com/albums/cc511/hugoenmonique/Hugo%20s%20vliegalbum/Accelleration%20deviation%20at%2002000%20rpm_zpsl7tpjh5k.jpg)

(http://i1215.photobucket.com/albums/cc511/hugoenmonique/Hugo%20s%20vliegalbum/Accelleration%20deviation%20at%2005000%20rpm_zpsxqhyfxh3.jpg)

(http://i1215.photobucket.com/albums/cc511/hugoenmonique/Hugo%20s%20vliegalbum/Accelleration%20deviation%20at%2007500%20rpm_zpskk8wczkf.jpg)

(http://i1215.photobucket.com/albums/cc511/hugoenmonique/Hugo%20s%20vliegalbum/Accelleration%20deviation%20at%2010000%20rpm_zpskq0urhip.jpg)

(http://i1215.photobucket.com/albums/cc511/hugoenmonique/Hugo%20s%20vliegalbum/Accelleration%20deviation%20at%2012000%20rpm_zpsn61iirve.jpg)

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
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Sep 27, 2016, 01:25 pm
Just for my own memory, here's one to integrate:
http://www.learningaboutelectronics.com/Articles/Piezo-knock-sensor-circuit.php

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: GoForSmoke on Sep 27, 2016, 02:05 pm
It's been too long for me.

Do the linear acceleration formulas apply to radial acceleration?
Title: Re: Motorcycle ignition advance, simple project?
Post by: noisymime on Sep 27, 2016, 02:12 pm
Title: Re: Motorcycle ignition advance, simple project?
Post by: dafyddclaud on 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
Title: Re: Motorcycle ignition advance, simple project?
Post by: dafyddclaud on 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.
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Sep 30, 2016, 01:32 pm
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:

(http://i1215.photobucket.com/albums/cc511/hugoenmonique/Hugo%20s%20vliegalbum/Accelleration%20deviation%20overview_zpsjfq7wh5v.jpg) (http://s1215.photobucket.com/user/hugoenmonique/media/Hugo%20s%20vliegalbum/Accelleration%20deviation%20overview_zpsjfq7wh5v.jpg.html)
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
Title: Re: Motorcycle ignition advance, simple project?
Post by: dafyddclaud on 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.
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on 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
Title: Re: Motorcycle ignition advance, simple project?
Post by: dafyddclaud on 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.


Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on Oct 04, 2016, 01:13 pm
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
Title: Re: Motorcycle ignition advance, simple project?
Post by: dafyddclaud on 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.
Title: Re: Motorcycle ignition advance, simple project?
Post by: dwightthinker on 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
Title: Re: Motorcycle ignition advance, simple project?
Post by: HugoW on 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.

(http://i1215.photobucket.com/albums/cc511/hugoenmonique/Hugo%20s%20vliegalbum/SparkTimingGraph_zpsee9uy15p.jpg) (http://s1215.photobucket.com/user/hugoenmonique/media/Hugo%20s%20vliegalbum/SparkTimingGraph_zpsee9uy15p.jpg.html)

Cheers,

Hugo
Title: Re: Motorcycle ignition advance, simple project?
Post by: dafyddclaud on Oct 06, 2016, 10:00 am
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

Good morning,
Your recent letter keeps interrupting my normal breakfast routine.
I keep thinking about what you have written over & over again.
With regards to my simple ignition system.

My question,  why is it that when I set the ignition timing according to the manufactures specification that the engine does not rev freely?

I got around it by advancing the attack angle physically, that is, by advancing the hall sensor, so that is will see the magnet earlier by about 30 degrees BTDC.

For the last say 6 months I have known that it is not the processor, the Ardino is doing its duty & doing it well.
I compromised, I physically patched up what I should of written inside my sketch.

Because I have not allowed for the period of TIME for COIL EXCITATION!

Regards
Dafydd Claud.
Title: Re: Motorcycle ignition advance, simple project?
Post by: dafyddclaud on Oct 06, 2016, 11:39 am
Good morning,
Your recent letter keeps interrupting my normal breakfast routine.
I keep thinking about what you have written over & over again.
With regards to my simple ignition system.

My question,  why is it that when I set the ignition timing according to the manufactures specification that the engine does not rev freely?

I got around it by advancing the attack angle physically, that is, by advancing the hall sensor, so that is will see the magnet earlier by about 30 degrees BTDC.

For the last say 6 months I have known that it is not the processor, the Ardino is doing its duty & doing it well.
I compromised, I physically patched up what I should of written inside my sketch.

Because I have not allowed for the period of TIME for COIL EXCITATION!

Regards
Dafydd Claud.
Good morning, Again,
OK!
What I wrote about earlier is almost BOLLOCKS!

But thanks to you I sure that this time I have definitely worked out where I have gone wrong with my ignition sketch.

I have allowed for coil excitation time. Because if I had not then I would not get a spark!
And I do get good quality multiple sparks!

But within my sketch I have energised the ignition coil in the wrong place.
I need to energise the ignition coil about 2 to 6 milliseconds before the Hall sensor sees the magnet!
I have not done so!

I am charging the ignition coil when the Hall sensor sees the magnet. That is to late by 2 to 6 milliseconds.
Even using my lawn mower engine running at between 700 to 3000RPM this is a critical miscalculation !!!

Think I know how to rectify the problem, unfortunately more to follow.

Hope that this is of help for others that are planning a similar system.
 

Regards
Dafydd Claud Miggiano.
Title: Re: Motorcycle ignition advance, simple project?
Post by: dafyddclaud on Oct 12, 2016, 09:47 am
// read RPM

volatile int rpmcount = 0;//see http://arduino.cc/en/Reference/Volatile
int rpm = 0;
unsigned long lastmillis = 0;

void setup(){
Serial.begin(9600);
attachInterrupt(0, rpm_fan, FALLING);//interrupt cero (0) is on pin two(2).
}

void loop(){

if (millis() - lastmillis == 1000){ /*Uptade every one second, this will be equal to reading frecuency (Hz).*/

detachInterrupt(0); //Disable interrupt when calculating

rpm = rpmcount * 60; /* Convert frecuency to RPM, note: this works for one interruption per full rotation. For two interrups per full rotation use rpmcount * 30.*/

Serial.print("RPM =\t"); //print the word "RPM" and tab.
Serial.print(rpm); // print the rpm value.
Serial.print("\t Hz=\t"); //print the word "Hz".
Serial.println(rpmcount); /*print revolutions per second or Hz. And print new line or enter.*/

rpmcount = 0; // Restart the RPM counter
lastmillis = millis(); // Uptade lasmillis
attachInterrupt(0, rpm_fan, FALLING); //enable interrupt
}
}

void rpm_fan(){ /* this code will be executed every time the interrupt 0 (pin2) gets low.*/
rpmcount++;
}


**********
Good morning,
Attached is a sketch that I personally like the feel of.
It compiles, so I am presuming that it does work properly.
However what I really like about it is the thought behind the sketch.
It has an interrupt attached, it can measure RPM, & it demonstrates how to update information every second with a hertz plotter too.
Hope that is of assistance
DafClaud.


Title: Re: Motorcycle ignition advance, simple project?
Post by: dafyddclaud on Oct 15, 2016, 10:18 am
Harley Davidson
883
2007.

Good Morning Hugo,
yesterday a friend of mine visited the valley.
He was riding a Harley Davidson model 883.

What really caught my attention was that there was only 2engine sensors used
on that model of motorcycle.
They are a crankshaft sensor & an inlet manifold
pressure sensor measuring atmospheric air pressure & depression
due to air flow.

That model Harley has one carburettor & is not fitted with a wasted spark system.
There is no oxygen sensor,
no knock sensor &
no throttle position sensors.
Not even a Temperature sensor of any kind.

Interesting!!

DafClaud.
Title: Re: Motorcycle ignition advance, simple project?
Post by: AndersStenhammar on Jan 16, 2017, 09:42 pm
Hello.
I am working on an arduino ignition system for vw air-cooled engines. I think I am about to succeed. I may change they way I controll the advance curve by using binary search or map functions. The vw air-cooled engines may not need the high resolution advance curve that I have now.
Forum:
https://forum.arduino.cc/index.php?topic=369684.45
Website:
https://andersstenhammar.com/2016/11/04/aeroduino-ignition-versio-4-2/
Title: Re: Motorcycle ignition advance, simple project?
Post by: tombauer on Aug 03, 2017, 05:14 am
Hi all. I have scanned through the posts and unless I missed it what I find is that a lot of people fail to understand is how timing is done electronically. You cannot anticipate when the next spark should occur!
What you can do and what is done by every engine with electronic ignition like CDI, is to place a pickup at a point way before you would ever want the spark and then based on rpm delay that signal. So in effect the less delay, the more advance. This can be done several ways even with RC, but the most precise is using a PIC, I suppose you could use an Arduino as well but so far I have never seen it done.
Title: Re: Motorcycle ignition advance, simple project?
Post by: noisymime on Aug 03, 2017, 11:23 am
This can be done several ways even with RC, but the most precise is using a PIC, I suppose you could use an Arduino as well but so far I have never seen it done.
For what it's worth, this is how it's being done on Speeduino. It uses both first derivative (Speed) and 2nd derivative (acceleration) prediction from the current position in order to estimate the required dwell start time. The end dwell time (ie Spark time) is continually estimated up to the point this fires (Typically within +/-16uS).
Title: Re: Motorcycle ignition advance, simple project?
Post by: tombauer on Aug 03, 2017, 09:29 pm
Hi, Well +/- 16uS is just under 2° at over 9000 rpm so that is pretty crude timing.
Title: Re: Motorcycle ignition advance, simple project?
Post by: noisymime on Aug 03, 2017, 10:15 pm
Hi, Well +/- 16uS is just under 2° at over 9000 rpm so that is pretty crude timing.
16uS is accuracy to better than 1°, which is typically fine at those RPMs. You'd be surprised with how many OEM setups are far worse than 2 degrees @ 9k (Anything using a cam based signal for a start).

It all comes down to your trigger inputs in the end. A 60-2 crank wheel is going to be a lot more accurate than a 2 pulse per rev signal from a distributor.