LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control a serial port pin for a variable DC output.

Hi All,

 

What I want to do is hack into a the control of a serial output or any output on a normal PC without a DAQ device installed using LabVIEW as an addition to a larger automation application. I need to be able to vary a DC voltage that will be input to another device external to the PC. 

Once I have variable control over the pin, I can convert it as needed. 

 

Anyone out there know how this might be done?

 

I mean any port at all. One engineer even suggested that I use the audio jack. If that would work I would totally be fine with that. 

Thanks!
John Hess
0 Kudos
Message 1 of 11
(2,274 Views)

A typical PC does not have any variable output ports other than the audio jack. You can use the serial port's flow control lines (like DTR/RTS/etc) but those will be on or off. VISA can control these lines as far as I know.

 

The audio jack is analog, but AFAIK it can't hold a steady DC voltage on it. It's got highpass filters on the output so the best you can do is hold a constant sine wave. You could then rectify and lowpass that signal to get a variable voltage output... but that's a crapload of work that probably won't be the same PC to PC. You can use the built-in "play sound" functions to control the audio jack indirectly. Once you "calibrate" the volume of a sound file (and the PC as a whole...) to a specific voltage level then you could get something kinda repeatable. However, any change to the Windows volume setting would mess things up.

 

With actual NI DAQ devices costing just $200-$400 (IIRC), I can't imagine you saving any money here.

 

If you were REALLY budget strapped you could use an Arduino with LYNX to vary the voltage. An Arduino costs like $3 for simple ones. You'd be limited to 3.3 or 5V max but it'd be super simple.

 

Edit: I just saw your other post where you said you wanted "quick and easy". The answer is a resounding no, you cannot do variable voltage control quickly and easily. A cheap DAQ is the answer, which you can get working in about 15 minutes and have all kinds of control over the output.

 

If you just need some waveform, any waveform, with little control over the levels, you could use the sound card output. I can't imagine that being useful for much of anything. You'd be limited to something like 1 V as well.

 

This is not a LabVIEW limitation; it's a PC limitation. It might help if you described what you're actually trying to do.

0 Kudos
Message 2 of 11
(2,268 Views)

Thanks, this is what I was looking for. I think I am going to tell them we need to get some simple DAQ or even the Arduino.

 

It's not so much the money as it is the long time it takes our purchasing department to get anything.

I would almost get it myself if it did not go against my principles of not giving my money to a multi billion dollar corporation I work for because they suck at getting me stuff in a reasonable amount of time, lol.

 

Anyway thanks again!!!

 

Thanks!
John Hess
0 Kudos
Message 3 of 11
(2,261 Views)

Hah, I understand that completely 🙂

 

Purchasing often gets in the way of progress... so good luck with that 🙂

 

If I were you, I'd push for the DAQ setup. It'll be more versatile, and the next time you need something like that you'll have it. The Arduino will be a much cheaper option in the short term, but if you're working for a big company then the extra time to program it will absolutely be more expensive in the long run.

 

The only reason I'd suggest something super low cost would be if you're working on some device that'd get resold at the absolute lowest cost possible (think like charitable work for impoverished people, like super low cost microscopes for remote villages or something). For a lab use? Yeah, I recommend DAQ all day long.

0 Kudos
Message 4 of 11
(2,249 Views)

Hi John,

 

Your facing the same problems I have with the purchasing department.

If the vendor is not in the system it take months to get something. They 'solved' it by ordering it at a wel known vendor who buys the item at the unknown vendor !! Sometimes this works.  (we have to be very patient is this)

 

Now your suggestion. I think it will take some electronics to get this done.. You could use the lines from the serial port to control a DAC IC. But in most case I think it will end up in a PCB full of components to get it done. Cheap (but that was not the problem), but it will take a lot of time.

 

I fully agree with Bert suggestion about the Arduino and the DAQ. 

 

Kees

 

 

0 Kudos
Message 5 of 11
(2,221 Views)

@K C wrote:

 

Now your suggestion. I think it will take some electronics to get this done.. You could use the lines from the serial port to control a DAC IC. But in most case I think it will end up in a PCB full of components to get it done. Cheap (but that was not the problem), but it will take a lot of time.


Creating a PCB full of components is cheap? That doesn't even work if it is just for a hobby project and your time doesn't ''cost" anything. But doing this for something at work where your hours actually cost something? Naah, definitely NOT cheap!

 

For the price of a cheap USB DAQ device you can't even start to heat up your solder iron (put a little over the top, but only very little, especially if you talk about a multi billion dollar company). 😀

 

Talk to your manager. Tell him you need this device and if he can get his influence in. Maybe he knows the right people in purchasing, or his manager does. And maybe he whips out his company credit card and simply buys it. 😁

 

Remember that rules exist to find a way around them. Just stay legal when doing so.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 6 of 11
(2,212 Views)

I agree it is not cheap, But when you already have the components it only will cost hours and no out-of-pocket money. You would surprised how some companies calculate their cost.

Anyway the hours already spend on this would easily cover the cost of a DAQ, I think.

0 Kudos
Message 7 of 11
(2,181 Views)

@K C wrote:

I agree it is not cheap, But when you already have the components it only will cost hours and no out-of-pocket money. You would surprised how some companies calculate their cost.

Anyway the hours already spend on this would easily cover the cost of a DAQ, I think.


On the other hand, engineering/technician hours are NOT cheap.  The labor you would put into a one-off solution compared to buying something you can reuse?

 

You know how components or designs are often chosen?  Design engineers will set up a meeting, and if the "discussion" goes beyond a certain amount of time, the project manager will instruct them to make a choice NOW, because the engineering hours just spent discussing it cost more than the component/construction of the designed component itself.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 11
(2,162 Views)

Cheapest way would be to use an Arduino's PWM output and a simple circuit like this:

rtsCapture.PNG

You set the voltage by adjusting the PWM on D5. (or whatever PWM output you use).

========================
=== Engineer Ambiguously ===
========================
Message 9 of 11
(2,156 Views)

Using RTSLVU's approach you may be able to PWM via variable duty cycle to toggle on/off one of the serial port control lines in a software timed loop.

I have never tried this so I am not sure if it is a viable approach.

 

-AK2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 10 of 11
(2,137 Views)