1
\$\begingroup\$

Trying to control a Peltier to cool and to heat.

Does the following code allow me to reverse the current to switch cooling/heating depending on whether I input "a" or "z"?

Source: http://garagelab.com/profiles/blogs/how-to-use-a-peltier-with-arduino

int peltier = 3; //The N-Channel MOSFET is on digital pin 3
int power = 0; //Power level fro 0 to 99%
int peltier_level = map(power, 0, 99, 0, 255); //This is a value from 0 to 255 that actually controls the MOSFET

void setup(){
Serial.begin(9600);

//pinMode(peltier, OUTPUT);
}

void loop(){
char option;

if(Serial.available() > 0)
{
option = Serial.read();
if(option == 'a') 
    power += 5;
else if(option == 'z')
    power -= 5;

if(power > 99) power = 99;
if(power < 0) power = 0;

peltier_level = map(power, 0, 99, 0, 255);
}

Serial.print("Power=");
Serial.print(power);
Serial.print(" PLevel=");
Serial.println(peltier_level);

analogWrite(peltier, peltier_level); //Write this new value out to the port

}
\$\endgroup\$
2
\$\begingroup\$

No, the circuit does not contain a full bridge.

enter image description here

Think of the TEC being L1 in the image. To make the TEC switch from one side cooling to that same side heating current needs to flow in the opposite direction through the TEC. One direction would be Q1 and Q4 ON and the other two transistors OFF. To switch current directions turn Q2 and Q3 ON and the other two OFF.

Since this circuit only contains one transistor the TEC cannot have its current direction reversed. It looks like your code will just shut off the current altogether.

\$\endgroup\$
  • \$\begingroup\$ Thanks! So can I achieve an H-bridge using two Mosfets? I apologize.. I don't have much circuitry experience - what other components would I need in addition to a 10k resistor and 1 mosfet? \$\endgroup\$ – M.Y. Jul 31 '14 at 17:49
  • \$\begingroup\$ Even with two MOSFETs you won't be able to do it. That is what is known as a half bridge. You will need 4 like in the circuit above. The arduino can drive the low side FETs, but you will need additionally circuitry to drive the upper FETs, Q1 and Q3. Alternately you could look into a full Hbridge IC. \$\endgroup\$ – ACD Jul 31 '14 at 17:55
  • \$\begingroup\$ Having trouble reading the datasheet for my MOSFET: vishay.com/docs/91328/91328.pdf Which legs correspond to the base, collector, and emitter? Does gate=base, source=collector, and drain=emitter? \$\endgroup\$ – M.Y. Jul 31 '14 at 19:00
  • \$\begingroup\$ Well, if the names are different, it's also because the behavior is different. If you don't get this and also don't understand why your Arduino won't be able to drive the high side one. You should post another question with your proposed circuit before actually doing it. If you really need a kind of match: gate=base source=emitter drain=collector. But because they don't work using the same principle, this doesn't make much sens. \$\endgroup\$ – Blup1980 Jul 31 '14 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.