Student Projects

cancel
Showing results for 
Search instead for 
Did you mean: 

RS-232 Serial to TTL Converter

Converter Type:  RS-232 Serial to TTL Converter (with Linear-IC MAX232 from Maxim)

 

LabVIEW or C: LabVIEW

 

Version of LV: 2013

 

Description:

This document shows you how to use the Serial UART on NI myRIO to communicate with a RS-232 serial device.

 

Instructions:

To communicate with a serial RS-232 device you need a RS-232 to TTL converter to convert the signal level.

The NI myRIO UART is working with 3.3V.

The voltage level of RS-232 is shown in this table.

 

Serial Specifications.PNG

 

You can either use a RS-232 to TTL converter or you can build your own.

If you search in web for MAXIM MAX232 datasheet you get the circuit diagram for this driver IC.
There are also driver ICs or ready to use boards for other logic levels.

 

In attached zip file are two examples for NI myRIO.

 

  • RS-232 Serial Loopback Test (RT).vi
  • Serial Write and Read (RT).vi

 

Serial Loopback Test - Project.png

 

The RS-232 Serial Loopback Test (RT).vi test allows you to send and receive data from the same serial port to verify that the port is operational.

To perform this test, you need to temporarily connect the proper pins to allow signals to be sent and received on the same port.

If loopback test was successful you should see the string 'Success!!!' in the String Indicator.

 

The first loopback test works only with the UART.

 

Serial Loopback Test 1 - Wiring Diagram.png

 

The second loopback test includes the RS-232 TTL Converter Board.

 

 

 

With the Serial Write and Read (RT).vi you can communicate with a RS-232 device.

Connect a RS-232 TTL Converter to NI myRIO, select write or read mode and run the example.

If you do not have a RS-232 device you can connect the RS-232 TTL Converter to the serial RS-232 port on your PC and can communicate with the

Serial Write and Read example (My Computer >> Serial Write and Read.vi).

 

Please note that RTS/CTS hardware handshaking is not implemented in standard UART on NI myRIO.

 

RS 232 TTL Converter.png

 

Additional Information:

 

RS-232/RS-422/RS-485 on a FPGA Target

Using USB-RS485 or other USB-to-COM devices on myRIO

Comments
robinschumacher
Member
Member
on

Can someone explain me why the GND on the RS232 does not have to be connected?

Wolfgang_Z.
NI Employee (retired)
on

PIN 5 is Ground. I have changed the picture.

robinschumacher
Member
Member
on

Thank you very much for the post, it helped me a lot getting started with RS232 on the myRIO.

I built it using the MAX3232 board from MikroElektronika and the MXP breadboard from Digilent (see pictures).

It has to be noted that 2 breadboards will not fit neatly into the 2 MXP connectors of the myRIO-1900 next to each other (works for the MXP protoboards).

MAX2323 on MXP breadboard.jpg

However then I was too lazy to solder eveything permanently into place and ordered the USB-COM232-PLUS4 board from FTDI.

This board features 4 RS232 connections and can be connected to the USB host port of the myRIO.

FTDI USB2COM232.jpg

The device gets automatically recognized by the myRIO (Firmware version 2.0.0f2), only thing that has to be done to make it work in NI-MAX is to add a file called 'ttyUSB.rules' with the content 'KERNEL=="ttyUSB*", MODE="666"' to the myRIO file system into the folder '/etc/udev/rules.d/'.

With the board and the MXP connections the myRIO now can communicate with up to 6 RS232 devices.

NI_Visa_6xserial.jpg

Wolfgang_Z.
NI Employee (retired)
on

More information about using USB-RS485 or other USB-to-COM devices on myRIO you can find here: https://decibel.ni.com/content/docs/DOC-34827

lesaca
Member
Member
on

hey robin,

i need to connect the USB-COM232-PLUS2 to a myrio as you did. but unfortunately, the device isn't detected by NI MAX. I can see the additional ASRL ports but they are 'not available'. i guess it's because i haven't inserted the file you said and so the myrio doesn't detect it. do you know how to safe the files in windows instead of linux?

in the end, i want to control a maxon epos motor controller with my myrio and RS232.

hope you can help.

robinschumacher
Member
Member
on

Hallo,

Sorry for the late answer, I’ve been on holidays.

It doesn’t matter what your operating system is, however the myRIO is running on Linux.

Please note that Linux does not need filename extensions like .txt in Windows, I’m not sure if the myRIO will just ignore them or if they could cause a problem.

To transfer files to the my RIO you have to use a FTP programm like FileZilla, with this you can access the file system of the myRIO and transfer the file.

best wishes,

Robin

lesaca
Member
Member
on

hey robin,

thanks for your answer. don't worry about the late reply. i managed to safe the file with putty.

however, what i planned doesn't work. i need to control a maxon epos 24/2 directly from the myrio and planned to do this with rs232. but it doesn't work. it does work when connecting the epos to pc. do you have any experience or ideas?

best,

carolin

Am 07.01.2016 um 13:45 schrieb "robinschumacher" <web.community@ni.com<mailto:web.community@ni.com>>:

NI Community<https://decibel.ni.com/content/index.jspa>

RS-232 Serial to TTL Converter

new comment by robinschumacher<https://decibel.ni.com/content/people/robinschumacher> View all comments on this document<https://decibel.ni.com/content/docs/DOC-39303#comment-46670

robinschumacher
Member
Member
on

Hi Carolin,

Just to make sure, is the FTDI RS232 is working for you now and shown as functional in the Measurement & Automation Explorer?

Is the Positioning Controller working with the RS232 from your PC?

Hard to say, as there are a million things that can be done wrong (e.g. wiring, settings, drivers).

I’d suggest to test the connection using the Measurement & Automation Explorer to (1) do a loopback test and then if this works (2) see if you can communicate with the Positioning Controller.

(See 4. In http://www.ni.com/tutorial/3450/en/#toc4).

best,

Robin

hafizyota
Member
Member
on

can i use it to communicate with climate chamber that has rs-232 communication port?

BradM
Active Participant
Active Participant
on

hafizyota,

For most cases, using a USB-to-serial cable will work with most devices. The exceptions tend to be when the chipset in the cable doesn't support some of the extra signal pins (e.g. DCD, DTR, RI, etc.) but the equipment depends on that functionality. If all it cares about is serial data transmit/receive, it will work (unless the chipset is so bad that it doesn't even support RXD or TXD, which is basicall a USB-powered paperweight)

hafizyota
Member
Member
on

i want to read and write temperature on climate chamber. Is it possibe?

hafizyota
Member
Member
on

i want to read and write temperature on climate chamber. Is it possibe?

BradM
Active Participant
Active Participant
on

It all depends on what the hardware connected to the serial port of the climate chamber requires. Check it out and see if it works and/or consult with the manufacturer of the climate chamber.