Most convenient/efficient/straight-forward method of producing 12-bit, 20 kHz PWM

Discussion in 'General Electronics Chat' started by PaulEE, Jan 9, 2012.

  1. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,430
    1,311
    Sorry, I should have explained that a bit more thoroughly. There is only one standard 10bit PWM module used.

    Then every PWM cycle (in the interrupt) the PIC cycles in a new value, in sequence, from the 4 values. So the PWM goes; 602, 601, 601, 601, 602, 601, 601, 601 etc repeating.

    As you are controlling something real slow (like a heated block) you can simply use enough low-pass filtering so the alternating PWM values average out at exactly 601.25.

    This gives you 12bit PWM from a standard 10bit PWM module.

    I'll disagree with others that you don't need high PWM resolution for PID controlling a heater block, it will make it a lot easier for the PID if you have very fine output resolution. Personally I would use a simple delta-sigma modulator with a 32bit register in the PIC, to give "PWM" resolution of about 1 million. That will make it easier for the Integrator to trim to the 0.001'C you require.

    Good luck too on getting 0.001'C regulation, I have done a xtal oven with 0.01'C regulation and there were quite a few issues... You are aiming for 10 times that precision and with a larger system with more wires and more interconnected modules etc. It's not going to be easy.
     
  2. PaulEE

    Thread Starter Member

    Dec 23, 2011
    423
    32
    We aim high to get acceptable :)

    Thanks for the explanation. I agree with what you're saying.

    However, I also agree that it can be done with on/off control, but the equivalent switching frequency would end up being the same as my pulse-width modulation signal!

    We're all talking about the same thing in a different way, I think.

    Thank you all.
     
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,201
    1,809
    You need to expand on this part.

    Just "two chunky capacitos" won't be enough. You're going to need inductance.
     
  4. PaulEE

    Thread Starter Member

    Dec 23, 2011
    423
    32
    Two 2200 uF caps on either side of the peltier h bridge outputs to ground.

    The scope would beg to differ with you...and me. I thought the same thing.

    Every peltier temperature-controlling IC datasheet included inductances for HF components.

    Looked like a large LC low pass filter sort-of thing.

    MAX1968, LTC1923 - for example. (the two controller chips I referred to)
     
  5. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,012
    681
    Do you have series inductors? 2200uF caps look like short circuits at 20kHz. Can you elaborate on this?
     
  6. PaulEE

    Thread Starter Member

    Dec 23, 2011
    423
    32
    Yes. I'm an idiot.

    Big cap on power rails. NO inductors or caps on TEC power output pins.

    Was thinking of close relative of this project.
     
  7. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,012
    681
    From what I can find, unfiltered PWM is a bad idea:
    This is from a forum, so take it with a grain of salt.;)
     
  8. PaulEE

    Thread Starter Member

    Dec 23, 2011
    423
    32
    I took it in exactly that fashion. :p
    I've read elsewhere that PWM extends the life of TECs. I think the article is at work on the server; maybe I'll link it here tomorrow.

    Thank you for digging that up - and again, to everyone, for all the support.
     
  9. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,012
    681
    Here are some FAQs from Tellurex, a Peltier module mfr. Power supplies and PWM are discussed starting at around question #36.
     
  10. PaulEE

    Thread Starter Member

    Dec 23, 2011
    423
    32
    My DC is switched DC from zero volts to +5 volts. That is an awesome reference website.

    The reason I use an H-bridge (not sure if there was confusion or not) is because to either "heat" or "cool" I apply the variable duty-cycle 0v - +5v pulses from either the "top right" mosfet or the "top left" mosfet, with each bottom and opposite mosfet held ON while the one top or the other is doing the switching. I designed protection logic to prevent one whole half-bridge from being on at any time.

    To be clear, I'm using pulsed DC. There is never a time in which my waveform goes negative. If there were, it'd be defeating the whole purpose of what a TEC is supposed to do, to an extent :p

    This is also why, on another peltier circuit, I did have a big cap on the output terminals of the circuit (well, one on each side). The cap is a short for 20 kHz +/-output volts about the zero axis. Since I've got pulsed DC and the cap is tied from output to ground, it's just like the output of a bridge or half bridge rectifier getting filtered (to DC!) by a big honkin' cap.

    :)
     
    Last edited: Jan 10, 2012
  11. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,012
    681
    But, with a transistor having Rds(on)<<Rload, the filtered voltage will be ≈Vcc, independent of duty cycle. WTF???
     
  12. PaulEE

    Thread Starter Member

    Dec 23, 2011
    423
    32
    True with no load, but since the peltier continues to draw current off the cap, and since the RMS DC voltage is proportional (roughly) to the duty cycle, the voltage does go down as the duty goes down, despite the Vcc peak voltage :)
     
  13. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,012
    681
    I'm thinking of a simple circuit consisting of a high side switch, a resistive load, and a BF cap across the resistor, with, as I said, Rds<<Rload. The voltage will be, as I said, pretty much independent of duty cycle. For example, let
    Rload=2Ω
    Rds=10mΩ
    Duty cycle=100%
    Vload=2/(2+100%*.01)*Vcc
    Vload=0.995*Vcc

    OK, now:

    Rload=2Ω
    Rds=10mΩ
    Duty cycle=10%
    Vload=2/(2+10%*.01)*Vcc
    Vload=0.952*Vcc

    The modulation went from 100% to 10%, but the voltage only changed by about 5%.

    Maybe you have a different circuit in mind.:confused:
     
  14. PaulEE

    Thread Starter Member

    Dec 23, 2011
    423
    32
    Ron,

    First picture is with 50% duty, second with 20%.

    [​IMG]
    [​IMG]

    Not linear, but do you see the difference with the load and what-not?
     
  15. PaulEE

    Thread Starter Member

    Dec 23, 2011
    423
    32
    p.s. - this circuit, in the final version, does NOT have those two 2200 uF caps. I breadboarded this and it did not appear to need them to function properly.

    I am not saying they're right or wrong either, they're just more something to look at - at this point.

    The final circuit has four MOSFETS, IRF-somethings with VERY low on resistance. They're completely cool while pumping 30 watts into the peltier (measure voltage across and current draw on power supply = 30 real watts).

    The peltier module got so hot, in fact, that it melted a solder joint enough to physically damage the part = no more heat/cool. I assume this is what happened, I cannot think of anything else that might've happened. I quietly plopped it in the trash can and got another...and turned the duty cycle down a touch :p
     
  16. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,012
    681
    It melted because you don't have LC filtering. I saw that exact failure mode mentioned in one discussion of PWMed Peltiers.
    Read questions 40 and 41 in the FAQs I linked to earlier.
    In the circuit with the big caps on your H bridge outputs, have you looked at the power dissipation of your MOSFETs?
     
  17. PaulEE

    Thread Starter Member

    Dec 23, 2011
    423
    32
    To be clear, I adjusted the duty cycle from zero to 100% and the peltier modules gradually got warmer (colder) until it was HOT(COLD). The MOSFETS run cool, generating no heat. The on resistance of the logic-level mosfets are in the neighborhood of 1 milliohm. They're really nice devices.
     
  18. PaulEE

    Thread Starter Member

    Dec 23, 2011
    423
    32
    I also looked at #40/41 on the FAQ. These two questions tell me that it is not okay to exceed the maximum voltage allowed across the TEC with pulse-width modulation, but, it does not tell me to not use pulse-width modulation with a voltage <=Vmax for the module.

    Also, take a look at this:
    http://www.ovenind.com/bv/Products/5R7-001-Temperature-Controller__5R7-001.aspx

    I basically built this, minus the on-board PID control and serial interface. Note that there are NO inductors and that this device is specifically for TEC temperature control...

    Thank you for continued information. This has turned into quite an interesting thread!

    :)
     
  19. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,012
    681
    Does Vmax vary by unit and/or by manufacturer?

    I couldn't find a schematic. How did you build it? Also - what is L4, if not an inductor? Admittedly, there should be two of them if it were used for bridge filtering.
    Have you seen any TEC driver ICs that have application circuits that don't use LC filtering?

    Keep in mind that I have zero experience with TECs. I just trust manufacturers more than I do you.:D
    If you are building and testing these circuits, and they work, it's hard to argue with success.
     
  20. Markd77

    Senior Member

    Sep 7, 2009
    2,796
    595
Loading...