Controlling a Thermoelectric heater/chiller for environmental chamber

So, for those of you unfamiliar, a thermoelectric chiller (TEC) can be operated bidirectionally. I have one power supply. When current is supplied normally (forward), side A gets cold while side B gets hot. When current is supplied in reverse, side A gets hot and side B gets cold.

What I want is to wire it forward and backward to a power supply, then use a switch controlled by a thermostat.

Here's what the switch would need to be capable of:

thermostat calls for cooling :

forward current circuit closed
reverse current circuit open

thermostat calls for heating:

forward current circuit open
reverse current circuit closed

thermostat at setpoint:

forward current circuit open
reverse current circuit open

Now, there are two conventional ways to go about this.

The first involves a $300 TEC controller and $70 appropriate H-Bridge amplifier. This is the most elegant, direct (and expensive) solution.

The second involves two power supplies and two thermostats on timers (I need a warm temp during the day, and a cold temp at night). That's the brute force way, big bulky and ugly.

Is there a way I could use an Arduino controller and h bridge amplifier to accomplish this? I am coming to Arduino knowing essentially nothing about it besides that a lot of reef keepers and vivarium keepers are into it. So consider me an Arduino newborn.

Here's the other catch, the Arduino system would need to keep it at one temperature during the day, and another at night.

Here is the power supply:

http://www.mpja.com/prodinfo.asp?number=16020+PS

And the TEC:

Also, If I wanted to go all out,

What is the standard control relay/ss switch and outlet used by vivarium/aquarium people and their Arduino setups?

is there an Arduino temperature/humidity probe?

$70 H-bridge?! It is only 8 Amp

As you do not need to switch quickly, I would use simple (cheap) relays. One relay to switch on/off and one to turn the current around (DPDT). Now your Arduino just needs a simple thermo device (choice are wide and varied, depends on how accurate you need to keep the temperature) and perhaps a RTC (realTimeClock) too so it konws the time of day even after a power glitch. (Otherwise it can just count seconds)

(NB: I am not a vivarium/aquarium owner at all)

Thanks!

So what you would do is put two relays on the circuit. In parallel, therefore the sequence would be:

thermostat calls for cooling :

forward current circuit relay closed
DPDT in position A

thermostat calls for heating:

forward current circuit relay closed
DPDT in position B

thermostat at setpoint:

forward current circuit relay open
DPDT position irrelevant.

What are good, Arduino compatible relays (both open/close and DPDT).

Should I use analog or solid state?

Should I use analog or solid state?

Go for solid state - makes it look more high tech :wink:

makes no real difference, more important is that the circuits are not coupled.

The hi-tech solution is to use a mosfet H-bridge. Pololu does a good range of them. Alternatively, build your own using a mosfet H-bridge driver chip and 4 N-channel mosfets (and whatever other components the manufacturer suggests on the datasheet for the chip). Use mosfets that have Rds(on) of 10 millohm or less, then they will be able to switch 8A with no heatsinks.

The low-tech solution is to make a relay H-bridge from two SPDT relays.

So this looks like it would be perfect:

Yes, that one looks suitable to me.

OK, so my parts list so far:

Any other input?

I'm most specifically interested in how you'd solder/wire the h-bridge correctly to both the Arduino UNO and the TEC power supply.

I've no experience of using a Peltier in forwards and reverse modes, but assuming that works how about just using a programmable thermostat? They usually come with NC and NO outputs, and you can use this to toggle a relay to switch between heating and cooling. It's extremely inelegant in that the unit will always be alternating between heating or cooling and the duty cycle would determine the overall effect, but extremely elegant in that you can buy the parts off the shelf tomorrow fairly cheaply, you get a nice user interface, temperature display and so on.

Many of the modern stats have what they call a 'chrono proportional' mode which is where the unit learns the duty cycle needed to maintain a temperature and switches at that duty cycle at some fixed period which avoids the 'saw tooth' effect you get from a passive stat.

Peter, the main problem with a traditional programmable thermostat is that the thermocouple is located on the unit. I need a thermocouple/humidity meter that can be remote and protected from the elements.

ChrisATX:
I'm most specifically interested in how you'd solder/wire the h-bridge correctly to both the Arduino UNO and the TEC power supply.

Pololu's documentation is more complete. If it doesn't make sense just ask specific questions.

You'll also want to take a look at the PID Library. When you're writing your sketch you'll find it's not a straightforward problem calculating when to turn on/off the TEC and how much current to supply it; the PID library computes this for you.

ChrisATX:
Peter, the main problem with a traditional programmable thermostat is that the thermocouple is located on the unit. I need a thermocouple/humidity meter that can be remote and protected from the elements.

I wouldn't have thought that was an unsurmountable problem. I haven't used it by myself, but Googling for 'programmable stat wired sensor' threw up a page of hits - this appeared at the top of the page:

http://www.honeywelluk.com/products/Programmable-Thermostats/TPI/CM907-7-Day-Programmable-Thermostat/

