-2
\$\begingroup\$

I am using arduino uno to communicate with my industrial drive. I am using juan bester library for RS485 communication.

Now here's what's happening: When I open serial monitor in my arduino after uploading the sketch. I can't see the RX light flash on my arduino. Tx remains always on. This means my arduino is not receiving any response from my inverter.

But using same code and arduino as my USB com port with communication softwares like modbus poll. I am able to see RX light flash. Which means my arduino is receiving the response.

Thus, my question is where I am going wrong? how should I go about reading data in arduino serial monitor? How should my arduino poll for message?

\$\endgroup\$
  • \$\begingroup\$ If you say TX is always on, do you mean ALWAYS, or blinking? Do you have half or full duplex RS485? If half, the motor cannot response while you are sending. \$\endgroup\$ – jwsc Feb 3 '16 at 10:03
  • \$\begingroup\$ @jwsc: I have a half duplex communication, and yes you are right. If TX is always on then I cannot get a response. But somehow while using software, I can see response with TX always ON and RX is blinking. \$\endgroup\$ – Rajiv Thakur Feb 3 '16 at 10:07
  • \$\begingroup\$ What hardware do you use to interface with the RS-485 bus? Is it a "shield" or a board of your own design? How are the differential amplifiers connected to the arduino; to digital pins between 2 and 13, or to digital pins 0 and 1 (rxd & txd)? \$\endgroup\$ – jms Feb 3 '16 at 10:53
  • \$\begingroup\$ @jms: Kindly check this link possamai.it/arduino-modbus my connection is based on this circuit my +/- wires goes to pin 6 and 7 on RS485 chip \$\endgroup\$ – Rajiv Thakur Feb 3 '16 at 10:57
1
\$\begingroup\$

The ATmega328 only has a single UART (serial tranceiver, digital pins 0 and 1). When you upload a "sketch" or serialwrite() some text to the computer the UART is being used for the transmission. There is a second AVR UC on the board that then acts as a USB to serial adapter.
You have connected the MAX485 to the same UART, so now you have three devices on the same lines. The USB to serial chip does have 1k resistors in series with the ATmega328 that allow the ATmega328 and the MAX485 to override it, so the RS-485 bus should work fine. However you cannot talk to the computer without transmitting junk to the MAX485 (and by extension the inverter/VFD connected to it).

schematic of current setup

You need to either not use the USB to serial connection, get a version of the arduino with more than one UART, or disconnect the MAX-485 when talking to the computer. You can do this by setting /RE high and DE low simultaneously.

UPDATE: for clarification, I drew a diagram of the internal and external serial connections of your circuit as originally posted.

schematic

simulate this circuit – Schematic created using CircuitLab

I hope that this illustrates better what I am trying to convey. Here is the full schematic this is based on: https://www.arduino.cc/en/uploads/Main/arduino-uno-schematic.pdf

\$\endgroup\$
  • \$\begingroup\$ Your answer is making some sense to me. But still making it difficult to understand due to my non electrical bg. Could you explain this thing in simple terms 'However you cannot talk to the computer without transmitting junk to the MAX485 (and by extension the inverter/VFD connected to it).' \$\endgroup\$ – Rajiv Thakur Feb 4 '16 at 6:03
  • \$\begingroup\$ @RajivThakur I added an explanatory schematic of the issue. \$\endgroup\$ – jms Feb 4 '16 at 11:50

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.