How to calculate the PWM (Pulse Width Modulation) of a Pure Sine Wave of a specified Hz rate?












4












$begingroup$


I am trying to calculate the pulse waves for the PWM (Pulse Width Modulation) of a Pure Sine Wave with 60 Hz or 50 Hz.



Each pulse wave duration calculated, either to power on or power off, must be a whole number of 3 μs (microseconds) or greater. The challenge is to closely approximate a pure sine wave within the constraints specified above.



My best attempt is this:
p = power on microseconds (μs) as a whole number of 3 or greater.
n = no power (power off) (μs) as a whole number of 3 or greater.
h = Hz rate, which will be 60 or 50 Hz.
m = microseconds (μs) for a single sine wave cycle at h Hz
t = total microseconds (μs) for the previous pulse calculations


$$h = 60$$
$$m = frac{1000000}{h} = 16667$$
$$frac{p}{p+n} ≈ sin(frac{p+n+t}{m} times frac{pi}{2})$$



I started with the assumption to turn power on at the minimum 3 μs and then calculated the first power off duration to be 178 μs.



Then I added 1 to the 3 μs to turn power on again for 4 μs and then calculated to have it turned off for 132 μs; I suspect that just adding 1 each time to the power on duration is not correct, but I don't know how to determine when I should increase that duration more rapidly.
I want to calculate to sin(0.5) and then use these numbers backwards to zero, and then repeat the full cycle for the negative side of the sine wave.



I know my assumptions are wrong, the total μs exceeds 16667 μs for a single cycle, it came out to be 5676 x 4 = 22704 μs with 214 on-off pulse combinations. I'm close, but not quite there.



This problem has humbled me, I'm absolutely stuck and will appreciate any help. Thank you.










share|cite|improve this question











