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

THE_RB

Joined Feb 11, 2008
5,438
This is quite interesting. Basically, you're using the law of averages to effectively generate 12 bits by superimposing four PWM module outputs?
...
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.
 

Thread Starter

PaulEE

Joined Dec 23, 2011
423
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.
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.
 

Thread Starter

PaulEE

Joined Dec 23, 2011
423
You need to expand on this part.

Just "two chunky capacitos" won't be enough. You're going to need inductance.
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)
 

Ron H

Joined Apr 14, 2005
7,014
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)
Do you have series inductors? 2200uF caps look like short circuits at 20kHz. Can you elaborate on this?
 

Thread Starter

PaulEE

Joined Dec 23, 2011
423
Do you have series inductors? 2200uF caps look like short circuits at 20kHz. Can you elaborate on this?
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.
 

Ron H

Joined Apr 14, 2005
7,014
From what I can find, unfiltered PWM is a bad idea:
Be sure to filter the PWM supply to nearly pure DC. Raw (unfiltered) PWM is a loser with Peltiers because during the "on" part of the waveform they are running full power, which as you noted, is not very efficient, and during the "off" part they are not pumping any heat, but _are_ still leaking it in the reverse direction. Running a Peltier cooler on raw PWM actually decreases the efficiency below the full power mode.

Also, if the raw PWM is low frequency, then you are thermal cycling the modules which can lead to reduced life due to mechanical failure.

To avoid resistive losses the filters need to be L-C type. To keep the inductor (L) small you need to keep the frequency pretty high. Not too high though, or switching losses become a problem. I'd probably shoot for 25 KHz or so...just high enough that humans can't hear it.

A filtered PWM controller is essentially a switch mode power supply, but there is one big difference: Power supplies are designed to run at one output voltage, but this thing needs to vary it's output voltage as commanded by thermostat. The effective loop gain depends on the output voltage, and becomes very high at low output voltages. This means that if you are using feedback to control the output voltage, it becomes very difficult to maintain loop stability at low output voltages.

Fortunately, great precision in the output voltage is not needed, and you can run it open loop or feed-forward, and just close the overall loop with the thermostat.
This is from a forum, so take it with a grain of salt.;)
 

Thread Starter

PaulEE

Joined Dec 23, 2011
423
From what I can find, unfiltered PWM is a bad idea:

This is from a forum, so take it with a grain of salt.;)
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.
 

Thread Starter

PaulEE

Joined Dec 23, 2011
423
Here are some FAQs from Tellurex, a Peltier module mfr. Power supplies and PWM are discussed starting at around question #36.
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:

Ron H

Joined Apr 14, 2005
7,014
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.

:)
But, with a transistor having Rds(on)<<Rload, the filtered voltage will be ≈Vcc, independent of duty cycle. WTF???
 

Thread Starter

PaulEE

Joined Dec 23, 2011
423
But, with a transistor having Rds(on)<<Rload, the filtered voltage will be ≈Vcc, independent of duty cycle. WTF???
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 :)
 

Ron H

Joined Apr 14, 2005
7,014
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 :)
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:
 

Thread Starter

PaulEE

Joined Dec 23, 2011
423
Ron,

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




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

Thread Starter

PaulEE

Joined Dec 23, 2011
423
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
 

Ron H

Joined Apr 14, 2005
7,014
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?
 

Thread Starter

PaulEE

Joined Dec 23, 2011
423
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?
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.
 

Thread Starter

PaulEE

Joined Dec 23, 2011
423
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!

:)
 

Ron H

Joined Apr 14, 2005
7,014
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.
Does Vmax vary by unit and/or by manufacturer?

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...
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?

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

:)
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.
 
Top