New CDI - opensource project JMJ and Bigboat
#926
Senior Member
Joined: Dec 2009
Posts: 106
Likes: 0
Received 0 Likes
on
0 Posts
From: , SWEDEN
Can anybody explain the prescaler config for timer0?
I would like to change it to 64 in the high rev/high resolution version of the code to get even better accuracy.
This is the line I'm talking about:
OPTION_REG = 0x06; // tmr0 SOURCE INT CLOCK, 1:128 PRESCALER
I want to try 1:64 prescaler, but the manual is not clear enough for an amateur like me..
I would like to change it to 64 in the high rev/high resolution version of the code to get even better accuracy.
This is the line I'm talking about:
OPTION_REG = 0x06; // tmr0 SOURCE INT CLOCK, 1:128 PRESCALER
I want to try 1:64 prescaler, but the manual is not clear enough for an amateur like me..

#927
Thread Starter
Senior Member
Joined: Dec 2005
Posts: 548
Likes: 0
Received 0 Likes
on
0 Posts
From: Alkmaar, NETHERLANDS
OPTION_REG = 0x06 = 128
OPTION_REG = 0x05 = 64
OPTION_REG = 0x04 = 32
OPTION_REG = 0x03 = 16
OPTION_REG = 0x02 = 8
OPTION_REG = 0x01 = 4
OPTION_REG = 0x00 = 2
OPTION_REG = 0x05 = 64
OPTION_REG = 0x04 = 32
OPTION_REG = 0x03 = 16
OPTION_REG = 0x02 = 8
OPTION_REG = 0x01 = 4
OPTION_REG = 0x00 = 2
#931
Senior Member
Joined: Feb 2010
Posts: 133
Likes: 0
Received 0 Likes
on
0 Posts
From: szarvas, HUNGARY
<span id="result_box" class="short_text"><span style="background-color: rgb(255, 255, 255);" title="Ti miért nem használ?">Why do not you use? F</span></span><span class="short_text" id="result_box"><span title="Application note" style="background-color: rgb(255, 255, 255);">igure2.3. or figure4.5.+ </span></span>Precedent<span class="short_text" id="result_box"><span title="Application note" style="background-color: rgb(255, 255, 255);"> photos.Regards nyemi.
</span></span>
</span></span>
#932
Thread Starter
Senior Member
Joined: Dec 2005
Posts: 548
Likes: 0
Received 0 Likes
on
0 Posts
From: Alkmaar, NETHERLANDS
ORIGINAL: nyemi
<span id=''result_box'' class=''short_text''><span style=''background-color: rgb(255, 255, 255);'' title=''Ti miért nem használ?''>Why do not you use? F</span></span><span class=''short_text'' id=''result_box''><span title=''Application note'' style=''background-color: rgb(255, 255, 255);''>igure2.3. or figure4.5. Regards nyemi.
</span></span>
<span id=''result_box'' class=''short_text''><span style=''background-color: rgb(255, 255, 255);'' title=''Ti miért nem használ?''>Why do not you use? F</span></span><span class=''short_text'' id=''result_box''><span title=''Application note'' style=''background-color: rgb(255, 255, 255);''>igure2.3. or figure4.5. Regards nyemi.
</span></span>
I don't have find any schematic like the figures 2.3 or 4.5
I see you found a schematic, but thoose schematics are all for AC-Voltage coming from trhe HV-coil into the engine.
Ground isn't ground as we use ground from a batterie.
#933

Joined: Nov 2009
Posts: 109
Likes: 0
Received 0 Likes
on
0 Posts
From: AK, NEW ZEALAND
ORIGINAL: nyemi
<span id=''result_box'' class=''short_text''><span style=''background-color: rgb(255, 255, 255);'' title=''Ti miért nem használ?''>Why do not you use? F</span></span><span class=''short_text'' id=''result_box''><span title=''Application note'' style=''background-color: rgb(255, 255, 255);''>igure2.3. or figure4.5. Regards nyemi.
</span></span>
<span id=''result_box'' class=''short_text''><span style=''background-color: rgb(255, 255, 255);'' title=''Ti miért nem használ?''>Why do not you use? F</span></span><span class=''short_text'' id=''result_box''><span title=''Application note'' style=''background-color: rgb(255, 255, 255);''>igure2.3. or figure4.5. Regards nyemi.
</span></span>
there is some interesting application notes in there all the same....thanks
#935
Senior Member
Joined: Feb 2010
Posts: 133
Likes: 0
Received 0 Likes
on
0 Posts
From: szarvas, HUNGARY
<span id="result_box" class="short_text"><span style="background-color: rgb(255, 255, 255);" title="Ez okoz hálál">This cause of death SCR!!?? </span></span><span class="short_text" id="result_box"><span title="Jól érteni.">
</span></span>
</span></span>
#936

Joined: Nov 2009
Posts: 109
Likes: 0
Received 0 Likes
on
0 Posts
From: AK, NEW ZEALAND
ORIGINAL: Bigboat
That is only theorie, not realistic.
I don't have find any schematic like the figures 2.3 or 4.5
I see you found a schematic, but thoose schematics are all for AC-Voltage coming from trhe HV-coil into the engine.
Ground isn't ground as we use ground from a batterie.
ORIGINAL: nyemi
<span id=''result_box'' class=''short_text''><span style=''background-color: rgb(255, 255, 255);'' title=''Ti miért nem használ?''>Why do not you use? F</span></span><span class=''short_text'' id=''result_box''><span title=''Application note'' style=''background-color: rgb(255, 255, 255);''>igure2.3. or figure4.5. Regards nyemi.
</span></span>
<span id=''result_box'' class=''short_text''><span style=''background-color: rgb(255, 255, 255);'' title=''Ti miért nem használ?''>Why do not you use? F</span></span><span class=''short_text'' id=''result_box''><span title=''Application note'' style=''background-color: rgb(255, 255, 255);''>igure2.3. or figure4.5. Regards nyemi.
</span></span>
I don't have find any schematic like the figures 2.3 or 4.5
I see you found a schematic, but thoose schematics are all for AC-Voltage coming from trhe HV-coil into the engine.
Ground isn't ground as we use ground from a batterie.
Rob those circuits have a diode on one side which you would get DC from wouldnt you
nyemi i need to try some more protection for the SCR you are correct.....especially when experimenting
brett
#937
Senior Member
those circuits have a diode on one side which you would get DC from wouldnt you
If you are talking about the two diodes in series then yes that would rectify the ac voltage.
#938
Senior Member
Hi Brett,
Two diodes in series make a half wave rectifier. Not very efficient. 4 diodes in the normal pattern make a full wave bridge rectifier. From My experiments the full wave rectifier is most efficient.
Two diodes in series make a half wave rectifier. Not very efficient. 4 diodes in the normal pattern make a full wave bridge rectifier. From My experiments the full wave rectifier is most efficient.
#939
Senior Member
Joined: Dec 2009
Posts: 106
Likes: 0
Received 0 Likes
on
0 Posts
From: , SWEDEN
Here is an example of code I wrote and tested that gives good resolution and very low rpm cotrol.
The expression in bold text makes it possible to read an endless array with delay values. Code delay with this solution is 80us.
The limitation is the amount of memory. I'm running timer0 at 1:64frequency, and when I generated values down to 1000rpm, the memory wasfull.
However, on low RPM engines, there is no need to run timer0 faster than1:128, so this could actually give a good result for all engine typeswhen it comes to ignition accuracy.
The best thing would be if it was possible to rescale the rpm positionson low rpm. Now there are almost infinite number of values for low rpm.The resolution is actually rediculous on low rpm's..
Creating the enormous amount of values in Excel also demands some reworking of the sheet..
I also tried a multiplication factor on the number of tspark[255] times a constant from owerflows without enlarging the array, but I could not get it to work..
Well, just food for thought
while(1){ //Loop forever
ofc=0; // Reset overflow teller
INTCON = 0x00; // Disable interrupts + Resets interrupt flags
while(PORTB & 0x02){ //Wait for low pulse on Hall switch
if (INTCON&4) { // Overflow
ofc++; //Increase overflow counter
INTCON = 0x00; // Resets interrupt flags
} // End IF
spark = 1;
} //North pole of magnet has passed
if(spark){
t0 = TMR0;
TMR0 = 0; //Start new rev count
if(ofc > 0) t0=t0+(ofc*255); //
tspk = tspark[t0]; //use table lookup for spark delay
T1CON = 0x05; // start TMR1 counter 1:1 using internal clock 1MHz
TMR1H = 0; // Reset timer1 high
TMR1L = 0; // Reset timer1 high
do //start of timing loop
{Hi(t1)=TMR1H; // read timer1 Low bits and add to timer variable
Lo(t1)=TMR1L; } // read timer1 High bits and add to timer variable
while(t1 < tspk); // loop until timeout to send spark
PORTB &= 0xee; //sends a ground to the SCR gate
Delay_us(1650); // Calculated delay
PORTB |= 0x11; //ground off the SCR
spark = 0;
} // end if(spark)
} // end while(1)
The expression in bold text makes it possible to read an endless array with delay values. Code delay with this solution is 80us.
The limitation is the amount of memory. I'm running timer0 at 1:64frequency, and when I generated values down to 1000rpm, the memory wasfull.
However, on low RPM engines, there is no need to run timer0 faster than1:128, so this could actually give a good result for all engine typeswhen it comes to ignition accuracy.
The best thing would be if it was possible to rescale the rpm positionson low rpm. Now there are almost infinite number of values for low rpm.The resolution is actually rediculous on low rpm's..
Creating the enormous amount of values in Excel also demands some reworking of the sheet..
I also tried a multiplication factor on the number of tspark[255] times a constant from owerflows without enlarging the array, but I could not get it to work..
Well, just food for thought

