Architecture for phase controlled triac

snail71
Posts: 3
Joined: Wed Nov 08, 2017 1:56 pm

Architecture for phase controlled triac

Postby snail71 » Wed Nov 08, 2017 2:05 pm

I am designing a lighting controller and I'm having a bit of trouble figuring out how to handle the fast timing needed for phase control.

The circuit has four triacs. The AC signal is also being fed back to an input through an optocoupler that is used to detect zero crossings. I have the zero crossing input configured to generate an interrupt on falling edge. This part is working fine. The way I have designed it is to have a task for each triac. The zero crossing interrupt will give a semaphore to the triac tasks. The next part is where I'm having trouble. The tasks will then need to delay anywhere between 10uS to a full half AC cycle (120 Hz). My original thought was to just do a vTaskDelay of that time but I can't get micro second resolution.

After the phase delay the triac output would be turned on - then a 10uS delay - then back off again. The task would then wait on the next semaphore from the zero crossing input.

Any thoughts?

ESP_Sprite
Posts: 9759
Joined: Thu Nov 26, 2015 4:08 am

Re: Architecture for phase controlled triac

Postby ESP_Sprite » Wed Nov 08, 2017 5:34 pm

I think your best bet would be to use the MCPWM peripheral. It has a sync input that should do what you want, and would give you a phase control system entirely in hardware.

snail71
Posts: 3
Joined: Wed Nov 08, 2017 1:56 pm

Re: Architecture for phase controlled triac

Postby snail71 » Thu Nov 09, 2017 10:46 pm

Any suggestions for configuring this? I haven't seen any examples that do anything similar.

ESP_Sprite
Posts: 9759
Joined: Thu Nov 26, 2015 4:08 am

Re: Architecture for phase controlled triac

Postby ESP_Sprite » Thu Nov 09, 2017 11:20 pm

Look at the technical reference manual; it describes the peripheral. Also take a look at the documentation for the MCPWM driver in the esp-idf documentation, it should also help a bit. I don't think we have examples around for this specific use case, sorry.

Who is online

Users browsing this forum: Baidu [Spider] and 153 guests