OK, but what happens is if the Arduino is running when I jump pin 6 to ground the charge pulses do not start until I reset. If I remove ground from pin 6 the charge pulses do not stop until I reset. It is not a big issue and I still need to work on hardware to turn those pulses into something usable.Tom

Just discovered that the pulse out on pin 8 has changed. What used to be the on time is now the off time and off time is on time making very long pulses with .5Ms off.

There is nothing I see in the code I wrote which could do that. To confirm, I just went and tested the code posted in #146 with a frequency/duty cycle analysis program I use, and the trigger pulse on pin 8 was indeed the 500us (.5ms) HIGH expected with the low period length determined by the rpm.

Are you running the exact code I posted? If not please post the code you are running.

When you run the code without the pin 6 jumper to ground and the chargePulses are disabled, do you see the pin 8 problem?

Do a "find" on the word "outputPin" and see where it is turned on and off. Is there anything in your hardware which could invert the pulse?

Go back to the version you were last running before the chargePulse modifications. Do you see the pin 8 pulse timing change or is it correct? If indeed you have two versions of code, one of which is correct on/off and the other which is reversed on the same hardware, please post both versions.

Got to take a quick look today, transistor for pulse out had failed and was passing the inverted signal from its driver. It is a 4403 and is rated for 600 ma continuous collector current so I don't know why it failed. Still expecting some Honda CDI with retard in soon so can have real time info on delay reading.Tom

Hi, I have progressed to a new set of testing where it needs a simple form of a sine wave. A DAC will suffice but I need simple control from the Arduino to do this such as D1=1 D2=0 => zero volt,D1=1 D2=1 => +12volt, D1=0 D2=0 => -12volt. So I need to use 2 output pins rather than 1. The width of the output should stay the same.

It's nice to hear that you are still in business with the CDI tester. I need to take a day to reacquaint myself with the project. While I'm doing that, can you explain a bit more about what you are doing with the AC output. Is this related to the ignition pulse, the charging pulse, or is a a new third output?

Any wiring diagrams and more information about what you are trying to do will be of help. How will you be working the DAC?

Are you needing to add two switches which will be read to determine the output? Like the mode switch and charging switch set a program path take?

Any wiring diagrams and more information about what you are trying to do will be of help.

I think to use 2 output pins on Arduino, call them D1 and D2. DAC will have 12+ and 12- supply voltage. This is only for the ignition pulse. The pulse width should change with rpm, I think I remember it does that now, and the time between the 2 pulses should change in relation to barWidth.

when all input pins of DAC get a 1 (+5v) the DAC output +12v (if powered by +12)when all input pins of DAC get a 0 (gnd) the DAC output -12v (if powered by -12)when pin5 of DAC get a 1 and others got a 0 the DAC output 0v

Then 2 pins of arduino are enough to get pos and neg square pulses and zero volt.Say you connect D1 to pin 5 and D2 to pins 6,7,8,9,10,11,12 together

You want a new ignition pulse, on two pins to replace the current single output on pin 4.

It looks like we now get an output pulse on pin 4 of some length and some repeating frequency determined by the RPM setting. It sound like you want to change this to an output on two pins.

Quote

The pulse width should change with rpm, I think I remember it does that now, and the time between the 2 pulses should change in relation to barWidth.when all input pins of DAC get a 1 (+5v) the DAC output +12v (if powered by +12)when all input pins of DAC get a 0 (gnd) the DAC output -12v (if powered by -12)when pin5 of DAC get a 1 and others got a 0 the DAC output 0v

What I'm unclear of is how the two outputs to the DAC are timed. Is a +/- varying signal sent from the DAC to the module each cycle. Can you draw a timing diagram of how the 11 00 10 output states are sent to the DAC? Are they all sent in sequence during one output timing cycle?

It would help me if you could draw a timing diagram of the desired output pulses.

Can you explain about "barWidth". This variable does not appear in the previous code we worked on. What is it, and how does it relate to the timing of the 2 pulses.