It says:

Options

Remote and Outside temperature Sensor (wired)

I'd have thought there was a good chance of finding a programmable stat with an external temperature sensor. If not, I'd expect to find that the temp sensor within the using was a discrete device that could be unsoldered and wired remotely.

Chagrin:
Pololu's documentation is more complete. If it doesn't make sense just ask specific questions.

You'll also want to take a look at the PID Library. When you're writing your sketch you'll find it's not a straightforward problem calculating when to turn on/off the TEC and how much current to supply it; the PID library computes this for you.

Thanks! Reading the documentation this morning (with my coffee), left side of the board is straightforward. Same with the truth/logic table. Right side, ground wire goes to ground pin on Arduino, PWM goes to one of the 6 digital PWM pins on the Arduino. DIR goes to just any of the digital pins?

So based on the state of the Hbridge, I would need to tell the Arduino to put either high (1) or low current (0) through the DIR connection, and then either low or high PWM signal on the PWM pin. Am I starting on the right track?

As far as turning off and on timing, I need there to be a hysteresis. Basically when the rig needs to be cooling, PWM will be High, and DIR will be low. Once the set temperature is reached, PWM will switch to Low and and the DIR current will be irrelevant, turning the TEC off, or putting it in "brake", Now say that set point is 48 F. It will need to stay in brake until the temp rises to say, 53 F, then switch back to PWM High.

It looks like putting this in series with this output line would be wise too:

ChrisATX:
Reading the documentation this morning (with my coffee), left side of the board is straightforward. Same with the truth/logic table. Right side, ground wire goes to ground pin on Arduino, PWM goes to one of the 6 digital PWM pins on the Arduino. DIR goes to just any of the digital pins?

So based on the state of the Hbridge, I would need to tell the Arduino to put either high (1) or low current (0) through the DIR connection, and then either low or high PWM signal on the PWM pin. Am I starting on the right track?

Yes, that's all correct

ChrisATX:
As far as turning off and on timing, I need there to be a hysteresis. Basically when the rig needs to be cooling, PWM will be High, and DIR will be low. Once the set temperature is reached, PWM will switch to Low and and the DIR current will be irrelevant, turning the TEC off, or putting it in "brake", Now say that set point is 48 F. It will need to stay in brake until the temp rises to say, 53 F, then switch back to PWM High.

PWM pins switch frequently between HIGH and LOW with the ratio between the two states depending on the value to pass in the analogWrite call, from 0 (LOW all the time) to 255 (HIGH all or nearly all the time). The arrangement you are describing doesn't need PWM at all, just digitalWrite HIGH or LOW to the pin. However, if you use PID controller software and PWM, you can get more precise temperature control, if you need it.

ChrisATX:
It looks like putting this in series with this output line would be wise too:

http://www.pololu.com/catalog/product/1187

Yes, if you want to monitor the current through the heater/cooler.

PWM pins switch frequently between HIGH and LOW with the ratio between the two states depending on the value to pass in the analogWrite call, from 0 (LOW all the time) to 255 (HIGH all or nearly all the time). The arrangement you are describing doesn't need PWM at all, just digitalWrite HIGH or LOW to the pin. However, if you use PID controller software and PWM, you can get more precise temperature control, if you need it.

OK, thanks for following along with me on this, I really appreciate it.

OK, so bear with me, for my applications as I've described them, I don't even need to put the PWM from the H Bridge on a PWM pin.

Now, if I want to get rock solid control, the PWM is useful because it variably cycles from on and off

So, say, as "night falls" in the chamber, from say 18:00 to 21:00, I wanted to have it at a cooling off temperature, say 65, I would set the DIR to H have the pulses at a length that would reach that temp. Then from, 21:00 to 06:00, when I wanted my coolest temperatures, I would make the pulse widths even longer, long enough to drop the temp to 48F. Then, as the day breaks, 06:00 to 12:00 I would switch the DIR to L and have the pulses at an appropriate width to make the current warm the tank to 75F, then again from say 12:00 to 18:00, I would increase the pulse widths to make the temperature 82F.

Is that fundamentally correct?

Ok, if that's correct, next, I'm assuming I have to figure out how to calibrate the pulse widths to which temperature they correspond to in the chamber in each current direction. Yes? Then I have to make the temperature probe reading actually CONTROL the PWM pin.

Sound right?

I need to do reading on PID controller software.

Ah, so it appears the PID is what I will need to use to take the thermostat value as the input and make the output to control the PWM pin. Yes?

ChrisATX:
Ah, so it appears the PID is what I will need to use to take the thermostat value as the input and make the output to control the PWM pin. Yes?

Yes, that's right.

OK, so I understand the PID equation after seeing it in its continuous form.

and what the basic PID code from here:
http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/
does.

Is there a tutorial on how to actually, physically make something like the temp/humidity probe the input? How do you relate units (i.e., whatever the input is from the thermostat converted to temperature).