1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

A PWM without lookup table

  1. Jul 16, 2016 #1
    I need an algorithm for generating a pwm (pulse width modulation) sine, but with an important constraint: it is not allowed to use a lookup table. The pwm encoded sine pulse sequence must come directly from the algorithm itself. All attempts to find it were in vain. Can you help me? Thank you in advance.
     
  2. jcsd
  3. Jul 16, 2016 #2

    jim mcnamara

    User Avatar

    Staff: Mentor

    That sounds like an odd constraint. This really is not the homework forum.

    My answer is:
    see if this: https://www.arduino.cc/en/Tutorial/PWM (using the analogWrite() call) is what you want. Then since this is opensource, you have a code example to work with. This particular example may not fit your needs. But this would be how I would go about finding something like this.

    Since you gave zero background information about what you are doing it is really hard to make good suggestions. Sorry. Plus, I think this belongs in the Electrical Engineering Forum.
     
  4. Jul 16, 2016 #3

    berkeman

    User Avatar

    Staff: Mentor

    I agree with Jim that this is an unusual constraint. Are you our of memory, or is this an artificial constraint on a schoolwork assignment? I can move this thread to EE or to the Homework Help forums as needed.
     
  5. Jul 16, 2016 #4
    No, it is not schoolwork. I thought about the possibility of using a direct-form oscillator and somehow obtain the pulse train. But it seems to me a bit ad hoc. Perhaps a cleaner solution exists.

    It is not an electric engineering project either.
     
  6. Jul 16, 2016 #5

    berkeman

    User Avatar

    Staff: Mentor

    Okay, I guess we can leave the thread in General Math for now. :smile:

    Have you looked at using series or Fourier construction to make the sine wave? What other approaches have you looked at?
     
  7. Jul 16, 2016 #6

    berkeman

    User Avatar

    Staff: Mentor

    Or you could run a square wave input through a digital bandpass filter... There would seem to be several ways to do this.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: PWM without lookup table
  1. Numbers in Tables (Replies: 2)

  2. Table of Integrals (Replies: 3)

  3. Table of Integrals (Replies: 13)

Loading...