From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital output (0/5volts) using USB or RS232?

Solved!
Go to solution

Dear Friends, i need to switch on and off some device using some transistor ....ect. I would like to switch on/off using USB or RS232 from Labview... i just need to provice whethere 0 or 5 volts in order to do so..... please help me out.

0 Kudos
Message 1 of 6
(4,722 Views)

The USB port provides some power at 5 V but it is not designed to provide direct control of a line as a logic signal.

 

RS-232 uses nominal voltages of +6 to +12 V and -6 to -12 V. Different implementations of the hardware may use voltages anywhere within that range but certainly incompatible with your 5 V requirement. Also, except for the handshaking control lines, the voltages are not maintained, but vary according to the baud setting.

 

You probably need some digital output device. If your timing requirements are less than 100 Hz or about 10 ms and can tolerate some jitter, something like the USB-6008 might work.

 

Lynn

0 Kudos
Message 2 of 6
(4,711 Views)

Johnsold,

first of all thanks for replying, second i have seen some videos switching LEDs ON/OFF using RS232... any idea how that is done?

0 Kudos
Message 3 of 6
(4,704 Views)

I have not seen those, but most likely they connect a diode and current limiting resistor in series with each LED. They probably use a handshaking line such as RTS because those will stay in one state after being set.  The TD line changes according to the character being sent and is guaranteed to be in both states for each character because of the start and stop bits.

 

Lynn

Message 4 of 6
(4,698 Views)
Solution
Accepted by topic author mostafabayern

here is a small test vi

DTR_RTS.png

Now take a DMM and check the voltage levels on the DTR and RTS line of you COM port

 

Should be 9 pole male sub D , take care not to shortcut some pins!!

 

measure between pin 5 (GND) and pin 4 (DTR)  or 5 & 7 (RTS)

 

To ligth a LED I would start with a low current LED and a 10K resistor.   If you have the LED running 😉  replace it with an optocoupler  and a resistor to limit your current below 5mA. (Say (12V_level-1.8V_led)/5mA  -> ~ 2.2k Ohm

 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 5 of 6
(4,660 Views)

Henrik,

More than very much thankful. Using it already ,just the unknown case causes labview error so i deleted the unknown case.

Thanks a lot 🙂

0 Kudos
Message 6 of 6
(4,635 Views)