RS485 Plus USB PC Communication on Arduino Uno

Hi Guys,

I have read a few forums/documentations about that topic, but I thought I still double check with you juts to confirm that I understand everything right.

So I basically would like to connect an RS485 device to my arduino UNO while I still would like to communicate(send data) with my computer. My RS485 device would be a modbus RTU slave. I tried two different classes to pull data out from it:

I have read that I can not use the rx tx (digital 0,1) channels if I use the USB as well. Before I known that I already tried and I do get signal on my RS485 device and on my PC as well, but I do not get any proper reply.

So the question is, do I need to use anything like that: mini RS485, would that be even something that I need to use? Or is it possible to do it without any extra components?

Would it be better if I go for an Arduino Mega?

For the final idea I will not need to communicate via USB as the data would be saved on an SD card which I would just remove when ever I want the data. Right now the USB connection is mainly for testing.

I guess it would be easier to just save the data which I receiver on an SD card without the USB connection and check if the data is right on the SD card or not for debugging. It would be slower, but then I would not need to change the board or ad any extra RS485 stuff.

Any comments/ideas will be appreciated, Regards Daniel

The ModBus libraries use HardwareSerial, so they cannot do what you want out of the box.

It might be possible to adapt a copy of the library to use SoftwareSerial, but I am not totally sure about this - SoftwareSerial doesn't seem to know about parity bits, which might be important.

The Mega does have 3 hardware serial ports, so it might be the simplest way to get both USB and RS485 working. You would have to change the code to use Serial1/Serial2/Serial3 instead of Serial.

An alternative strategy might be to get a cheap 16x2 i2c monitor, and use that for debugging instead of the serial monitor. Bluetooth also might be an option, though there is likely to be more 1 time setup with bluetooth.

Thank you for you reply. At the end I ended up testing it slowly:P

  • I upload my code via USB
  • Then go for a battery power supply
  • Insert SD card
  • Save Data on SD card
  • Check if data right on the SD card on a PC

And I keep continue that procedure until it is not working the way I want it:P

I managed to use the modbus master libabry, it reads out some data, I just need to transfer it back to 32bit floating point reverse instead of the 16bit int that it gives me.