How to set a positive and negative current from arduino?

I'm designing a PID temperature controller for a laser diode with arduino. The laser gives me the value of its temperature, which I compare with my reference and then, through the controller implemented in arduino, I'll obtain the proper output values in volts.

The way the laser increases or decreases the temperature is by a peltier cell. So applying a current through this cell it will change it (to the correct value if the PID is set-up properly).

The thing is that the current has to be positive or negative, depending on if we want to heat the laser up or cool it down. I don't know how could I get those currents from the voltage values obtained in arduino.

• @user175624 The OP is talking about powering the peltier device to heat/cool, not about powering the laser diode. Jan 26, 2018 at 10:42
• @HandyHowie yeah exactly!! Say that I am feeding the laser at a constant current (always positive) of 100mA. It'll heat up and I want to cool it down, therefore I apply another current to the peltier cell, that in this case will have to be negative. Jan 26, 2018 at 10:47
• Use H-bridge for peltier Jan 26, 2018 at 11:05

1 Answer

Use something known as a H bridge. That's basically two positive only outputs. You connect the device between them. Let's say each output can drive between 0 and 10 V. The voltage between the two outputs can then vary ±10 V.

This only works if both sides of the device to be powered can float relative to ground. However, that is probably the case for your Peltier. Check the datasheet of the laser module to make sure both lines can float arbitrarily relative to the other connections.

A Peltier is one device that should NOT be run with pulses. However, pulses are the easiest and most efficient way for the power drive system to work. The solution is to add some filtering between the raw H bridge outputs and the Peltier. These would usually take the form of a series inductor followed by a capacitor to ground on each of the two outputs. Another way to look at this is that you're making a switching power supply to run the Peltier from.

I go into more details on driving Peltiers at https://electronics.stackexchange.com/a/28637/4512 and https://electronics.stackexchange.com/a/118543/4512.

• Thanks for the answer. And what about using a DAC converter in the output of the arduino? Would it solve the issue of the PWM? And then to make us of the H bridge you commented above Jan 26, 2018 at 13:52
• In that case, you'd need an H bridge that has a linear voltage transfer characteristic, and most designs you'll find on the Internet do not. Seriously, a digital H bridge followed by a passive filter is the most efficient way to produce analog voltages at medium to high power levels. Jan 26, 2018 at 15:06
• Dave is describing a Class D amplifier [the term can come handy for searches]. Jan 26, 2018 at 23:50