LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Soundcard in temperature control system?

Hi!
 
I would like to use soundcard's output to power heater (via amplifier, of course) in a temperature control system. I figured out I could use 2nd soundard (or a virtual one) to get rid of Windows and other applications' sounds.
 
But what is the right (good) way to output a _continuous_ tone?
 
Thanks everybody!
 
Vitaly
0 Kudos
Message 1 of 14
(4,113 Views)

Vitaly,

LabVIEW comes complete with a suite of sound VIs. There is an example that ships with LabVIEW that I think fits exactly what you are looking for. The name of the example is "Continuous Sound Output.vi" and you can get to it by going to Help>>Find Examples, selecting the Search tab, and searching for "sound".

Kind Regards,

E. Sulzer
Applications Engineer
National Instruments
Message 2 of 14
(4,081 Views)
Yes, true, exactly, but I think only starting from LV7. I am sorry, I didn't mention I was using 6i. So trying to reproduce VI from LV8 demo as it would not open on 6i, naturally.
 
Thanks anyway.
 
Regards,
Vitaly
 
0 Kudos
Message 3 of 14
(4,066 Views)

Well, I gave up trying to manually transfer sound libraries from LV8 to LV6i. Also, found this:

http://digital.ni.com/public.nsf/allkb/2C941BA9B591B1F4862566EB006FB5E0

But I cannot get continuous sound in this way. Is it really impossible with LV6i?

Thanks again.

 

Regards,

Vitaly

 

0 Kudos
Message 4 of 14
(4,041 Views)
Vitaly,
 
You are correct -- the example does not exist in 6i because one of its components did not exist back then. For this reason, you will not be able to use the LabVIEW sound VIs to create a variable continuous tone, but you can still use them to create static continuous tones. All you have to do is to use SO Config.vi, followed by SO Start.vi, followed by the SO Write.vi within a while loop, followed by SO Clear.vi. If you want to stop and restart the tone at a different frequency, then you can just put this whole sequence into a loop.
 
Kind Regards,
E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 5 of 14
(4,010 Views)
Sorry, but I don't really understand the difference between the static and variable continuous tone. If it applies to frequency or volume, it's done by sine waveform (function, whatever) generator which is present in all LV versions. I think "SO Config.vi, SO Start.vi, SO Write.vi within a while loop" is an oversimplification. I tried it, but got nothing like continuous sound. What else do we have inside the loop? No SO Wait.vi? What signal is connected to SO Write.vi?
 
LV 7.1 confirms this. In Continuos Sound Output.vi there is SO Set Num Buffers.vi, which is a key to continuous sound. It uses a corresponding call from lvsound.dll, the dll is different from 6i's lvsound.dll. So setting the number of buffers seems to be impossible with LV 6i.
 
Am I wrong? Thanks anyway!
 
Vitaly
 
0 Kudos
Message 6 of 14
(4,000 Views)

vitvip,

I think I was able to create a vi that will work for your application using only the basic sound vis. However, you will not be able to vary the pitch or amplitude while the program is running. (I believe that's what AESulzer was referring to as static). To create the vi, start with a SO Config.vi, the wire to an SO Start.vi. Next place down a while loop with the Basic function generator.vi and the SO write.vi inside of it. Last outside of the while loop, place a SO clear.vi on the block diagram. That should give you continuous sound but you will not be able to vary the frequency or amplitude once the program begins. Let us know if you run into any problems.

 

Best Regards,

Chris C

Applications Engineering - National Instruments

Message 7 of 14
(3,977 Views)

Chris,

thank you, this helps more. However, I think it's again an oversimplification. The VI you describe works, but it is not 'static'. You are probably setting the Function Generator to output too many samples. Try to set #s to, say 100. The lag is, however, very big (and increases with time, I guess, making it seem 'static'). Going back to my task, I'd say one may conclude LV6i isn't up to 'controllable continuous sound output'. Right?

Thanks everybody!
 
Best wishes,
Vitaly
 
0 Kudos
Message 8 of 14
(3,953 Views)

Vitvip:

I don't mean to butt in, but your application has me intrigued. Why and how are you trying to control a heater with an amplified controllable sound output? Unless your output frequencies are very low, I cannot see any benefit of trying to use a sound card.

Heaters are typically slow response systems (unless physically small). Traditional heater control is with ON/OFF via digital output or with digital pulse width modulation via a counter/timer function. For optimal control, closed looped PID control is typically employed.

I'm just curious, and not criticizing your novel approach

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 9 of 14
(3,943 Views)

Thanks for your interest, I am in no way offended. The system is a small (1 m long, 16 mm diameter) measurements probe. It is submerged in the liquid nitrogen (helium). The sample holder (~30 mm long, ~10 mm diameter) is inside the probe, close to the bottom and has a small heater (~100 Ohm resistance, maximum necessary power ~1 W). The whole probe is filled with gas (helium) to ensure proper thermal exchange between the sample holder and the walls of the probe. It's all rather conventional in low temperature measurements.

How? I can measure sample holder's temperature (takes a diode or a resistor sensor and a DMM connected via GPIB). You are right, PID regulator will be used to calculate the necessary power. So I want to connect PID regulator's output to the amplitude (volume) control of the soundcard. I do not quite understand what you mean by "Unless your output frequencies are very low, I cannot see any benefit of trying to use a sound card." But I will connect the soundcard's output to the amplifier/rectifier. I only rectify to avoid electromagnetic interference between the heater signal and measurements currents (very low ones), otherwise I could even connect the heater directly. For the same reason digital pulse width modulation and the like cannot be used.

Why? Because basic analog output card costs ~$300, I think it's a real waste in my case. However, seeing (hearing) that it's not that simple to get true continuous sound, I might be forced to change my mind.

Best wishes,

Vitaly

 

0 Kudos
Message 10 of 14
(3,931 Views)