Arduino Uno - Generating two square waves with dead time

Hello,

This is my first post, I hope it follows the rules of the forum :slight_smile:

I am trying to generate two squared waves for driving an H-Bridge.

The waves have a constant frequency of 50 [kHz] and 50% duty cycle.
The relevant pins are D9 and D11.

I've searched the web for generation of a single square wave but I didn't find something that really gave me a good answer. (Or maybe I just didn't understand it very well)

Using the PWM generation function doesn't get me to 50 [kHz] from what I've learnt.
From what I understand, I can generate a signal like that from D9 using the library Timer1. But this library doesn't work on pin D11 (unfortunately), only on D10 which I can't use.

In addition, I have to implement some sort of a "dead time" which is a parameter.
For instance, after D9 has completed 100 cycles it needs to be turned off and after X milliseconds have passed, D11 should be turned on and vice-versa.

I am looking for some guidance on how to do this the best way. (Not necessarily code, really just a "how to" approach)

Best regards,
Alex

Hi,
Here we do not develop projects, but .. We help when there are difficulties in development.
So, post the code you developed, even if it doesn't work as you would like..

Also post a schematic of your project. (may be a freehand schematic).

Since you mention it, it's not a "rule" so much as a practical guideline, but the forum guidelines ask you to post all the technical information that is needed to solve a problem. What you posted is just an overview of the problem.

This has come up several times before on the forum, and has been answered. Your favorite search engine should find it.

if you are not locked on using a 328P or similar and would consider an ESP32, then you've way more flexibility in what you can do

check the LEDC doc

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.