element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum How to code a dead band of 10us in Arduino?
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 13 replies
  • Subscribers 394 subscribers
  • Views 2762 views
  • Users 0 members are here
  • deadband
  • project
  • programming
  • inverter
  • arduino
Related

How to code a dead band of 10us in Arduino?

Former Member
Former Member over 11 years ago

Hello all!

I am trying to run an H-bridge Inverter using Arduino. I am generating PWM pulses through Arduino and using IR2110, I am feeding those pulses to the switches. My problem is, I want to add dead band of 10us in programming it self. I want to generate 4 PWM signals A,B,C and D where A and B will have a deadband. C will be a complimentary wave of A and D will be  complimentary wave for B.
But I am not able to get this deadband by putting  " delaymicroseconds(10); " code.

 

Please help me out for this.

Thanks.

Palash

  • Sign in to reply
  • Cancel

Top Replies

  • Robert Peter Oakes
    Robert Peter Oakes over 10 years ago in reply to dmaruska +3
    From memory, not a data sheet It is the transition time where both upper and lower drivers are off, without this there is a risk that a momentary shorting path will exist as an upper driver and a lower…
  • michaelkellett
    michaelkellett over 11 years ago +1
    It isn't really feasible to implement dead band timing on a micro unless it has hardware support in a timer or motor driver peripheral. Many ARM based micros form ST and NXP and other parts form Microchip…
Parents
  • Former Member
    0 Former Member over 11 years ago

    Thank you all for the help!

    I have found the solution.

    Here is the code which generates PWM for 4 switches with deadband:

    ============================================================================

    double pi=3.14159;

    float t=0.0;

    double ws=314.159265;

    double wt=12566.37061;

    double s=0;

    double tri=0;

    int pwm=5;

    int pwm1=6;

    int pwm2=3;

    int pwm3=11;

     

     

    void setup()

    {

      pinMode(pwm,OUTPUT);

      pinMode(pwm1,OUTPUT);

      pinMode(pwm2,OUTPUT);

      pinMode(pwm3,OUTPUT);

    }

     

     

    void loop()

    {

      s=0.8*sin(ws*t);

      double k=8/(pi*pi);

      tri=k*(sin(wt*t)-((1/9)*sin(3*wt*t))+((1/25)*sin(5*wt*t)));

     

      if(s>tri)

      {

        delayMicroseconds(2.5);

        digitalWrite(6,LOW);

        digitalWrite(11,LOW);

        delayMicroseconds(2.5);

        digitalWrite(5,HIGH);

        digitalWrite(3,HIGH);

      }

      else

      {

        delayMicroseconds(2.5);

        digitalWrite(5,LOW);

        digitalWrite(3,LOW);

        delayMicroseconds(2.5);

        digitalWrite(6,HIGH);

        digitalWrite(11,HIGH);

         

    }

     

      //digitalwrite(5,~pwm);

      t=t+0.0031847;

    }

     

    And the output waveform of the inverter:

    Fullscreen contentimage_182498.html Download
    <html><head><title>Jive SBS</title></head>
    <body><font face="arial,helvetica,sans-serif">
    <b>Error</b><br><font size="-1">
    An general error occurred while processing your request.
    </font></font></body></html>
    

    Any suggestions ?

     

    Thanks,

    Palash

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to Former Member

    how i can change the tri frequency?

     

     

    i need tri frequency 5KHZ.  How i can change ?

     

    ///////

    double pi=3.14159;

    float t=0.0;

    double wt=31415.9265;

    double vcon=0;

    double s=0;

    double s1=0;

     

     

    double tri=0;

     

    int pwm=5;

     

    int pwm1=6;

     

    int pwm2=3;

     

    int pwm3=11;

    char d;

     

    void setup()

     

    {

      Serial.begin(9600);

     

      pinMode(pwm,OUTPUT);

     

      pinMode(pwm1,OUTPUT);

     

      pinMode(pwm2,OUTPUT);

     

      pinMode(pwm3,OUTPUT);

     

    }

    void loop()

     

    {

     

      vcon=0.8;

      s=vcon;

      s1=-s;

     

      double k=10/(pi*pi);

     

      tri=k*(sin(wt*t)-((1/9)*sin(3*wt*t))+((1/25)*sin(5*wt*t))-((1/49)*sin(7*wt*t))+((1/81)*sin(9*wt*t)));

     

     

      if(s>tri&s1>tri)

     

      {

        delayMicroseconds(3);

     

        digitalWrite(5,HIGH);   //1

     

        digitalWrite(3,HIGH);   //2

      

        delayMicroseconds(3);

     

        digitalWrite(6,LOW);  //not 1

     

        digitalWrite(11,LOW);  // not 2

     

     

     

      }

     

      else if(s>tri & s1<tri)

     

      {

     

        delayMicroseconds(3);

     

        digitalWrite(5,HIGH);

     

        digitalWrite(3,LOW);

     

        delayMicroseconds(3);

     

        digitalWrite(6,LOW);

     

        digitalWrite(11,HIGH);

     

    }

      else if (s<tri & s1>tri)

    {

        delayMicroseconds(3);

     

        digitalWrite(5,LOW);

     

        digitalWrite(3,HIGH);

     

        delayMicroseconds(3);

     

        digitalWrite(6,HIGH);

     

        digitalWrite(11,LOW);

      

      

      

    }

    else if (s<tri & s1<tri)

      {

        delayMicroseconds(3);

     

        digitalWrite(5,LOW);

     

        digitalWrite(3,LOW);

     

        delayMicroseconds(3);

     

        digitalWrite(6,HIGH);

     

        digitalWrite(11,HIGH);

       

      }

     

      t=t+0.00031787;

     

    }

     

    Thank,

    Perasak

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 10 years ago in reply to Former Member

    Look at this   tri=k*(sin(wt*t)-((1/9)*sin(3*wt*t))+((1/25)*sin(5*wt*t))-((1/49)*sin(7*wt*t))+((1/81)*sin(9*wt*t))); You need to calculate a sine wave at the correct frequency of 5Hz.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • dmaruska
    0 dmaruska over 10 years ago in reply to clem57

    Hi all,  I'm new to Arduino and I have not used a H block before but understand how it operates.  What I don't understand is the dead band.  What is that used for? Thanks for replies. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 10 years ago in reply to dmaruska

    From memory, not a data sheet

     

     

     

    It is the transition time where both upper and lower drivers are off,

     

    without this there is a risk that a momentary shorting path will exist as an upper driver and a lower driver on the same side are transitioning together and provide a direct path from the + Rail to the – Rail (Not through the motor) for a brief time

     

    By having a dead band between turning off the currently conducting drivers and turning on the next pair, it allows the turning off pair to actually turn off before the new ones are on (There not instantaneous as much as we would like them to be)

     

     

     

    I hope I explained that ok

     

     

     

    Peter

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • dmaruska
    0 dmaruska over 10 years ago in reply to Robert Peter Oakes

    Thanks Peter!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 10 years ago in reply to dmaruska

    Your welcome, hoped it helped

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Robert Peter Oakes
    0 Robert Peter Oakes over 10 years ago in reply to dmaruska

    Your welcome, hoped it helped

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube