I am trying to use PWM to create an AC current from a DC source. I was hoping to use about 40 steps per cycle. The issue I am thinking about is that a standard wall outlet is 60 HZ so if I use 40 steps per HZ that will equal 2400 total steps and the PWM pins on the Arduino operate at 490 HZ. Correct me if I am wrong but the program will be incrementing about 5 steps for every pulse that comes out of the PWM pins. Do I just have to use less steps or is there a trick that I can use to get the frequency of the PWM signal up?
Can you explain in more detail specifically what you're trying to accomplish? At the moment I'm skeptical that you can do what you want to do this way.
- Ben
Sure. I am looking to control the speed of an AC motor (low power....far less than 1 amp) and I want the arduino to control the speed. With an AC motor I know that the speed is really a function of the frequency of the AC and the number of poles (windings). I want to vary the frequency and voltage to slow the motor down or speed it up. I have read that you can create a pseudo sine wave with pulse width modulation. In other words the duty cycle would be low where the sine wave crosses zero volts and then increase as the sine wave reaches its apex and then decrease back through 0 volts and then increase again (except using a negative voltage (possibly on a different pin) as the sine wave reaches its trough and then decreases again through 0 volts. I probably don't need to break up the sine wave into 40 steps to achieve what I am trying to do but I was thinking higher resolution would create a closer approximation of a sine wave.
You can get PWM frequencies much faster than 490 Hz. Look at the ATmega168 datasheet or search this forum for posts I've made about generating PWMs with arbitrary frequencies (searching for posts by bens containing "PWM frequency" should probably bring them up).
As far as what you're planning on doing, I'm not sure how you expect to get a PWM pin to output a negative voltage. I assume your plan is to use MOSFETs or transistors to deliver the current to the motor (since the mega168 most likely cannot deliver what will be needed), and I guess you will be using a negative regulator to generate the negative half of the sine wave?
- Ben
You can get PWM frequencies much faster than 490 Hz. Look at the ATmega168 datasheet or search this forum for posts I've made about generating PWMs with arbitrary frequencies (searching for posts by bens containing "PWM frequency" should probably bring them up).
As far as what you're planning on doing, I'm not sure how you expect to get a PWM pin to output a negative voltage. I assume your plan is to use MOSFETs or transistors to deliver the current to the motor (since the mega168 most likely cannot deliver what will be needed), and I guess you will be using a negative regulator to generate the negative half of the sine wave?
- Ben
Yes the plan would be to use the arduino to handle the switching and use transistors to handle the actual current. I am very novice with this so the plan was to try it out on a small 12V AC motor first so that I don't kill myself playing with the full 120V outlets.