View previous topic :: View next topic |
Author |
Message |
Werner
Joined: 27 Sep 2004 Posts: 30 Location: Germany
|
Posted: Mon Jan 31, 2005 1:43 pm Post subject: |
|
|
Hallo Luciano,
do your Ignition System work with a "short" or a "long" delay?
- short: PickUp at maximum degree shift, ignition between PickUp and top dead center.
- long: PickUp at minimal degree shift, next Ignition between maximun degree shift and PickUp.
> Step 3.
> 2.The best way to do that is to use a table which contains previously
> calculated delay values and to use the timer value as the index to
> access the values in the table. (The table contains 8 bit constants values
> stored in the flash memory of the micro).
with precalculated timer values a 8bit table will imo not work properly.
At 12.000 rpm 1° is a delay of 0.01389 ms. With 24° adjust area (RD500 for example) your delay-table-value has to be 288 at 1000 rpm. (Timer-frequency = 72kHz, 1degree resolution). Maybe i'm wrong.
How do you handle lower rmp values during startup?
Also the allocation from rmp in the table is unfavourable when using a kind of timer values as index.
The timer-value runs with 1/rmp. This couses that your can't get equal rmp-steps in your table. If you have a 250 rpm-step at 1000 rpm, you will have a 3000 rpm-step at 12000 rpm. To reach a 250 rpm-step at 12.000 rpm you have to start your table with a stepsize of 21 rpm at 1000 rpm.
> * * * * *
> Some advices:
> - Do your math outside the micro (multiplication and divisions), and use
> a table of previously calculated delay values.
When using a "short-delay-system" this is the only way.
In a "long-delay-system" you can calculate them at the µC. At 12000 rpm and 16MHz Clock you have at least 80.000 processor-cycles in one rpm. Thats enough to do the calculation.
> - Build with a microcontroller a circuit that simulate pickup signals
> (square signal) and simulate the engine speed variations. (0 to 15000
> RPM).
full ack!
> - Use an oscilloscope to debug and verify your ignition circuit.
> (Using the pickup signal simulator debug and verify your ignition circuit
> without the engine).
full ack!
Install your System step by step.
1) Test at labratory
2) Test the labratory system connect to the Powersuply of your motorcycle.
Check if it will work during the motor runs with the orginal ignition.
3) install a second PickUp and do test 2 again.
4) >- Be careful while testing.
*****
I would do it in this way
1) PickUp store the values of a timer and start timer new. (Roundtime)
2) calculate 0.2 degree Value (Roundtime/1800)
3) look in Table for next lower Roundtime -> read degree-value (Roundtime-dregree array)
4) calculate: roundtime - (0.2Value * degree value)
5) store in Timer-Compare
6) Time-Compare Interrupt generate ignition spark
Anmekungen:
- In (3) you can also read the next lower and higher roundtime and a lower and higher degree-value in order to do an interpolation
- I use a 24bit Timer (16bit + 8bit expand)
- Roundtime/1800 can aproximated by Roundtime/256/7 or by an add- and shift-opperation (Roundtime/256/8 * (1 + 1/8 ))
- the seek and lookup in (3) has the benefit, that you have no rpm=1/Roundtime Problem. You can define your rpm-steps free.
Ciao,
Werner |
|
Back to top |
|
|
Werner
Joined: 27 Sep 2004 Posts: 30 Location: Germany
|
Posted: Tue Feb 01, 2005 8:31 am Post subject: |
|
|
Hello Larry,
> If I can help, Please let me know.
can you descripe you realisation further?
Is it, what I called, a long or a short delay system?
CDI or TCI Ignition? (TCI == Transistor controled ignition)
If TCI, how Do you generate the load time of the coil?
Which Datatype du you use in the table - 8/16bit?
Is the table precalculated?
Is the timing affected by a throttle sensor?
Ciao,
Werner |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Tue Feb 01, 2005 3:30 pm Post subject: |
|
|
Hi Lasse!
Before you read this post please read my previous one.
(Basic concept for a CDI ignition, posted Sun Jan 30, 2005 1:02 pm).
Again, this is only a basic idea for a CDI ignition.
The following are more details about it.
CPU = Atmel AVR
fCPU= 4.00 MHZ
Timer= Synchronous 16 bit Timer1 used as input capture
Timer prescaler = 256
Timer overflows per second= 0.238418 (Timer overflow occurs after 4194.3141 ms).
Timer resolution= 0.064 ms (0.064 ms * 65536 = 4194.304 ms)
Timer1 captured values: (Some examples between 500 RPM and 15000 RPM).
RPM
==============================================================
500 / 60 = 8.33 revs/s --- 1000 / 8.33 = 120.048 ms per rev (Timer1 value = 1875)
525 / 60 = 8.75 revs/s --- 1000 / 8.75 = 114.285 ms per rev (Timer1 value = 1785)
800 / 60 = 13.33 revs/s --- 1000 / 13.33 = 75.018 ms per rev (Timer1 value = 1172)
1000 / 60 = 16.66 revs/s --- 1000 / 16.66 = 60.024 ms per rev (Timer1 value = 937)
3500 / 60 = 58.33 revs/s --- 1000 / 58.33 = 17.143 ms per rev (Timer1 value = 267)
3750 / 60 = 62.50 revs/s --- 1000 / 62.50 = 16.000 ms per rev (Timer1 value = 250)
4000 / 60 = 66.66 revs/s --- 1000 / 66.66 = 15.000 ms per rev (Timer1 value = 234)
5000 / 60 = 83.33 revs/s --- 1000 / 83.33 = 12.000 ms per rev (Timer1 value = 187)
9750 / 60 = 162.50 revs/s --- 1000 / 162.50 = 6.153 ms per rev (Timer1 value = 96)
10000 / 60 = 166.66 revs/s --- 1000 / 166.66 = 6.000 ms per rev (Timer1 value = 93)
10250 / 60 = 170.83 revs/s --- 1000 / 170.83 = 5.853 ms per rev (timer1 value = 91)
11750 / 60 = 195.83 revs/s --- 1000 / 195.83 = 5.106 ms per rev (Timer1 value = 79)
12000 / 60 = 200.00 revs/s --- 1000 / 200.00 = 5.000 ms per rev (Timer1 value = 78 )
14500 / 60 = 241.66 revs/s --- 1000 / 241.66 = 4.138 ms per rev (Timer1 value = 64)
14750 / 60 = 245.83 revs/s --- 1000 / 245.83 = 4.060 ms per rev (Timer1 value = 63)
15000 / 60 = 250.00 revs/s --- 1000 / 250.00 = 4.000 ms per rev (Timer1 value = 62)
===============================================================
The table with the delay values:
In order to have dalays with 1 µs resolution we store the delay values in a wordwise
lists of values. (A table with 16 bit values). The maximal possible delay will
be 65536 µs (65.536 ms).
At 15000 RPM the engine does a revolution in 4000 µs. (360 degrees in 4000 µs).
At 15000 RPM the engine rotates of 1 degree in 11.11 µs. (4000 / 360)
At 500 RPM the engine does a revolution in 120048 µs. (360 degrees in 120048 µs).
At 500 RPM the engine rotates of 1 degree in 333.46 µs. (120048 / 360)
To access the table we use as index the value of Timer1. (The speed of the engine).
So if our table contains the values for the ignition timing from 1000 RPM to 15000 RPM
the table will use 1874 bytes of data. (937 values of 16 bit).
To every possible value of timer1 (from 0 to 937) will correspond a 16 bit value in
our table. Above 10000 RPM there is a value avery 250 RPM. Below 10000 RPM the precision
increases more and more. Below 1000 RPM the delay between the pickup signal and the spark
is fixed. (Depends from idle speed of the engine).
Enter the delay values in an Excel sheet and export them in a format ready to be
pasted in the AVR code.
Info about AVR timers:
AVR130: Setup and Use the AVR Timers
http://www.atmel.com/dyn/resources/prod_documents/DOC2505.PDF
Best regards,
Luciano |
|
Back to top |
|
|
Werner
Joined: 27 Sep 2004 Posts: 30 Location: Germany
|
Posted: Tue Feb 01, 2005 5:14 pm Post subject: |
|
|
Hallo Luciano
> Before you read this post please read my previous one.
> (Basic concept for a CDI ignition, posted Sun Jan 30, 2005 1:02 pm).
sorry when i'm appear as an advocat diabolo.
Your Timer runs with 4MHz/256 = 15.625 Hz. You can't reach the resolution and not the delay of 1µs with this configuration.
> In order to have dalays with 1 µs resolution we store the delay values in
> a wordwise lists of values. (A table with 16 bit values). The maximal
> possible delay will be 65536 µs (65.536 ms).
You get 1 µs resolution with a Prescale of "4" (you do not have). Only "1", "8" or higher provided by AVRs. 8 MHz Systemclock and a prescale ob 8 will work, but your timercounts will be 64times higher and your minimum rpm will increase to 916 rpm. The tabelsize increase too.
You could run the Roundtime in Timer1 and the Delaytime in Timer0. So you could use two different Timebases. But then you have to expand Timer0 to a 16bit Timer manually.
Another point is the Table.
It is easy to use the timercount as an index to adress the table, but it is not realy effective. 937 Values insted of 56 you will need to reach one value / 250 rpm?????
If you can't get happy with "seek and look", splitt the table.
If you increase the timerfrequency to 1MHz (1µs) the table will grow to 59968 values - if you use the timercount dircecly to adress the table.
Use only bit 7-16 in this case.
Ciao,
Werner |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Tue Feb 01, 2005 6:46 pm Post subject: |
|
|
Dear Werner,
I never said that the µs delays are implemented using a timer!
The µs delays are just SW delays.
In my example the table has 937 values and most of these are used.
More values you have and more accurate will be the ignition timing curve.
Again, this is only a basic idea for a CDI ignition.
Best regards,
Luciano
Examples of µs delays:
== 65535 µs SW delay / fCPU= 4.00 MHZ ==
LDI ZH,HIGH(65535)
LDI ZL,LOW(65535)
Count:
SBIW ZL,1
BRNE Count
==============================
== 1 µs SW delay / fCPU= 4.00 MHZ ===
LDI ZH,HIGH(1)
LDI ZL,LOW(1)
Count:
SBIW ZL,1
BRNE Count
============================== |
|
Back to top |
|
|
Werner
Joined: 27 Sep 2004 Posts: 30 Location: Germany
|
Posted: Wed Feb 02, 2005 9:26 am Post subject: |
|
|
Hello Luciano
> I never said that the µs delays are implemented using a timer!
> The µs delays are just SW delays.
ok, forgott my demur.
> In my example the table has 937 values and most of these are used.
> More values you have and more accurate will be the ignition timing curve.
The accuraty of your idea at low rpms is excellent, much better then needed. But with growing rmps your accuraty is going low and when the engine needs an exact timing most, at high rpms, its just even sufficient.
This could be realize in a better way (I think).
> Again, this is only a basic idea for a CDI ignition.
You have told it in every post.
Unless now, when should we discuss your idea? Afaik that was the intent of this thread - discussing a basic idea.
> Examples of µs delays:
I'm not a friend of delay loops and if you have a timer-compare unit in your µC it's mostly not nessesary to use one.
only an idea to think about...
- 8Mhz system clock
- using overflow interrupt to built an 24bit timer with prescale 8
- using expand byte and timer-highbyte as RPM-Count
- using compare unit and compare match interrupt to generate delay
benefit: the time you need to determine the delay-value in your table does not effect the delay-time.
Ciao,
Werner |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Wed Feb 02, 2005 3:25 pm Post subject: |
|
|
Dear Werner,
I am not building a CDI ignition yet.
The forum's thread was started by Lasse.
Feel free to expose your ideas to this forum but do not
denigrate other people's efforts and ideas.
My solution is simple to implement.
The engine speed detection resolution is accurate enough.
(See bottom of this post).
The SW µs delays are very accurate. (1 to 65536 µs).
With 1 µs delay we can reach precisions of 1/10 of engine
rotation degree. (0.1 degree).
The URL below shows the ignition timing curve of a Yamaha RD500
engine which is similar to a Yamaha RD350 engine.
(Lasse is building a CDI ignition for a Yamaha RD350 YPVS).
http://www.erlenbachracing.com/rd_rz500.htm
As you can see, the ignition timing curve of the RD500 is almost flat
after 10000 RPM.From 10000 RPM to 12000 RPM there is a 2 degrees
ignition timing variation.With my solution there are 16 ignition timing
points between 10000 RPM and 12000 RPM which are enouch to
describe a 2 degrees timing variation.
My solution is simple to implement for a beginner to microcontrollers.
Best regards,
Luciano
===================================
Speed detection resolution:
Resolution at 12000 RPM --- (12019 - 11867) = 152 RPM
Resolution at 11000 RPM --- (11029 - 10901) = 128 RPM
Resolution at 10000 RPM --- (10081 - 9973) = 108 RPM
Resolution at 9000 RPM --- (9014 - 8929) = 85 RPM
Resolution at 8000 RPM --- (8013 - 7945) = 68 RPM
Resolution at 7000 RPM --- (6996 - 6944) = 52 RPM
Resolution at 6000 RPM --- (6010 - 5971) = 39 RPM
Resolution at 5000 RPM --- (5013 - 4987) = 26 RPM
Resolution at 4000 RPM --- (4006 - 3989) = 17 RPM
Resolution at 3000 RPM --- (3005 - 2995) = 10 RPM
Resolution at 2000 RPM --- (2003 - 1999) = 4 RPM
Timer1 values from 12019 RPM to 1875 RPM (The rotation speed of the engine).
/T78=12019/T79=11867/T80=11719/T81=11574/T82=11433/T83=11295/T84=11161/T85=11029
/T86=10901/T87=10776/T88=10653/T89=10534/T90=10417/T91=10302/T92=10190/T93=10081
/T94=9973/T95=9868/T96=9766/T97=9665/T98=9566/T99=9470/T100=9375/T101=9282
/T102=9191/T103=9102/T104=9014/T105=8929/T106=8844/T107=8762/T108=8681/T109=8601
/T110=8523/T111=8446/T112=8371/T113=8296/T114=8224/T115=8152/T116=8082/T117=8013
/T118=7945/T119=7878/T120=7813/T121=7748/T122=7684/T123=7622/T124=7560/T125=7500
/T126=7440/T127=7382/T128=7324/T129=7267/T130=7212/T131=7156/T132=7102/T133=7049
/T134=6996/T135=6944/T136=6893/T137=6843/T138=6793/T139=6745/T140=6696/T141=6649
/T142=6602/T143=6556/T144=6510/T145=6466/T146=6421/T147=6378/T148=6334/T149=6292
/T150=6250/T151=6209/T152=6168/T153=6127/T154=6088/T155=6048/T156=6010/T157=5971
/T158=5934/T159=5896/T160=5859/T161=5823/T162=5787/T163=5752/T164=5716/T165=5682
/T166=5648/T167=5614/T168=5580/T169=5547/T170=5515/T171=5482/T172=5451/T173=5419
/T174=5388/T175=5357/T176=5327/T177=5297/T178=5267/T179=5237/T180=5208/T181=5180
/T182=5151/T183=5123/T184=5095/T185=5068/T186=5040/T187=5013/T188=4987/T189=4960
/T190=4934/T191=4908/T192=4883/T193=4858/T194=4832/T195=4808/T196=4783/T197=4759
/T198=4735/T199=4711/T200=4688/T201=4664/T202=4641/T203=4618/T204=4596/T205=4573
/T206=4551/T207=4529/T208=4507/T209=4486/T210=4464/T211=4443/T212=4422/T213=4401
/T214=4381/T215=4360/T216=4340/T217=4320/T218=4300/T219=4281/T220=4261/T221=4242
/T222=4223/T223=4204/T224=4185/T225=4167/T226=4148/T227=4130/T228=4112/T229=4094
/T230=4076/T231=4058/T232=4041/T233=4024/T234=4006/T235=3989/T236=3972/T237=3956
/T238=3939/T239=3923/T240=3906/T241=3890/T242=3874/T243=3858/T244=3842/T245=3827
/T246=3811/T247=3796/T248=3780/T249=3765/T250=3750/T251=3735/T252=3720/T253=3706
/T254=3691/T255=3676/T256=3662/T257=3648/T258=3634/T259=3620/T260=3606/T261=3592
/T262=3578/T263=3565/T264=3551/T265=3538/T266=3524/T267=3511/T268=3498/T269=3485
/T270=3472/T271=3459/T272=3447/T273=3434/T274=3422/T275=3409/T276=3397/T277=3384
/T278=3372/T279=3360/T280=3348/T281=3336/T282=3324/T283=3313/T284=3301/T285=3289
/T286=3278/T287=3267/T288=3255/T289=3244/T290=3233/T291=3222/T292=3211/T293=3200
/T294=3189/T295=3178/T296=3167/T297=3157/T298=3146/T299=3135/T300=3125/T301=3115
/T302=3104/T303=3094/T304=3084/T305=3074/T306=3064/T307=3054/T308=3044/T309=3034
/T310=3024/T311=3014/T312=3005/T313=2995/T314=2986/T315=2976/T316=2967/T317=2957
/T318=2948/T319=2939/T320=2930/T321=2921/T322=2911/T323=2902/T324=2894/T325=2885
/T326=2876/T327=2867/T328=2858/T329=2850/T330=2841/T331=2832/T332=2824/T333=2815
/T334=2807/T335=2799/T336=2790/T337=2782/T338=2774/T339=2765/T340=2757/T341=2749
/T342=2741/T343=2733/T344=2725/T345=2717/T346=2710/T347=2702/T348=2694/T349=2686
/T350=2679/T351=2671/T352=2663/T353=2656/T354=2648/T355=2641/T356=2633/T357=2626
/T358=2619/T359=2611/T360=2604/T361=2597/T362=2590/T363=2583/T364=2576/T365=2568
/T366=2561/T367=2554/T368=2548/T369=2541/T370=2534/T371=2527/T372=2520/T373=2513
/T374=2507/T375=2500/T376=2493/T377=2487/T378=2480/T379=2474/T380=2467/T381=2461
/T382=2454/T383=2448/T384=2441/T385=2435/T386=2429/T387=2422/T388=2416/T389=2410
/T390=2404/T391=2398/T392=2392/T393=2385/T394=2379/T395=2373/T396=2367/T397=2361
/T398=2356/T399=2350/T400=2344/T401=2338/T402=2332/T403=2326/T404=2321/T405=2315
/T406=2309/T407=2303/T408=2298/T409=2292/T410=2287/T411=2281/T412=2275/T413=2270
/T414=2264/T415=2259/T416=2254/T417=2248/T418=2243/T419=2237/T420=2232/T421=2227
/T422=2222/T423=2216/T424=2211/T425=2206/T426=2201/T427=2196/T428=2190/T429=2185
/T430=2180/T431=2175/T432=2170/T433=2165/T434=2160/T435=2155/T436=2150/T437=2145
/T438=2140/T439=2136/T440=2131/T441=2126/T442=2121/T443=2116/T444=2111/T445=2107
/T446=2102/T447=2097/T448=2093/T449=2088/T450=2083/T451=2079/T452=2074/T453=2070
/T454=2065/T455=2060/T456=2056/T457=2051/T458=2047/T459=2042/T460=2038/T461=2034
/T462=2029/T463=2025/T464=2020/T465=2016/T466=2012/T467=2007/T468=2003/T469=1999
/T470=1995/T471=1990/T472=1986/T473=1982/T474=1978/T475=1974/T476=1970/T477=1965
/T478=1961/T479=1957/T480=1953/T481=1949/T482=1945/T483=1941/T484=1937/T485=1933
/T486=1929/T487=1925/T488=1921/T489=1917/T490=1913/T491=1909/T492=1905/T493=1902
/T494=1898/T495=1894/T496=1890/T497=1886/T498=1883/T499=1879/T500=1875 |
|
Back to top |
|
|
Werner
Joined: 27 Sep 2004 Posts: 30 Location: Germany
|
Posted: Thu Feb 03, 2005 10:45 am Post subject: |
|
|
Hello Luciano
> The forum's thread was started by Lasse.
> Feel free to expose your ideas to this forum but do not
> denigrate other people's efforts and ideas.
If I would not do, that what you've called "denigrate your efforts", Lasse would try to built your "basic concept" with 8bit delay values.
I'm not the opinion that I denigrate your idea. If I do this it sounds different.
> My solution is simple to implement.
I'm not shure, but it's shurly look like the simplest possible way. There are a lot of points Lasse or someone else could do it in another way.
It's not called that the other ways are better. Maybe it's get a lower result, maybe it's better, but the work is to high and maybe it's get a higher or equal result with less work.
Discussing that is a way to come from a "basic idea" to the "best way".
By the way, your basic idea does't include am way to start the engine until yet. Do you reach 500rpm with the e- or kick-starter or will you expand the table? Then, whats with the second cylinder? 30.000 sparks for the ignition per minute or bild it 2 times and find a way to decide which cylinder is up.
> My solution is simple to implement for a beginner to microcontrollers.
Realizing a basic concept is not ever so easy as it seams to be.
At the end I have to do a correcction.
I have wrote your accuraty is just even sufficient at high rpms. Thats wrong! I've calculated the error caused by the rpm-shift inside a tablestep per round in % and forgot the recalculation to the maximum ignition shift in degree.
The error is 1.28%peak to peak (4.6 degree/round) and according to a maximum shift of 24 degree it's 0.3 degree pp.
Ciao,
Werner |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Thu Feb 03, 2005 1:01 pm Post subject: |
|
|
Hi Lasse!
I hope all this bla bla is not going to discourage you.
I wish you all the best with your CDI ignition project!
Best regards,
Luciano |
|
Back to top |
|
|
lasse2t
Joined: 14 Jan 2005 Posts: 95 Location: Sweden
|
Posted: Thu Feb 03, 2005 7:14 pm Post subject: ignition system |
|
|
"I hope all this bla bla is not going to discourage you. "
Absolutely not, Thank you all for the ideas and information about this project. I have to sort everything out now and soon i will start to build some test system.
Best regards to all of you
Lasse2t |
|
Back to top |
|
|
|