Timer "One-Pulse" mode

Post here first, or if you can't find a relevant section!
Posts: 228
Joined: Wed May 11, 2016 4:29 pm

Re: Timer "One-Pulse" mode

Post by dannyf » Sun Feb 11, 2018 2:16 pm

it probably doesn't need to be that elaborate.

I would do it this way, assuming you want pam:

1) initialize the timer into one pulse mode, and interrupt at the top.
2) set up the compare to be 1 (or 0 if it works), and the top to be a value designed for the right amount of power;
3) in the isr, zero its counter, and update the top.

so the timer will be started by the zero-crossing signal, the OC pin is fired right away, and goes low at the top.

as you can see, the one-pulse mode isn't that useful: the same thing can be done by a exti pin + the timer in overflow mode.

Posts: 228
Joined: Wed May 11, 2016 4:29 pm

Re: Timer "One-Pulse" mode

Post by dannyf » Sun Feb 11, 2018 2:18 pm

btw, the reason to set the compare value to 1 (or 0 if possible) is so the OC fires right away.

Posts: 98
Joined: Tue Jul 07, 2015 4:44 pm

Re: Timer "One-Pulse" mode

Post by fredbox » Sun Feb 11, 2018 5:31 pm

I think you triggers the load "on" at zero crossing, and at specific time you switch off the load (with the pulse).
For a triac, it's the other way around. The triac turns off at zero crossing and needs another trigger after some time delay to set the phase angle. A new trigger is needed for each half-cycle.

User avatar
Posts: 7680
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia

Re: Timer "One-Pulse" mode

Post by RogerClark » Sun Feb 11, 2018 9:25 pm


One pulse is working fine for me.

One additional benefit of the one pulse is that the ON period of the pulse can also be controlled.

So in my case, with the AC Dimmer, the ON period is fixed at 100uS.

The LED in the opto-triac used as the driver for the "power triac", actually has a limited life (according to the spec from some manufacturers). They recommend that you use as low current as you can reasonably get away with to maximise LED life.
For the MOC3021 I think this value around 10 - 15mA , i.e at least 10mA but they don't recommend you run the LED at its max of 50 or 60mA as this will shorten the operational life.

Hence only using a short "ON" pulse will conserve the LED lifespan.

I was originally turning turning on the triac after the delay period and then turning the output off when the STM32 got the next zero crossing ISR.
This is because the zero crossing detector pulse is actually quite wide in my case.
The pulse goes low around 600uS before zero and rises again around 600uS after zero.

But this has 2 disadvantages...

I can't trigger the triac in the last 600uS of each cycle, as this is after the time I've already turned the triac off, and I have no other way to turn it off before the zero crossing...

Using on pulse, allows me to turn it on, up to 101us before the real zero crossing point.

This allows for very low power operation, e.g less than 5W on a 4kW load.

I admit that this , super low power operation, is not that important, but I get it for free using One-Pulse...

Posts: 228
Joined: Wed May 11, 2016 4:29 pm

Re: Timer "One-Pulse" mode

Post by dannyf » Mon Feb 12, 2018 1:25 am

Would not be better to regulate the power by switching on/off at zero crossing? I mean by counting sine periods (like 100 periods = 1kW, 1 period = 10W)..
an interesting concept. I haven't seen people trying it however. I can see it being quite useful when emi is of paramount concern.

Post Reply