$endgroup$

















    4












    $begingroup$


    I am trying to calculate the pulse waves for the PWM (Pulse Width Modulation) of a Pure Sine Wave with 60 Hz or 50 Hz.



    Each pulse wave duration calculated, either to power on or power off, must be a whole number of 3 μs (microseconds) or greater. The challenge is to closely approximate a pure sine wave within the constraints specified above.



    My best attempt is this:
    p = power on microseconds (μs) as a whole number of 3 or greater.
    n = no power (power off) (μs) as a whole number of 3 or greater.
    h = Hz rate, which will be 60 or 50 Hz.
    m = microseconds (μs) for a single sine wave cycle at h Hz
    t = total microseconds (μs) for the previous pulse calculations


    $$h = 60$$
    $$m = frac{1000000}{h} = 16667$$
    $$frac{p}{p+n} ≈ sin(frac{p+n+t}{m} times frac{pi}{2})$$



    I started with the assumption to turn power on at the minimum 3 μs and then calculated the first power off duration to be 178 μs.



    Then I added 1 to the 3 μs to turn power on again for 4 μs and then calculated to have it turned off for 132 μs; I suspect that just adding 1 each time to the power on duration is not correct, but I don't know how to determine when I should increase that duration more rapidly.
    I want to calculate to sin(0.5) and then use these numbers backwards to zero, and then repeat the full cycle for the negative side of the sine wave.



    I know my assumptions are wrong, the total μs exceeds 16667 μs for a single cycle, it came out to be 5676 x 4 = 22704 μs with 214 on-off pulse combinations. I'm close, but not quite there.



    This problem has humbled me, I'm absolutely stuck and will appreciate any help. Thank you.










    share|cite|improve this question











    $endgroup$















      4












      4








      4





      $begingroup$


      I am trying to calculate the pulse waves for the PWM (Pulse Width Modulation) of a Pure Sine Wave with 60 Hz or 50 Hz.



      Each pulse wave duration calculated, either to power on or power off, must be a whole number of 3 μs (microseconds) or greater. The challenge is to closely approximate a pure sine wave within the constraints specified above.



      My best attempt is this:
      p = power on microseconds (μs) as a whole number of 3 or greater.
      n = no power (power off) (μs) as a whole number of 3 or greater.
      h = Hz rate, which will be 60 or 50 Hz.
      m = microseconds (μs) for a single sine wave cycle at h Hz
      t = total microseconds (μs) for the previous pulse calculations


      $$h = 60$$
      $$m = frac{1000000}{h} = 16667$$
      $$frac{p}{p+n} ≈ sin(frac{p+n+t}{m} times frac{pi}{2})$$



      I started with the assumption to turn power on at the minimum 3 μs and then calculated the first power off duration to be 178 μs.



      Then I added 1 to the 3 μs to turn power on again for 4 μs and then calculated to have it turned off for 132 μs; I suspect that just adding 1 each time to the power on duration is not correct, but I don't know how to determine when I should increase that duration more rapidly.
      I want to calculate to sin(0.5) and then use these numbers backwards to zero, and then repeat the full cycle for the negative side of the sine wave.



      I know my assumptions are wrong, the total μs exceeds 16667 μs for a single cycle, it came out to be 5676 x 4 = 22704 μs with 214 on-off pulse combinations. I'm close, but not quite there.



      This problem has humbled me, I'm absolutely stuck and will appreciate any help. Thank you.










      share|cite|improve this question











      $endgroup$




      I am trying to calculate the pulse waves for the PWM (Pulse Width Modulation) of a Pure Sine Wave with 60 Hz or 50 Hz.



      Each pulse wave duration calculated, either to power on or power off, must be a whole number of 3 μs (microseconds) or greater. The challenge is to closely approximate a pure sine wave within the constraints specified above.



      My best attempt is this:
      p = power on microseconds (μs) as a whole number of 3 or greater.
      n = no power (power off) (μs) as a whole number of 3 or greater.
      h = Hz rate, which will be 60 or 50 Hz.
      m = microseconds (μs) for a single sine wave cycle at h Hz
      t = total microseconds (μs) for the previous pulse calculations


      $$h = 60$$
      $$m = frac{1000000}{h} = 16667$$
      $$frac{p}{p+n} ≈ sin(frac{p+n+t}{m} times frac{pi}{2})$$



      I started with the assumption to turn power on at the minimum 3 μs and then calculated the first power off duration to be 178 μs.



      Then I added 1 to the 3 μs to turn power on again for 4 μs and then calculated to have it turned off for 132 μs; I suspect that just adding 1 each time to the power on duration is not correct, but I don't know how to determine when I should increase that duration more rapidly.
      I want to calculate to sin(0.5) and then use these numbers backwards to zero, and then repeat the full cycle for the negative side of the sine wave.



      I know my assumptions are wrong, the total μs exceeds 16667 μs for a single cycle, it came out to be 5676 x 4 = 22704 μs with 214 on-off pulse combinations. I'm close, but not quite there.



      This problem has humbled me, I'm absolutely stuck and will appreciate any help. Thank you.







      wave-equation






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Jan 12 at 16:00







      Mark Main

















      asked Jan 12 at 9:20









      Mark MainMark Main

      655




      655






















          1 Answer
          1






          active

          oldest

          votes


















          2












          $begingroup$

          If you want to produce a sine wave as nearly as possible, you need merely vary the on-pulses as multiples of 3 microseconds as a function of sine with time with, e.g., 3 microsecond off-pulses between them. If you want just the full-wave power equivalent, I recommend exploring RMS which effectively reflects the duty cycle requirement I think you are looking for.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            I really appreciate your help. I got lost in the forest, thanks again.
            $endgroup$
            – Mark Main
            Jan 12 at 21:10











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "69"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3070729%2fhow-to-calculate-the-pwm-pulse-width-modulation-of-a-pure-sine-wave-of-a-speci%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2












          $begingroup$

          If you want to produce a sine wave as nearly as possible, you need merely vary the on-pulses as multiples of 3 microseconds as a function of sine with time with, e.g., 3 microsecond off-pulses between them. If you want just the full-wave power equivalent, I recommend exploring RMS which effectively reflects the duty cycle requirement I think you are looking for.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            I really appreciate your help. I got lost in the forest, thanks again.
            $endgroup$
            – Mark Main
            Jan 12 at 21:10
















          2












          $begingroup$

          If you want to produce a sine wave as nearly as possible, you need merely vary the on-pulses as multiples of 3 microseconds as a function of sine with time with, e.g., 3 microsecond off-pulses between them. If you want just the full-wave power equivalent, I recommend exploring RMS which effectively reflects the duty cycle requirement I think you are looking for.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            I really appreciate your help. I got lost in the forest, thanks again.
            $endgroup$
            – Mark Main
            Jan 12 at 21:10














          2












          2








          2





          $begingroup$

          If you want to produce a sine wave as nearly as possible, you need merely vary the on-pulses as multiples of 3 microseconds as a function of sine with time with, e.g., 3 microsecond off-pulses between them. If you want just the full-wave power equivalent, I recommend exploring RMS which effectively reflects the duty cycle requirement I think you are looking for.






          share|cite|improve this answer









          $endgroup$



          If you want to produce a sine wave as nearly as possible, you need merely vary the on-pulses as multiples of 3 microseconds as a function of sine with time with, e.g., 3 microsecond off-pulses between them. If you want just the full-wave power equivalent, I recommend exploring RMS which effectively reflects the duty cycle requirement I think you are looking for.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Jan 12 at 17:45









          poetasispoetasis

          405117




          405117












          • $begingroup$
            I really appreciate your help. I got lost in the forest, thanks again.
            $endgroup$
            – Mark Main
            Jan 12 at 21:10


















          • $begingroup$
            I really appreciate your help. I got lost in the forest, thanks again.
            $endgroup$
            – Mark Main
            Jan 12 at 21:10
















          $begingroup$
          I really appreciate your help. I got lost in the forest, thanks again.
          $endgroup$
          – Mark Main
          Jan 12 at 21:10




          $begingroup$
          I really appreciate your help. I got lost in the forest, thanks again.
          $endgroup$
          – Mark Main
          Jan 12 at 21:10


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematics Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3070729%2fhow-to-calculate-the-pwm-pulse-width-modulation-of-a-pure-sine-wave-of-a-speci%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

          SQL update select statement

          WPF add header to Image with URL pettitions [duplicate]