LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting up digital input signal with DAQmx from sensor that uses Modbus protocol.

I am trying to connect a humidity and temperature probe (Vaisala HMP4 product: https://www.vaisala.com/en/products/instruments-sensors-and-other-measurement-devices/instruments-in... User guide: https://www.vaisala.com/sites/default/files/documents/HMP-Series-User-Guide-M212022EN.pdf) to my cDAQ 9137 device.

 

I have connected it using a digital input module (NI 9401), though I do not think this is the correct way to go. The probe uses a Modbus protocol sending a signal at different register addresses in a 32-bit float format for different quantities e.g. register 1 is for Relative humidity.

 

According to this NI article: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019YJOSA2&l=en-GB, it is possible to implement my own custom Modbus connection with my specific cDAQ utilising the DAQmx driver. How would I go about doing this?

 

Thanks

0 Kudos
Message 1 of 6
(316 Views)

Modbus requires a real serial port. While it is theoretically possible to program a serial port with digital IOs, this is rather cumbersome to do. The NI 9401 might be able to do that, if you were using a cRIO and programmed the according serial port interface handling in the FPGA part of the cRIO, but on the cDAQ you would need to do that in software and that is almost certainly to slow for every practical Modbus speed your sensor might support.

 

You should be able to connect your Modbus sensor to the cDAQ by using an NI 9870 or 9871 serial communication module. And then you could use the standard NI Modbus library which uses the NI VISA interface to communicate over the serial ports.

Rolf Kalbermatter
Averna BV
0 Kudos
Message 2 of 6
(310 Views)

Thanks for the reply,

 

From this thread: RS232 communication with cDAQ - NI Community, it looks like that wouldn't work. I will try passing it though the PC's RS232 port and go from there. 

0 Kudos
Message 3 of 6
(303 Views)

That thread is from 2014. NI made some improvements to the cDAQ platform since then and I think adding NI VISA support was one of them!

But your PC serial port should work too.

Rolf Kalbermatter
Averna BV
0 Kudos
Message 4 of 6
(295 Views)

Just remember that Modbus not only is RS232, but can be RS-485 or over ethernet. 

 

I looks like the instrument from OP is using RS-485, and that will not work with a RS232 port. 

0 Kudos
Message 5 of 6
(274 Views)

@dkfire wrote:

Just remember that Modbus not only is RS232, but can be RS-485 or over ethernet. 

 

I looks like the instrument from OP is using RS-485, and that will not work with a RS232 port. 


That's of course true, but there are also fairly simple RS-485 to RS-232 converters if you really want to go that path. Or you just buy a simple FTDI USB serial port adapter with RS-485 interface.

Rolf Kalbermatter
Averna BV
0 Kudos
Message 6 of 6
(273 Views)