LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB 6210 temperature control using thermocouple feedback

Hello,

 

I am a newbie with Labview and learning it for a small project. I need to show this project soon.

 

This project maybe simple for you folks.

 

I am to control the temperature of a Peltier module ( a Thermoelectric Cooler, its a SC module where if you put voltage one way, A side becomes hot and the B side cold. Reversing the polarity of the voltage,  A becomes cold, and B becomes hot.)

 

I have the circuit running, and used the PWM examples given with labview to vary the temperature. I output the PWM singal to a mosfet and from there the peltier becomes hot.

I also have the thermocouple attatched to the peltier device and its giving me accurate readings.

 

For the first experiment, I just want to heat the A side of the peltier module (i.e, I am not worried about reversing polarity of the voltage. For that I am guessing I would need a H-Bridge).

I want to know how to set a temperature and depending on the current temperature of the peltier, the labview program will scale the duty cycle to ramp up to the required temperature.

 

I was reading a few posts and found this thread. I was wondering if the pic in that thread is what I need to follow.

 

http://forums.ni.com/ni/board/message?board.id=170&thread.id=254020

pic : http://forums.ni.com/ni/attachments/ni/170/254278/1/modified_PWM_example.JPG

 

Any help appreciated from you kind folks,

thanks

 

 

Message Edited by KSagarN on 02-16-2009 06:34 PM
0 Kudos
Message 1 of 20
(6,976 Views)

I've worked with Peltier modules, myself.  What you need is a PID control loop which takes your temperature readings and calculates the best PWM duty cycle.  You should read up on that becasue it isn't trivial. There is a PID toolkit for LabVIEW, though it costs extra.  Alternately you can code one yourself, or I think there is a simple PID example that is standard with LabVIEW.

 

BTW, I just used a mechanical relay to reverse polarity and switch from heating to cooling.

 

-- James 

0 Kudos
Message 2 of 20
(6,960 Views)

KSagarN,

 

Thank you for posting to the NI Forums. We do have a shipping example that is essentially a PID - PWM control. It is fairly basic and I am sure you could adapt it to work for you project. It is called PWM-Counter Output. I will attach a copy of it, but it is a version for LabVIEW 8.2 or later. I hope this helps. 

Aaron W.
National Instruments
CLA, CTA and CPI
Message 3 of 20
(6,951 Views)

@jdpowell

 

Thanks for the suggestion of using the PID. Was looking into it last night, and since I don't have the toolkit, was looking at samples I could use and implement into Labview. I found one and the programmer was using an anolog output instead of  PWM. I am guessing we have to take some sort of percentage of the output, which the VI that  Aaron W. posted is seemingly doing, not so sure now, but I am trying to understand it.

 

@Aaron W.

 

Thanks for the VI.

I have a question.

How come in the VI, it asks to input a duty cycle. Is it for initialization only? It looks like it, as its going into the while loop where the 'set point' it read.

 

If I have any further questions, I will post here.

 

Thank you folks.

 

 

0 Kudos
Message 4 of 20
(6,936 Views)

KSagarN,

 

The initial setting of the duty cycle is a starting point. If you know about what the duty cycle should be for your project I would recommend starting with that value, then the program will have to adjust the duty cycle less. Hope this helps. 

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 5 of 20
(6,931 Views)

The PID control calculation I adapted to LabVIEW was found at http://www.jashaw.com/code2.html.

 

The PID output is usually 0-100% of full power, though for a Peltier, you would instead use -100% (full cooling) to +100 (full heating). 

 

-- James 

Message 6 of 20
(6,919 Views)

Hi guys,

 

I got a problem. The DAQ I have doesn't seem to run with the program Aaron attatched.  See attatched, the circled areas.

I think the problem is with the Hardware Timed Single Point for the DAQmx Timing vi. When I click run, the error tells me to either use Finite or Continuous sample.

 

Then I changed from  Hardware Timed Single Point to Continuous Samples.

 

Now when I run, DAQmx Start VI is giving me this error:


Measurements: Sample Mode is set to a value other than Hardware Timed Single Point. This is the only value supported for counter generations when Sample Timing Type is set to Sample Clock.

This is for the Pulse generator VI, the left bottom half.

 

Can anyone help? Instead of using Hardware TImed SIngle Point, how do I use Continuous Samples.

 

Thanks

 

0 Kudos
Message 7 of 20
(6,909 Views)

Hi,

 

Can someone help me with my code.

 

Since my previous post, I have been trying to generate the duty cycle.

 

Some duty cycle is appearing now, but the device is only outputing the very first duty cycle generated by the code. Any other duty cycle after that is ommited.

I tried to alter Gen Pulse Train-Continuous.vi so that the duty cycle can be altered while running. But I keep getting errors.

 

modded gen pulse train-continuous.vi

 

 See attatched for the file.

 

 I am also including the PWM-Counter which is what I am trying to get working.I know the part where you are suppose to generate the pulse is placed wrong and inefficient, But I didn't know what to do due to the Hardware Timed Single Point.

 

modded PWM counter 

Can someone please help.

Thanks.

Download All
0 Kudos
Message 8 of 20
(6,889 Views)

Hi, I'm not at my LabVIEW computer right now and I don't know enough DAQmx to see your problem from your pictures.  However, I would point out that you don't necessarily need the hardware PMW capability of your DAQ device.  You can do a simple low-frequency PWM in software by having a loop that turns your power on and off.  That's what I do with my Peltier's; I have a simple loop on a 200 ms period that turns power on, waits dutycyle x 200 ms and then turns power off.  This loop is separate from my main loop that measures temperature and calculates the duty cycle.  This might be simpler for you to set up (though I'm sure you can get your current plan to work), and it has the advantage that it doesn't use up the limited counters on you DAQ device.   I forget what hardware you are using, but digital outputs are far more common than counter/timers.   Personally, I use FieldPoint hardware which doesn't have counters.

 

-- James 

Message 9 of 20
(6,876 Views)

KSarganN,

 

The issue that you were having with the "Hardware Timed Single Point" is that it is not a supported property for the USB-6210. I was able to replicate the same error that you were seeing by simulating a USB-6210. I have attached another example that should allow you to update your duty cycle on the fly using your USB-6210. If this example works for you, you would be able to integrate it with some DAQmx read functionality to then automatically adjust your duty cycle. 

Aaron W.
National Instruments
CLA, CTA and CPI
Message 10 of 20
(6,871 Views)