Can PWM sine pulses be generated without a lookup table?

  • Context: Graduate 
  • Thread starter Thread starter intervoxel
  • Start date Start date
  • Tags Tags
    Pwm Table
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
5 replies · 2K views
intervoxel
Messages
192
Reaction score
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.
 
Mathematics news on Phys.org
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.
 
intervoxel said:
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.
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.
 
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.
 
intervoxel said:
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.
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?
 
Or you could run a square wave input through a digital bandpass filter... There would seem to be several ways to do this.