while(1){ //Loop forever
ofc=0; // Reset overflow teller
INTCON = 0x00; // Disable interrupts + Resets interrupt flags
while(PORTB & 0x02){ //Wait for low pulse on Hall switch
if (INTCON&4) { // Overflow
ofc++; //Increase overflow counter
INTCON = 0x00; // Resets interrupt flags
} // End IF
spark = 1;
} //North pole of magnet has passed
if(spark){
t0 = TMR0;
TMR0 = 0; //Start new rev count
if(ofc > 0) t0=t0+(ofc*255); //
tspk = tspark[t0]; //use table lookup for spark delay
T1CON = 0x05; // start TMR1 counter 1:1 using internal clock 1MHz
TMR1H = 0; // Reset timer1 high
TMR1L = 0; // Reset timer1 high
do //start of timing loop
{Hi(t1)=TMR1H; // read timer1 Low bits and add to timer variable
Lo(t1)=TMR1L; } // read timer1 High bits and add to timer variable
while(t1 < tspk); // loop until timeout to send spark
PORTB &= 0xee; //sends a ground to the SCR gate
Delay_us(1650); // Calculated delay
PORTB |= 0x11; //ground off the SCR
spark = 0;
} // end if(spark)
} // end while(1)
#940

Joined: Nov 2009
Posts: 109
Likes: 0
Received 0 Likes
on
0 Posts
From: AK, NEW ZEALAND
Charlie
if you only use half the diodes or even just one to rectify the AC wont that give you a higher output voltage as the peaks would still
be there alittle ?
thanks for helping sam, i havnt got a timing board and power board together yet for testing,
brett
if you only use half the diodes or even just one to rectify the AC wont that give you a higher output voltage as the peaks would still
be there alittle ?
thanks for helping sam, i havnt got a timing board and power board together yet for testing,
brett
#941
Senior Member
Hi Brett,
NO. With a half wave rectifier (2 diodes) you still have some ripple and that is bad because that is current that is not being used. If you want to really increase the voltage try a voltage doubler.
NO. With a half wave rectifier (2 diodes) you still have some ripple and that is bad because that is current that is not being used. If you want to really increase the voltage try a voltage doubler.
#942

My Feedback: (8)
Joined: Feb 2009
Posts: 231
Likes: 0
Received 0 Likes
on
0 Posts
From: Washington, PA
OK
With help from gr8flyer I think I have finalized the circuit I want to build. I'm going to keep the transformer secondary voltage around 400 volts, but all the components on the power board will be rated at 600 volts or better except the 1N4007 (1000 volts). I eliminated everything except what is needed to fly an airplane. The goal is for easy starts at 300 RPM and advance up to 10,000 RPM, even though the engines seldom see 8500 RPM. Shielding is still a concern but I wont really know until i get it built. I notice the Chinese CDI's are fully shielded, but the Zenoah ignitions have the coil, spark plug wire and cap unshielded. We'll get it figured out.
gr8flyer is helping me with coil. Once I have that I'll finalize the PCB layout and start etching. I'll post progress as I go.
Al Z
With help from gr8flyer I think I have finalized the circuit I want to build. I'm going to keep the transformer secondary voltage around 400 volts, but all the components on the power board will be rated at 600 volts or better except the 1N4007 (1000 volts). I eliminated everything except what is needed to fly an airplane. The goal is for easy starts at 300 RPM and advance up to 10,000 RPM, even though the engines seldom see 8500 RPM. Shielding is still a concern but I wont really know until i get it built. I notice the Chinese CDI's are fully shielded, but the Zenoah ignitions have the coil, spark plug wire and cap unshielded. We'll get it figured out.
gr8flyer is helping me with coil. Once I have that I'll finalize the PCB layout and start etching. I'll post progress as I go.
Al Z
#944
Senior Member
Joined: Feb 2010
Posts: 133
Likes: 0
Received 0 Likes
on
0 Posts
From: szarvas, HUNGARY
<span class="short_text" id="result_box"><span title="Látni fejleszt program,új ötlet.">Software develop a new idea(PWM-CDI). </span><span title="Két link:">Two links:1. http://btelectronic.sweb.cz/cdi2.htm 2. http://veyrat.perso.neuf.fr/allumage_electronique.htm
</span></span>
</span></span>
#945