In this new mode of output to the DAC, will the the return pulse from the module and the reading on the pin 2 interrupt be unchanged?

You want a new ignition pulse, on two pins to replace the current single output on pin 4.

>Yes

It looks like we now get an output pulse on pin 4 of some length and some repeating frequency determined by the RPM setting. It sound like you want to change this to an output on two pins.

>The length of the existing pulse is determined by barWidth I think. So the 2 new pulse array must replace >that in such a way that it tells the DAC to output a pos pulse and then after a time determined by barWidth >output a neg pulse, then no pulse until it repeats. i have to determine what the pulse width should be.

What I'm unclear of is how the two outputs to the DAC are timed. Is a +/- varying signal sent from the DAC to the module each cycle. Can you draw a timing diagram of how the 11 00 10 output states are sent to the DAC? Are they all sent in sequence during one output timing cycle?

>In this simplest control of the DAC it has 3 states of output, 0 volt, pos volt, neg volt.

It would help me if you could draw a timing diagram of the desired output pulses.

> attached is something that may help. MSB is DAC pin 5 and all others are 6 thru 12 tied together.

Can you explain about "barWidth". This variable does not appear in the previous code we worked on. What is it, and how does it relate to the timing of the 2 pulses.

> It is the width of the bar that passes past the pickup coil. Some engines it is just a short bar and only >serves to make a short pulse where they are only interested in the positive component of the signal. These >generally have two pickup coils and two short bars. In this case I am only interested in one of the positive >pulses so I set the barWidth to small value. Other times the bar can be 60° long and the negative pulse is >at the beginning and then the positive is at the end of bar which has just one pickup coil. For this I set the >barWidth to a higher value, usually the bar length in degrees plus the base timing so 74 is a normal setting.

In this new mode of output to the DAC, will the the return pulse from the module and the reading on the pin 2 interrupt be unchanged?

>I think the answer is yes.

Will the charge pulse code be unchanged?

>Yes

It's been awhile

> Yes for me also, I tend to forget a lot of what I have learned doing this!!

OK, I think I have it. I'll express things in degrees, and the event timing will be changed by RPM.

First, you will need a switch to set the AC trigger mode. This will be similar to the RISE/FALL switch and the CHARGEPULSE mode switch. Do you have this switch installed already?

Quote

Personally , I decided that ONE pulse last 10degree

In the AC Trigger mode you want the + and - pulses each to be 10 degrees long, separated by 60 degrees. We can make those values adjustable by a pot, but these sound like default starting values. I think you already have a pot 3 for bar width.

Quote

Other times the bar can be 60° long and the negative pulse is >at the beginning and then the positive is at the end of bar

You have also described and drawn the pulse train as starting with a positive 12 volts. i.e. +12v for 10 degrees, 0v for bar width(60) degrees, -12v for 10 degrees, 0v for remainder of the timing cycle.

What pulse do you want to lead with?

You will need to determine where you want the return pulse delay measurement to start. At present the RISE/FALL switch controls whether delay timing starts with the rise of the trigger or the fall of the trigger. With the AC trigger and the bar width, you will need to establish the the start of timing for the return.

I'm pretty sure you have a scope to measure output pulses. I think I will try to write a simple piece of test code at 1200 rpm (50 ms cycle timing). 50/360 = .139 milliseconds/degree or 140 microseconds/degree to use a nice round number. Let me know if you want to lead with 00 (-12v) or 11(+12v) and I will try to write some code which outputs the pulse train.

Hi, I can easily install a switch for AC trigger but I am not clear on it's purpose.

The pulse length can be hard coded as long as I can change it in the code easily, I assume I would be able to. Once set it would likely never be changed. The pot to change barWidth is all that is needed here and I have that along with the readout on display.

It would be nice to have the polarity of the output switchable and I think I can do that by swapping pins 2 & 4 on the DAC. So just + first should be OK.

To answer the last question I need to understand what you refer to as AC trigger.Thanks, Tom