08-16-2021 05:05 AM
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
08-16-2021 05:33 AM - edited 08-16-2021 05:37 AM
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.
08-16-2021 06:10 AM
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.
08-16-2021 06:31 AM
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.
08-16-2021 09:01 AM
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.
08-16-2021 09:08 AM
@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.