Arduino PPM code

I want to find the proper PPM code for my application of varying the firing angles of an SCR. The SCR I am using will be driving a motor directly so the firing angle should start off at around 90 degrees, then to make it's way down to 0 degrees for full voltage across the load. This application is called 'Soft-starting', but before jumping ahead, I need to start with my Arduino program.

I would hope to be able to adjust time time delays between firing my output pulse. The picture below should help visualize what I want my output pulse to achieve:

Thank you for your time & knowledge,


Have you got any code at all at the moment or is this a blank canvas ?

This is a blank canvas, reason being that I've been researching PWM the whole time, rather than PPM, which applies to my goal. So as of now I have nothing except my PWM code.

Didn't understand the diagrams in the lower half of that page, but I get the general idea that you're trying to output a pulse at a specified angle relative to the zero crossing of an input sin wave. Is that the idea?

I suppose your first problem is to find a way to detect the zero crossing event. Do you have a method in mind to achieve that? Presumably this is a full wave signal although you only drew half a wave, so since the Arduino won't like negative input voltages you can't just divide the voltage down. AC is usually associated with mains voltages - are you dealing with mains voltages here? Also, mains is typically running at a nice slow 50-60 Hz - is that the case here? If so, timing won't be a problem since you have ample performance to spare.

Once you can detect the zero crossing event, the general approach would be to measure (or know) the duration of your half-wave, decide how long to delay the pulse after the zero crossing event, and send the pulse after that time has elapsed. That part seems relatively straightforward.

Just to clarify, the diagrams in the lower half are basically the output pulse shifting more the the left, reducing the firing angle of the SCR. And yes, the angle is relative to the zero crossing of the input sine wave.

I am dealing with mains electricity in my power circuitry, however there will be an isolator between my Arduino and SCR circuitry, so the Arduino may not even detect the negative voltage. This is something I wont be too sure about until I get back into my lab class; maybe until then just assume that I do not need the detection?

Moving forward, I have no clue where to start with my coding. I've played around with PWM codes but can't seem to find a general-purpose PPM code (if there are any). The duration of my half-wave AC signal would be 1/60hz = 16.66ms/2 = 8.3mS

Once I get started I could fine-tune the pulse delays and what not. I just do not have a backbone code to work with.