Joined: Nov 2009
Posts: 109
Likes: 0
Received 0 Likes
on
0 Posts
From: AK, NEW ZEALAND
Speaking to a TV technician today says we should not be using a SCR for switching but a transistor, there are heaps of good transistors in old TV sets hi voltage and current
he said with a SCR the Gate has to be discontented and maybe even the Anode or cathode to stop a lock up, where as with a transistor it wont lock on the same,
Also i think what ever you put into the circuit is what you can get out , to a degree
my circuit draws 100-150 ma's ....... this is why i think i have a weak looking spark even below 10,000 rpm
Even the commercial units draw between 350 and 600 ma's ( http://www.ch-ignitions.com/faq.html )
An intense spark is performance as far as i am aware and a weak spark is what i already had with the flywheel and magnet setup
the motor can run fine with a weak spark But will run alot better with a full powerful spark or even twin plug setup as on my microlight.
http://www.youtube.com/watch?v=QpevOS0VQmk
Brett
he said with a SCR the Gate has to be discontented and maybe even the Anode or cathode to stop a lock up, where as with a transistor it wont lock on the same,
Also i think what ever you put into the circuit is what you can get out , to a degree
my circuit draws 100-150 ma's ....... this is why i think i have a weak looking spark even below 10,000 rpm
Even the commercial units draw between 350 and 600 ma's ( http://www.ch-ignitions.com/faq.html )
An intense spark is performance as far as i am aware and a weak spark is what i already had with the flywheel and magnet setup
the motor can run fine with a weak spark But will run alot better with a full powerful spark or even twin plug setup as on my microlight.
http://www.youtube.com/watch?v=QpevOS0VQmk
Brett
#947

My Feedback: (8)
Joined: Feb 2009
Posts: 231
Likes: 0
Received 0 Likes
on
0 Posts
From: Washington, PA
ORIGINAL: nyemi
<span class=''short_text'' id=''result_box''><span title=''Látni fejleszt program,új ötlet.''>Software develop a new idea(PWM-CDI). </span><span title=''Két link:''>Two links:1. http://btelectronic.sweb.cz/cdi2.htm 2. http://veyrat.perso.neuf.fr/allumage_electronique.htm
</span></span>
<span class=''short_text'' id=''result_box''><span title=''Látni fejleszt program,új ötlet.''>Software develop a new idea(PWM-CDI). </span><span title=''Két link:''>Two links:1. http://btelectronic.sweb.cz/cdi2.htm 2. http://veyrat.perso.neuf.fr/allumage_electronique.htm
</span></span>
Interesting stuff.
I was particularly interested in the second link since it is an RC airplane application.
Some comments & observations (food for thought):
1. Uses a zener for on-board voltage regulation.
2. He's bringing the Hall sensor (I assume it's a Hall) into the RB1 pin of the PIC so obviously the programming is quite different than the circuit in our discussion.
3. He's using a 100 volt, 1.5 amp surface mount MOSFET for the oscillator.
4. He also uses a surface mount bridge rectifier (no part number specified). Surface mounting makes for neater layout but PIA soldering.
5. Uses a thyristor to fire the plug - no component specified.
6. No RFI shielding!????[>:]
7. No feedback winding on transformer required with this circuit.
8. Current consumption did not translate well to English, here it is:
15 mA - 0 RPM
220 mA - 3000 RPM
270 mA - 6000 RPM
Just a quick look at the other link I noticed they use two MOSFET's in the oscillator and a thyristor to fire the plug. I guess a thyristor is the right device for this application.
Al Z
#948
Senior Member
Joined: Feb 2010
Posts: 133
Likes: 0
Received 0 Likes
on
0 Posts
From: szarvas, HUNGARY
Software support two links:1.www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator 2.www.mikroe.com/en/books/pic-books/mikroc/ch3/#c3v7
#949
Thread Starter
Senior Member
Joined: Dec 2005
Posts: 548
Likes: 0
Received 0 Likes
on
0 Posts
From: Alkmaar, NETHERLANDS
I'm not sitting stil, this is wat I want for the new CDI.
I hope soon the guys will go to program
I hope soon the guys will go to program
#950

Joined: Nov 2009
Posts: 109
Likes: 0
Received 0 Likes
on
0 Posts
From: AK, NEW ZEALAND
Rob that looks good, what hz did you make it oscillate at ? 3khz is a nice number
i was thinking of using a 555 timer for switching the primary coil, can the pic be programed to do the same i guess ???
and i like the IGBT driver haha , all moden day heavy duty igniter coil's use this transistor
Thanks nyemi for the links........ what language is it ???
brett
i was thinking of using a 555 timer for switching the primary coil, can the pic be programed to do the same i guess ???
and i like the IGBT driver haha , all moden day heavy duty igniter coil's use this transistor
Thanks nyemi for the links........ what language is it ???
brett



