Author Topic: USB to RS-485 converter  (Read 188 times)

MrHobo021

  • Member
  • ***
  • Posts: 4
USB to RS-485 converter
« on: December 26, 2018, 03:48:03 pm »
Hello, I am an Electrical Engineering and Computer Science student working with a biotech company on a project involving an RS-485 plc from a company called love controls (http://www.dwyer-inst.com/Product/Temperature/ProcessControllers/Series16A).  I am trying to take readings from a thermocouple and transfer them to my computer. I am working with the modbus RTU protocol and I am trying to do this in half-duplex mode. I purchased a USB to RS-485 converter from a company called Dtech (https://www.dtechelectronics.com/dtech-dt-5019-usb-to-rs485-422-cable_p118.html#Inquiry-go) I cannot tell if I am interfacing with this correctly. My computer (macbook pro) is able to recognize it as a serial port in terminal. I am using a software called CoolTerm to test the connection to see if I am actually connected. The "active" light on the USB to RS-485 is red and the "txd" light in the USB-to-RS-485 will briefly for a split second turn green when I try to interface in CoolTerm but no data will show up whatsoever.

I have very limited experience with embedded systems so any insight will be of great value. I have included a picture of the development environment on my computer and the USB to RS-485 converter.
« Last Edit: December 26, 2018, 07:25:40 pm by MrHobo021 »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2790
    • Lakeview Research
Re: USB to RS-485 converter
« Reply #1 on: December 26, 2018, 08:15:31 pm »
Does your converter's documentation provide advice on how to use it to send and receive data?

What is the output of the thermocouple and how is it interfaced to the converter?

MrHobo021

  • Member
  • ***
  • Posts: 4
Re: USB to RS-485 converter
« Reply #2 on: December 27, 2018, 08:11:46 pm »
The thermocouple is a type "K" thermocouple and the output is shown on the face of the RS-485. The output of the Thermocouple is accurate and does not need calibration. My only issue is getting output data to my computer. The directions on the converter talk about wiring and installing drivers if the computer needs the drivers to be installed but I don't see anything talking about interface.

I have attached a picture of the wiring of the back of the microcontroller. The yellow and red wires are the thermocouple (working fine), The fuzzy wiring on the bottom is the power source (also working fine), the remaining three wires are the data communications that link up to the USB-to-RS-485. I do NOT think this is a wiring issue per say but it doesn't hurt to include this information.

Please let me know if anything is unclear or if more info is needed.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2790
    • Lakeview Research
Re: USB to RS-485 converter
« Reply #3 on: December 27, 2018, 08:51:10 pm »
The thermocouple's output must be asynchronous serial data.

The handshaking protocols of the thermocouple and converter must match.

If the converter supports 2-way communications over 2 wires, the thermocouple and converter must agree on how to determine when the thermocouple can transmit.

The documentation for your components should discuss these things.


MrHobo021

  • Member
  • ***
  • Posts: 4
Re: USB to RS-485 converter
« Reply #4 on: January 15, 2019, 05:29:11 pm »
I would like to make a correction from what I stated earlier. This is NOT a PLC. It is a regular micro-controller. The data from the Thermocouple is displayed on the screen of the micro-controller and it is read from a register using the Modbus RTU protocol. The thermocouple functions separately and just feeds data to the micro-controller. I have a data-sheet that contains all the Modbus RTU operations for the micro-controller. It specifies that reading temperature is at Register 2 and the function number is 03. A Modbus message is structured XX-XX-XXXX-XX (I am using decimal units to keep it simple). I know for read temperature I have XX-03-0002-XX because I know I am doing a read command at register 2. The first and last parts deal with quantity and station number. I have attached the pdf containing the commands. The command I am trying to do is on page 1 and is the first command with the parameter "Process Value". What is the total value for this command if I am even asking this question correctly?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2790
    • Lakeview Research
Re: USB to RS-485 converter
« Reply #5 on: January 16, 2019, 04:24:12 pm »
Does the microcontroller have any example code for Modbus? That might be the best place to start.

MrHobo021

  • Member
  • ***
  • Posts: 4
Re: USB to RS-485 converter
« Reply #6 on: January 18, 2019, 12:14:08 pm »
Love Controls/Dwyer Instruments does not have example code. I called their tech support and I contacted an engineer to confirm this. I am going to assume that the default station is 1 and the registers read is 1 (this would make a modbus message 01-03-0002-01). I was looking at the example C code that is on your website for the Microchip PIC (PIC18F4520) RS-485 network. I noticed that in the folder containing the coding samples there were files ending in .mcp, .mcs, .mcw. What is the purpose of these files? What do they do?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2790
    • Lakeview Research
Re: USB to RS-485 converter
« Reply #7 on: January 18, 2019, 04:48:26 pm »
These are project files for Microchip's MPLAB, possibly unneeded for new versions.