Using Propeller as an DC-AC Inverter
Philldapill
Posts: 1,283
I've been wondering, for some time now, how one would go about making a DC to AC Inverter using the propeller. One method of generating the sine wave, is to use a varying PWM signal·to simulate different voltages along the sine wave. i.e., you would use a longer pulse to simulate a higher voltage, all by using square waves. I was wondering if this had been done(if the prop is fast enough), and if so, how efficient is it?
I was looking at the basic pwmAsm. spin code, and it seems the main loop is only 4 instructions long, right?
I've made a·simple table in excel·that basically approximates 180 degrees of a sine wave into 256 values, @ 8-bits each value. This comes out to only 64 longs of data. I'm thinking that the sine wave can be generated using a high power H-bridge, and two pins on the propeller. On the first 180 degrees, pin X would have the PWM signal output on it. The freq would be fixed @ 30.72kHz(1/(120Hz*256)). The duty cycle would vary based on the values stored in the table explained above. When the 180 degree cycle completes, pin Y would now be the output controlling the other side of the H-bridge, and the same values would then repeat on that pin, and so on.
I'm not that advanced @ assembly, but do you think all this could be done fast enough to generate the sinewave? We could always go to a 7-bit amplitude if needed, or, dare I say it, 6-bit?
Anyway, give me your thoughts...
I was looking at the basic pwmAsm. spin code, and it seems the main loop is only 4 instructions long, right?
:loop rdlong value, par 'get an up to date pulse width waitcnt time, period 'wait until next period neg phsa, value 'back up phsa so that it trips "value" cycles from now jmp #:loop 'loop for next cycle
I've made a·simple table in excel·that basically approximates 180 degrees of a sine wave into 256 values, @ 8-bits each value. This comes out to only 64 longs of data. I'm thinking that the sine wave can be generated using a high power H-bridge, and two pins on the propeller. On the first 180 degrees, pin X would have the PWM signal output on it. The freq would be fixed @ 30.72kHz(1/(120Hz*256)). The duty cycle would vary based on the values stored in the table explained above. When the 180 degree cycle completes, pin Y would now be the output controlling the other side of the H-bridge, and the same values would then repeat on that pin, and so on.
I'm not that advanced @ assembly, but do you think all this could be done fast enough to generate the sinewave? We could always go to a 7-bit amplitude if needed, or, dare I say it, 6-bit?
Anyway, give me your thoughts...
Comments
That's actually what I wanted to hear. I was pretty sure a 60Hz signal wouldn't be that hard to do. However, Mike, you did mean 30uS, right? That's what I came out with @ 256 segments per 180 degrees(same as 512 full cycle). Glad to know the propeller is yet again up to the task.
I was thinking transients could be a problem since there will be a transformer involved. They don't make opto-isolators that fast, do they?
Graham
http://focus.ti.com/docs/prod/folders/print/iso721.html
I know this particular one is a LITTLE overkill for this application, but I can get a few samples quickly to try. The 100u price is cheaper than I could find on ebay for the 2N137 you suggested, Mike. They aren't opto-isolators, but what do you think about using them in this app for the time being?
Attached is the datasheet. By the way, These may not be the best transistors, but I have about 500 of them.
But yes the propeller is more than capable of driving the system.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 6/30/2008 10:05:50 PM GMT
I have little experience in this area, but I love smelling smoke, then that "ahhh ha!" feeling soon after. I guess this will be a good learning experience, even if I end up with 50+ fried transistors, a few dead props, hours worth of wasted soldering, and a burn here and there. I've got summer school and a messed up ankle, so I've got plenty of time to tinker and sit around.
Just curious, why not use mosfets rather than bi-polar transistors? Mosfets can generally handle much higher currents.
Also, the transistor that you provided a link to is only rated for 5Amps. If your building an inverter assuming that your source voltage is 12V, then even at a 100% efficiency you will only be able to deliver a maximum of 60Watts of power using that particular transistor. On the high voltage side, that translates to about half an amp.
Take a typical 300 Watt inverter, on the low voltage side you can easily draw about 25 Amps when the inverter is used under a full load.
I guess that another question would be, What do you want your inverter to be able to drive? This should help define your design goals.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
I want to use these because I have about 500. I was thinking driving them with· this simple circuit attached. I would have many of these units with the PNP collector and emitter's in parallel for high current. Again, there are better transistors, but I have many of these.
·
Personally I would advise against paralleling bi-polar transistors.· The risk for a thermal event is simply too high.· All transistors must·be "hand-picked" where their hfe's are all very close.· All transistors must share the same heatsink.· And lastly, all transistors must·have a series resistor of at least 1 Ohm before they are placed in parallel.
·
R2 should be much lower than 10K·for it to adequately drive Q1.
·
·
R2 = ( 35V - 1.2V ) / 50mA
·
R2 = 676 Ohms
A good rule of thumb would be to halve this value so that your base drive current is twice what you need (good saturation)... So, a 330 Ohm resistor would be just about right in this particular application.
·
·
Note:
The 1.2V in the Ohms Law equation above is due to the diode drop across Q1 and Q2.
The 50mA in the Ohms Law equation above is 1/100th of the 5 Amps that Q1 is capable of driving based on an hfe of 100 stated in the datasheet.
·
·······
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 7/1/2008 12:27:45 AM GMT