0
\$\begingroup\$

I have a particle counter HPMA115S0 which has a UART communication interface. I bought a TTL UART to RS485 Converter Module to make it work with a PLC over Modbus RTU protocol.

I usually work with devices that have RS485 serial communication standard but those devices have all the information I need to make them work over a Modbus serial communication protocol (PLC as a master) such as the ID and the baud rate and the registers' addresses which contain the data to request.

However, with HPMA115S0 I don't know what the ID would be, what is the register address of the measurement value and so on. So can I make this device with UART communication to work over Modbus serial protocol by using the UART to RS485 converter?

\$\endgroup\$
  • \$\begingroup\$ Removed my downvote. Thanks for cleaning things up :) I have looked at your fan module's specs. Here's a fun application and spec sheet for MODBUS. You'll have to go back and forth between the UART specs and MODBUS specs. \$\endgroup\$ – KingDuken May 1 at 16:41
  • \$\begingroup\$ KingDuken Thanks for your reply, how can I get the answer from the Modbus specs? \$\endgroup\$ – LRH18 May 1 at 18:42
  • \$\begingroup\$ As far as I can tell from your device specs, it uses custom UART point-to-point protocol. So it won't be able to process Modbus requests (Modbus frames have a fixed structure: Slave ID, FC, AddrHigh, AddrLow, etc.), no mater what hardware you will use. So, if you really need to interface this device with Modbus master, you will need to create a Custom-UART/RS485-ModbusRTU gateway that will handle both protocols. \$\endgroup\$ – GAttuso May 1 at 21:28
1
\$\begingroup\$

Your sensor does not need Modbus at all, from the datasheet you can see it uses a simple protocol that sends 32 bytes per frame.

If you have a PLC you should be able to receive these frames quite easily. Most (at least those I've seen) PLCs with an RS485 port can work with either Modbus or what it's called "character mode", which means that the port on the PLC works like a raw UART so to speak, and you have to define your own protocol in your software. When you use this raw protocol you won't need any device address or register number or anything like that you just open your port with the right settings and start listening and processing frames and recording values.

If you don't need a PLC you could always use any kind of computer with a serial port or a USB serial adaptor (RS232 or RS485 if the sensor is far away in the field). The easiest and cheapest I can think of is a Raspberry Pi Zero next to the sensor with a Python script to record values every 10 seconds or more and write them to a database. This way you won't need the RS485 link and you can connect to the Pi to read or download values in many different ways. You can even install something like Domoticz (http://www.domoticz.com/) to have plots with trends or trigger alarms via e-mail or sms (note that I don't think your sensor is supported by Domoticz out of the box, but with such a simple protocol the interface should be a piece of cake).

Many possibilities indeed!

\$\endgroup\$
  • \$\begingroup\$ Thanks for your reply, the reason I want to use the rs485 is the distance between the sensor and the PLC and the number of sensors, UART protocol won't work in a great distance and it's a ptp protocol.I bought a TTL to rs485 converter module,I did pull RE and DE low and I managed to send requests to the sensor and it responds, but when I switch the pins RE and DE HIGH and the sensor is in auto-send mode I can't receive anything from the sensor \$\endgroup\$ – LRH18 May 18 at 9:59
  • \$\begingroup\$ you're welcome. I see that now you're facing another issue. How are you doing your TTL to RS485 conversion? If you have your own chip (MAX485 or similar) you'll have to drive the DE/~RE signal yourself somehow. If you have an off-the-shelf device it should be able to automatically drive this signal itself. If not, maybe you can do it with a 555 timer as I suggested here stackoverflow.com/questions/45957314/… \$\endgroup\$ – Marcos G. May 18 at 12:32
  • \$\begingroup\$ Reading your comment again I tent to think you're switching the RE/~DE signal manually; if that's the case take a good look at the 555 solution, it's quite easy \$\endgroup\$ – Marcos G. May 18 at 12:34
  • \$\begingroup\$ I'm using this rs485 module hobbycomponents.com/wired-wireless/… yeah, I did switch it manually to receive from the sensor because the sensor is on auto-send mode it sends data automatically without a request so I think I should to be able to receive something without driving the DE and RE pins? \$\endgroup\$ – LRH18 May 18 at 13:07
  • \$\begingroup\$ I have a couple of those too! I don't see in the spec how fast your sensor will be trying to answer after it receives a query but in general, this time is on the order of milliseconds so I don't think you'll be able to switch the DE/~RE low quickly enough and besides, that would be fine only for testing but once you deploy your sensor somewhere you'll want it to handle the data exchange automatically. As I see it, it doesn't matter that the sensor is in auto-send, you have to switch the DE/~RE signal yourself somehow. Do take a look at the 555 circuit. \$\endgroup\$ – Marcos G. May 18 at 14:28

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.