0
\$\begingroup\$

I have a RS232 device that sends data following the modbus protocol. I have problems communicating with it and I think my wiring is wrong. Since most modbus devices work over RS485 it is hard to find information about this.

This is the cable from the sensor: Sensor cable

I have an USB to RS232 converter and an RS232 cable. I stripped one side of the RS232 cable and attached the RXD, TXD and GND wires to corresponding wires of the sensor. following the this diagram:

enter image description here

The sensor is powered by an external 5v power supply. I don't get any communication going to the sensor. I have tried this by reversing the RXD and TXD and also on an raspberry pi with power for the sensor coming from the pi.

I have also tried using an RS485 to USB converter, I do get data this way but they don't make any sense following the modbus protocol, they seem random. I have used the minimalmodbus python module and serial test tools. The sensor is an Calex PyroCube S, according to the datasheet it uses a bout rate of 9600, Parity none and 2 stopbits. I think that the slave number is 1?

\$\endgroup\$
  • \$\begingroup\$ kind of obvious but: have you wired TX on the sensor to RX on the USB-to-RS232 and RX on the sensor to TX on the cable? (I'm asking because you say ...corresponding...). Modbus is a protocol, it can work on top of RS485 or RS232 or any other electrical levels (the manual of your device says it's on RS232, so you can forget about RS485). The manual of the device looks very poor, I could not even find the slave ID, maybe there is a setting on the menu of the device. If somebody else has used the sensor before be aware that the baud rate might have been changed. \$\endgroup\$ – Marcos G. Dec 4 '19 at 18:34
  • \$\begingroup\$ In the configuration of your software, you need to disable flow control \$\endgroup\$ – frr Jun 2 '20 at 14:31
  • \$\begingroup\$ Refer to the Modbus register map in the manual of your sensor, to know what to ask for - although, if you ask for a non-existent register, you should at least obtain an error response = a complete message in response, rather than silence. You can try scanning slave ID's in a sequence. The address space of slave ID's is 0..254 if memory serves. \$\endgroup\$ – frr Jun 2 '20 at 14:36
  • \$\begingroup\$ In my experience, the right way to go about this is to apply the general debugging approach. Divide and conquer. Walk along the signal chain and apply a probe/tap to see how far you can see some signal. Or you can start from the lowest "layer" where it's accessible. RS232 is nice in that it is relatively slow. You need to check if you're getting some pulses/edges out of the PC's TX pin (DB9 pin 3). An oscilloscope would be the optimal tool, but I doubt you have one. At 9600 bps, try an LED in series with a 1k resistor. Or an active speaker, put a 100k resistor in series with line in. \$\endgroup\$ – frr Jun 2 '20 at 15:28
  • \$\begingroup\$ If you can see your requests coming out, try checking for responses - same probe, you get the idea. As for the software side, I don't know the pythonesque API for serial devices. But I'm kind of conversant in the underlying native API's in Linux and Win32. If you're Windows-based, try using the RealTerm - configure the COM port and try sending some binary byte sequences, comprising Modbus requests (the only difficult part is the checksum). If you have some probes at RS232, and cannot see anything, first verify the probes - disable flow control and start at 2400bps. \$\endgroup\$ – frr Jun 2 '20 at 15:32
0
\$\begingroup\$

If it has RXD and TXD it isn't RS485. It looks like normal RS-232 to me that has Modbus RTU data on it.

enter image description here

Try and read holder register 0x0040 with QModMaster at baud rate 9600.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.