## Re: Arduino Based CDI

This single post is part of a larger thread. Start from the top or view this post in context.

so I've got the code done on mine; I was able to get this done with the uno, the trick for me was to use progmem.

I filled a vector full of unsigned ints representing the time to delay coil charge. This array is stored to progmem, the trick is like what you'd do to create a high resolution waveform: the array is pre-calculated so that when an overflow count of timer 1 (ctc for the hall effect pickup rising edge, 256 pre-scaler) is sent to the array's index, the array returns the correct number of ticks for the desired advance curve.

So, yeah well it works and the cool thing is you can have a very high resolution, complicated piece-wise or (initially) continuous advance curve and not need to do any costly math to get the correct delay time. This is the table I am using now, not necessarily ideal but gets the idea across:

Now since we only have a maximum of 31k or so bits, or 15k long ints to describe how to delay for the real number line of rpm b/w 0 and 16k rpm or so, the graph of expected rpm ends up looking like this:

Now an example 100hz (6000rpm) signal generator sent to the uC's ctc counter 1. Here's the logic analyzer output of the signal generator and the logic level charge pulse:

The mS delay between rising edge and falling edge = 9.18 ms (n.b. that's inclusive of the 2 mS dwell). The desired degree advance at 6000 rpm was 30 degrees btdc (using a pickup location of tdc), if you do the math:

mS per rev = 1 / (hz = 100) * 1000 = 10

and so actual degrees advance = (1 - mS Delay / mS per rev) * (360 - pickup Location) = (1-9.18/10) * (360 - 0) = 29.268 degrees

As was seen in the expected curve, the higher the engine speed, the more we see expected timing deviate from selected due to a lack of floating point accuracy.

So let's see this with a plot of the digital logic analyzer output at 200 hz, i.e. 12k rpm when the expected degree advance was 8.05ish:

The math for the 2.912 mS + 2ms dwell = 4.912 mS delay:

mS per rev = 1 / (hz = 200) * 1000 = 20

and so actual degrees advance = (1 - mS Delay / mS per rev) * (360 - pickup Location) = (1-4.912/20) * (360 - 0)

= 6.336 degrees and error = 1.6 ish degrees

is that ok guys? lol

now, to make: some clamping circuits so this can be triggered by points or pickup coils or whatev, a curve artist interface and/or field adjustable interface (edited)

This single post is part of a larger thread. Start from the top or view this post in context.
Subject Written By Posted
Arduino Based CDITopic by: Mars   10/26/12 03:41PM
Re: Arduino Based CDIRe: Josh G 10/26/12 03:48PM
Re: Arduino Based CDIRe: Mars   10/26/12 03:55PM
Re: Arduino Based CDIRe: Mars   10/26/12 04:06PM
Re: Arduino Based CDIRe: Nele Sudar 10/26/12 04:17PM
Re: Arduino Based CDIRe: Thenggregy Cawilan 08/06/20 06:45PM
Re: Arduino Based CDIRe: 🇮🇹💦 Of the Loin 08/07/20 07:18AM
Re: Arduino Based CDIRe: Cooper Hennick 10/26/12 05:54PM
Re: Arduino Based CDIRe: Jake Beckman 10/26/12 06:44PM
Re: Arduino Based CDIRe: M-Tenn Aaron 10/26/12 07:00PM
Re: Arduino Based CDIRe: Nele Sudar 10/26/12 07:40PM
Re: Arduino Based CDIRe: Jason Collier 10/27/12 12:26AM
Re: Arduino Based CDIRe: Dominic Valentino 10/27/12 12:46PM
Re: Arduino Based CDIRe: Ϫ‡☄ಬ∞ ƀƖḬƝƊ ƤǂƿƎ ∞ಬ☄‡Ϫ - Hoke from Black Pipes Moped Gang 10/29/12 12:43AM
Re: Arduino Based CDIRe: Deadped Ryan 10/27/12 02:40PM
Re: Arduino Based CDIRe: Dominic Valentino 10/27/12 06:24PM
Re: Arduino Based CDIRe: Deadped Ryan 10/27/12 03:26PM
Re: Arduino Based CDIRe: Mars   10/27/12 03:35PM
Re: Arduino Based CDIRe: NB0tt aholetechbro 10/27/12 03:41PM
Re: Arduino Based CDIRe: Mars   10/27/12 03:49PM
Re: Arduino Based CDIRe: Deadped Ryan 10/27/12 06:36PM
Re: Arduino Based CDIRe: will warn 10/27/12 08:31PM
Re: Arduino Based CDIRe: Adam Russell 10/28/12 08:38AM
Re: Arduino Based CDIRe: Adam Russell 10/28/12 09:10AM
Re: Arduino Based CDIRe: Mars   10/28/12 06:56PM
Re: Arduino Based CDIRe: Mars   10/28/12 11:50PM
Re: Arduino Based CDIRe: 1 1 10/28/12 11:44PM
Re: Arduino Based CDIRe: Chris B 10/29/12 10:02AM
Re: Arduino Based CDIRe: Mars   10/29/12 10:44AM
Re: Arduino Based CDIRe: Paul Dehmer 10/29/12 08:45PM
Re: Arduino Based CDIRe: Time Warner 10/31/12 07:43PM
Re: Arduino Based CDIRe: Cooper Hennick 11/01/12 11:14AM
Re: Arduino Based CDIRe: Mars   11/02/12 12:55AM
Re: Arduino Based CDIRe: Sickster 6 11/02/12 01:42PM
Re: Arduino Based CDIRe: Mars   11/02/12 01:52PM
Re: Arduino Based CDIRe: Dill . 11/03/12 01:12PM
Re: Arduino Based CDIRe: Time Warner 11/02/12 07:57PM
Re: Arduino Based CDIRe: Deadped Ryan 11/03/12 02:07PM
Re: Arduino Based CDIRe: Dill . 11/06/12 09:46AM
Re: Arduino Based CDIRe: Dominic Valentino 11/06/12 09:50AM
Re: Arduino Based CDIRe: Mars   11/06/12 10:29AM
Re: Arduino Based CDIRe: Peter Fondue 11/06/12 01:52PM
Re: Arduino Based CDIRe: M∆®†Y Køk€š 11/14/12 10:27AM
Re: Arduino Based CDIRe: M∆®†Y Køk€š 11/20/12 01:57AM
Re: Arduino Based CDIRe: Deadped Ryan 11/20/12 09:36AM
Re: Arduino Based CDIRe: Alejandro Schröeder 11/21/12 07:19PM
Re: Arduino Based CDIRe: Mars   11/22/12 10:53AM
Re: Arduino Based CDIRe: *.* HONDA 11/22/12 08:44PM
Re: Arduino Based CDIRe: Dill . 11/22/12 01:12PM
Re: Arduino Based CDIRe: M∆®†Y Køk€š 11/24/12 02:44AM
Re: Arduino Based CDIRe: Mars   11/30/12 11:22PM
Re: Arduino Based CDIRe: Dominic Valentino 12/14/12 12:18AM
Re: Arduino Based CDIRe: Dominic Valentino 12/14/12 12:35AM
Re: Arduino Based CDIRe: Dominic Valentino 12/14/12 09:05AM
Re: Arduino Based CDIRe: Mars   12/14/12 09:54AM
Re: Arduino Based CDIRe: The Blisster 12/14/12 01:08PM
Re: Arduino Based CDIRe: Mars   12/16/12 12:44AM
Re: Arduino Based CDIRe: 1 1 12/16/12 12:50AM
Re: Arduino Based CDIRe: M∆®†Y Køk€š 12/16/12 02:06AM
Re: Arduino Based CDIRe: Mars   12/16/12 02:26PM
Re: Arduino Based CDIRe: M∆®†Y Køk€š 12/16/12 03:28PM
Re: Arduino Based CDIRe: Mars   12/16/12 04:23PM
Re: Arduino Based CDIRe: peter heid 11/16/14 07:52AM
Re: Arduino Based CDIRe: Dominic Valentino 12/16/12 04:49PM
Re: Arduino Based CDIRe: Mars   12/16/12 05:21PM
Re: Arduino Based CDIRe: Dominic Valentino 12/16/12 06:00PM
Re: Arduino Based CDIRe: Ryan Mayer 12/16/12 09:11PM
Re: Arduino Based CDIRe: SABAT! andDestroy 12/16/12 11:27PM
Re: Arduino Based CDIRe: Mars   12/16/12 11:34PM
Re: Arduino Based CDIRe: M∆®†Y Køk€š 12/17/12 12:25AM
Re: Arduino Based CDIRe: Dominic Valentino 12/17/12 12:51AM
Re: Arduino Based CDIRe: The Blisster 12/18/12 02:15PM
Re: Arduino Based CDIRe: Mars   12/18/12 02:22PM
Re: Arduino Based CDIRe: Ryan Mayer 01/15/13 06:38AM
Re: Arduino Based CDIRe: Mars   01/15/13 09:19AM
Re: Arduino Based CDIRe: Dominic Valentino 01/15/13 11:37AM
Re: Arduino Based CDIRe: SABAT! andDestroy 01/15/13 11:30AM
Re: Arduino Based CDIRe: Mars   01/15/13 11:54AM
Re: Arduino Based CDIRe: Ryan Mayer 01/15/13 12:25PM
Re: Arduino Based CDIRe: Ryan Mayer 01/15/13 12:41PM
Re: Arduino Based CDIRe: Time Warner 01/15/13 07:05PM
Re: Arduino Based CDIRe: 🇮🇹💦 Of the Loin 01/16/13 04:15PM
Re: Arduino Based CDIRe: M∆®†Y Køk€š 01/22/13 02:44AM
Re: Arduino Based CDIRe: Time Warner 01/23/13 01:21PM
Re: Arduino Based CDIRe: Mars   01/23/13 01:29PM
Re: Arduino Based CDIRe: Ryan Mayer 01/23/13 02:09PM
Re: Arduino Based CDIRe: Mars   01/23/13 02:57PM
Re: Arduino Based CDIRe: Emerica   01/23/13 08:29PM
Re: Arduino Based CDIRe: Mars   01/23/13 08:40PM
Re: Arduino Based CDIRe: Emerica   01/23/13 09:04PM
Re: Arduino Based CDIRe: M∆®†Y Køk€š 01/23/13 11:16PM
Re: Arduino Based CDIRe: Mars   01/23/13 11:28PM
Re: Arduino Based CDIRe: M∆®†Y Køk€š 01/24/13 01:21AM
Re: Arduino Based CDIRe: Graham Motzing 11/14/14 11:24AM
Re: Arduino Based CDIRe: Deadped Ryan 11/14/14 11:37AM
Re: Arduino Based CDIRe: ♣Slew Foot♣ 11/15/14 12:37PM
Re: Arduino Based CDIRe: Thenggregy Cawilan 08/13/20 12:50AM
Re: Arduino Based CDIRe: Graham Motzing 11/14/14 12:42PM
Re: Arduino Based CDIRe: Julie the Wizard 11/15/14 02:11AM
Re: Arduino Based CDIRe: simon zarka 11/15/14 05:10AM
Re: Arduino Based CDIRe: Mars   11/15/14 09:34AM
Re: Arduino Based CDIRe: Deadped Ryan 11/15/14 04:47PM
Re: Arduino Based CDIRe: «tyler » 11/15/14 11:11PM
Re: Arduino Based CDIRe: Deadped Ryan 11/15/14 11:21PM
Re: Arduino Based CDIRe: Mars   11/15/14 11:56PM
Re: Arduino Based CDIRe: Deadped Ryan 11/16/14 12:02AM
Re: Arduino Based CDIRe: Mars   11/16/14 12:11AM
Re: Arduino Based CDIRe: Deadped Ryan 11/16/14 06:35AM
Re: Arduino Based CDIRe: Thenggregy Cawilan 08/13/20 12:45AM
Re: Arduino Based CDIRe: ♣Slew Foot♣ 11/16/14 08:28AM
Re: Arduino Based CDIRe: Deadped Ryan 11/16/14 02:15PM
Re: Arduino Based CDIRe: Deadped Ryan 11/16/14 02:19PM
Re: Arduino Based CDIRe: Mars   11/16/14 10:24PM
Re: Arduino Based CDIRe: Deadped Ryan 11/17/14 12:18AM
Re: Arduino Based CDIRe: Graham Motzing 11/17/14 11:31AM
Re: Arduino Based CDIRe: Graham Motzing 11/17/14 11:36AM
Re: Arduino Based CDIRe: Graham Motzing 11/17/14 11:38AM
Re: Arduino Based CDIRe: Deadped Ryan 11/16/14 03:22PM
Re: Arduino Based CDIRe: Cody H 11/17/14 12:34PM
Re: Arduino Based CDIRe: Graham Motzing 11/17/14 12:40PM
Re: Arduino Based CDIRe: Cody H 11/17/14 12:48PM
Re: Arduino Based CDIRe: Graham Motzing 11/17/14 12:55PM
Re: Arduino Based CDIRe: Cody H 11/17/14 01:00PM
Re: Arduino Based CDIRe: Graham Motzing 11/17/14 01:09PM
Re: Arduino Based CDIRe: Cody H 11/17/14 01:52PM
Re: Arduino Based CDIRe: Graham Motzing 11/17/14 01:59PM
Re: Arduino Based CDIRe: Cody H 11/17/14 02:15PM
Re: Arduino Based CDIRe: Mars   11/21/14 09:10AM
Re: Arduino Based CDIRe: peter heid 11/22/14 01:28PM
Re: Arduino Based CDIRe: Graham Motzing 11/21/14 01:35PM
Re: Arduino Based CDIRe: Mars   11/21/14 02:14PM
Re: Arduino Based CDIRe: Graham Motzing 11/21/14 03:51PM
Re: Arduino Based CDIRe: Mars   11/21/14 04:16PM
Re: Arduino Based CDIRe: Graham Motzing 11/21/14 06:18PM
Re: Arduino Based CDIRe: «tyler » 11/24/14 09:07AM
Re: Arduino Based CDIRe: ♣Slew Foot♣ 11/23/14 06:47AM
Re: Arduino Based CDIRe: Deadped Ryan 11/24/14 10:04AM
Re: Arduino Based CDIRe: Graham Motzing 11/25/14 11:28AM
Re: Arduino Based CDIRe: Mike Boyd 03/04/16 04:17PM
Re: Arduino Based CDIRe: Graham Motzing 03/11/16 12:52PM
Re: Arduino Based CDIRe: Andres Pioli 01/25/18 07:48PM
Re: Arduino Based CDIRe: Mikey Antonakakis 01/25/18 10:41PM
Re: Arduino Based CDIRe: Graham Motzing 01/26/18 10:42AM
Re: Arduino Based CDIRe: Mikey Antonakakis 01/26/18 06:05PM
Re: Arduino Based CDIRe: Lee Hoffguy 01/26/18 11:40AM
Re: Arduino Based CDIRe: Jay Rivett 08/07/20 01:46AM
Re: Arduino Based CDIRe: 🇮🇹💦 Of the Loin 08/07/20 07:44AM
Re: Arduino Based CDIRe: Jay Rivett 08/07/20 08:48AM
Re: Arduino Based CDIRe: Aaron Blair 08/07/20 09:33AM
Re: Arduino Based CDIRe: Dirty30 Dillon 08/07/20 09:51AM
Re: Arduino Based CDIRe: 🇮🇹💦 Of the Loin 08/07/20 11:04AM
Re: Arduino Based CDIRe: Brian F 08/11/20 11:18AM
Re: Arduino Based CDIRe: 🇮🇹💦 Of the Loin 08/11/20 12:40PM
Re: Arduino Based CDIRe: Jay Rivett 08/07/20 03:00PM
Re: Arduino Based CDIRe: Dirty30 Dillon 08/11/20 12:49PM
Re: Arduino Based CDIRe: Dickie Thompson 08/11/20 04:12PM
Re: Arduino Based CDIRe: Aaron Blair 08/12/20 10:02AM
Re: Arduino Based CDIRe: Graham Motzing 08/12/20 11:29AM
Re: Arduino Based CDIRe: 🇮🇹💦 Of the Loin 08/12/20 03:51PM
Re: Arduino Based CDIRe: Jay Rivett 08/12/20 04:03PM
Re: Arduino Based CDIRe: 🇮🇹💦 Of the Loin 08/13/20 11:26PM
Re: Arduino Based CDIRe: Jay Rivett 08/14/20 09:15AM
Re: Arduino Based CDIRe: 🇮🇹💦 Of the Loin 08/14/20 09:18AM
Re: Arduino Based CDIRe: Brian F 08/19/20 09:10PM
Re: Arduino Based CDIRe: Brian F 09/21/20 10:55AM
Re: Arduino Based CDIRe: 🇮🇹💦 Of the Loin 09/23/20 11:06AM
Re: Arduino Based CDIRe: Jay Rivett 09/23/20 02:44PM
Re: Arduino Based CDIRe: 🇮🇹💦 Of the Loin 09/23/20 02:47PM
Re: Arduino Based CDIRe: Jay Rivett 09/21/20 12:57PM
Re: Arduino Based CDIRe: 🇮🇹💦 Of the Loin 09/24/20 11:47PM
Re: Arduino Based CDIRe: Brian F 09/25/20 03:51PM
Re: Arduino Based CDIRe: 🇮🇹💦 Of the Loin 09/25/20 09:13PM
Re: Arduino Based CDIRe: Brian F 09/25/20 03:43AM
Re: Arduino Based CDIRe: Brian F 09/25/20 10:02PM
Re: Arduino Based CDIRe: 🇮🇹💦 Of the Loin 09/28/20 02:43PM
Re: Arduino Based CDIRe: Brian F 10/19/20 12:29PM
Re: Arduino Based CDIRe: Mars   10/26/12 04:22PM
Re: Arduino Based CDIRe: Mars   10/26/12 04:33PM
Re: Arduino Based CDIRe: Mars   10/26/12 08:39PM
Re: Arduino Based CDIRe: Cole M 11/15/14 11:26AM

Want to post in this forum? We'd love to have you join the discussion, but first: