0
\$\begingroup\$

How do I connect an energy meter, such as the L&T (Larsen & Toubro) Quasar Intelligent meter (datasheet,) which uses Modbus RTU protocol with RS485 communication to an Arduino Uno?

I am using MAX 485 to convert RS485 to TTL and I have written my program using the ModbusMaster library.

I always get a Time Out error or Slave Id error. Please help me out of this situation.

\$\endgroup\$
  • 3
    \$\begingroup\$ Welcome to EE.SE. You need to improve your question if you want good help. What's the problem? Physical connection? If so you haven't provided Meter (sic) name and link to datasheet. If it's software well what's the problem? You should add a question mark somewhere to indicate an actual question. \$\endgroup\$ – Transistor Mar 20 '16 at 19:30
  • \$\begingroup\$ I have edited the question and added summary please check if I missed out something. Thank You \$\endgroup\$ – user104215 Mar 20 '16 at 19:43
  • \$\begingroup\$ (1) Links to meter datasheet (as requested already). (2) What's the problem? Physical or software? \$\endgroup\$ – Transistor Mar 20 '16 at 19:45
  • \$\begingroup\$ There's no datasheet on that link. Find the datasheet and edit your post again with the link. \$\endgroup\$ – Transistor Mar 20 '16 at 20:31
  • \$\begingroup\$ Please tell me what you want . I have hard copy of data sheet which is like 20+ pages . Tell me what you want . \$\endgroup\$ – user104215 Mar 21 '16 at 18:41
2
\$\begingroup\$

If the device you want to talk to presents its data via Modbus over RS-485, then on your end you have to implement RS-485 in hardware, and a Modbus master in firmware.

You will need a RS-485 transceiver chip between the UART signals of your micro and the RS-485 bus.

The tricky part is knowing when to set the bus transceiver to transmit mode instead of receive mode. Most UARTs that come with micros don't include this. If your does, just connect the data direction line to the transceiver direction line, possibly requiring inversion in between. If not, you will have to create the direction signal in firmware in your UART driver.

A simple way to do this in firmware is to have a periodic interrupt that runs several times per data byte. This will be useful for implementing the Modbus timing too. Whenever the app writes a byte to the UART driver, the direction line is set to sending before anything else is done. The periodic interrupt then sets the line to receiving if there are no bytes waiting in the software write FIFO, in the UART hardware, and the UART is finished clocking out the last character.

You will probably want to use this same periodic interrupt to time the gap between received bytes. Somehow you then communicate to the application whether the gap before each received byte was long enough to indicate the start of a new packet or not. The remaining Modbus logic can then be handled above the low level UART driver layer.

\$\endgroup\$
  • \$\begingroup\$ Sorry sir I will have to study about what you answered because I don't have knowledge of communication. Now let me tell you what I did . I connected device with rs485 to MAX485 and then to arduino. I have done one code which will glow led if data is transmitted. I can't understand what I have to do with RE and DE pin of ic . Could we please discuss on that part \$\endgroup\$ – user104215 Mar 21 '16 at 18:37
  • \$\begingroup\$ Please check my edited question. \$\endgroup\$ – user104215 Mar 22 '16 at 17:20
  • \$\begingroup\$ OK yes that might be the problem. What I did is I used simple MODBUS library and hardware given in it. They have provided to enable transceiver through digital pins on Arduino. I was crosschecking my hardware and trying to analyse signals transmitted by it . I observed in Oscilloscope. I found that the Arduino is sending signal properly but at the meter end the rectangular signal is converted to triangular one. Can this be a problem . Please tell me how to rectify this. \$\endgroup\$ – user104215 May 6 '16 at 18: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.