Shop OBEX P1 Docs P2 Docs Learn Events
Using Propeller as an DC-AC Inverter — Parallax Forums

Using Propeller as an DC-AC Inverter

PhilldapillPhilldapill Posts: 1,283
edited 2008-07-01 00:22 in Propeller 1
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?

: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

  • Mike GreenMike Green Posts: 23,101
    edited 2008-06-30 18:37
    60Hz is pretty slow. Even dividing the waveform into 512 segments is about 30ms per segment, plenty of time for a Propeller. Your main problem will be the switching circuitry and keeping switching transients out of the Propeller.
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-06-30 18:37
    BTW, If I understand it correctly, at 20MIPS, you should be able to fit ~650 instructions in that time between pulses @ 30.72kHz(20MIPS/30.72kHz = ~650). I'm sure the critical part would be on the very short pulses where you barely have any time between the ON and OFF and vise versa.
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-06-30 18:45
    Let me guess, Mike, avoid ground loops? [noparse];)[/noparse]

    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?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-06-30 18:59
    Yes, I meant 30us, sorry. There are very fast optoisolators with switching times on the order of 100ns like the 6N137.
  • AleAle Posts: 2,363
    edited 2008-06-30 19:33
    Use optocouplers, that way you isolate digital from switching power. At that frequency you can safely use IGBTs and "normal" laminated transformers.
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2008-06-30 19:40
    In the power group in the Electrical and Electronic department I used to work in they often used fibre optics in their circuits, you can get really neat PCB mount connectors and I assume they can run very quickly given their use in comms. Just a note really rather than a specific suggestion for you.

    Graham
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-06-30 20:36
    Well, I've got some transistors I'd love to use for this high power H-bridge. They have about 0.12V Vce drop @ about 0.8A. I can't find a way to know, but does the saturation voltage change with increased frequency? The measurement I have is at DC, no switching.
  • AleAle Posts: 2,363
    edited 2008-06-30 20:50
    I think there is a curve for vce vs freq for some small duty cycle if I'm not mistaken... or was Ic ?.... have a closer look at the datasheet...
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-06-30 20:51
    By the way, these are fairly cheap from TI.
    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?
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-06-30 20:55
    Well, All I'm seeing is the bandwidth product vs. collector current. These are pretty fast transistors with a bandwidth product of 100Mhz typical.

    Attached is the datasheet. By the way, These may not be the best transistors, but I have about 500 of them.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-06-30 21:56
    In general unless you have extensive experience with power supplies, I would not recommend doing this. First off you're dealing with high voltages, second rail to rail linear power amplifier stages are a pain to build (this is necessary to be able to generate the current needed), and third switching noise will need to be filtered out because you can destroy the load (and possibly the power supply) if you are driving a reactive load (this is a load which is inductive and/or capacitive) from a supply that has a high frequency component to it. If you do decide to build it start off by driving something that is purely resistive to begin with, a 15W bulb for a low load, or 100W bulb, iron or toaster for a high load).

    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
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-06-30 22:19
    Well, Paul, your advice is noted and always appreciated, but I have a feeling I'll be placing a few orders for new propellers, soon. [noparse]:)[/noparse]

    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.
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-06-30 23:38
    Philldapill,

    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.
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-06-30 23:50
    Beau,
    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.
    689 x 430 - 4K
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-07-01 00:22
    Philldapill,
    ·
    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
Sign In or Register to comment.