Grove RS485 : Modbus RTU communication

Hello,

We want to use a grove RS485 module on Wio Terminal to communicate with modbus RTU devices.
Is there any example in Arduino IDE that show how to use this RS485 interface.

Thanks

Best regards

Can you provide an exact product name for us, we will test on this. :smiley:

Pretty much this one he’s talking about: Grove - RS485 - Seeed Studio

I have the same question though. Nothing I can find and it would be very helpful

The RS485 module actually provides detailed instructions on the Arduino official website. You can find the sample code of this module and learn to use it through the following website: https://create.arduino.cc/projecthub/maurizfa-13216008-arthur- jogy-13216037-agha-maretha-13216095/modbus-rs-485-using-arduino-c055b5
Sorry for hindering your learning of related modules. We will add more conspicuous learning guidelines in subsequent Wiki versions. Please stay tuned.

Hi, is there any news about using grove rs485 with wio terminal ?

I can’t find any example.

Thanks

Dear Citric, the example you pointed refers to an arduino uno interfacing with a “standard” rs485 module.

We’d like to have an example using wio terminal and RS485 Grove attached on wio’s multifunction grove connector.

Thanks !

Hello, as you can see, we have hundreds of Grove products. Different products can be combined to form hundreds or thousands of combinations. We cannot complete a tutorial for all of these combinations. You can try to configure and use Wio Terminal yourself according to the usage method we provide, and we are happy to see you can do so.

Dear Citric,
there’s NO USAGE METHOD GIVEN for RS485 , that’s the point.

You only provide examples for analog and digital grove but this one is a communication port.

I only wish to know how to configure a com port on the right grove port on wio terminal (the one connected to D0 D1)

Can you help me ?
TIA

Hello, I have also noticed this problem. I am applying for the RS485 module. I will test it after the approval, and then I will try to write an example. This may take about ten days.

Great !

That’s very important for us , we’re already using a “normal” rs485 module connected on the gpio but using a grove port would avoid an indesiderate wiring.

Thank you so much, I really appreciate your effort !!!

I’m back again. I have applied for two RS485 modules and tested the communication with two Arduino boards. The test is normal and the tutorial is currently being written.
This is my wiring diagram.


The idea is: set the digital pins 6 and 7 on the Arduino as the soft serial port RX and TX to connect with the RX and TX on the RS485 module.
This is the code for two Arduino boards, one is the master and the other is the slave, which needs to be downloaded to different boards.

/*      Master      */
#include <SoftwareSerial.h>
SoftwareSerial Master(6, 7);
char val;

void setup() {
  Serial.begin(38400);   
  Serial.println("Master is ready!");
  Master.begin(38400);
}

void loop() {
  while (Serial.available()) {
    val = Serial.read();
    Master.write(val);
  }

  while(Master.available()) {
    val = Master.read();
    Serial.write(val);
  }
}
/*      Slave     */
#include <SoftwareSerial.h>
SoftwareSerial Slave(6, 7);  
char val;

void setup() {
  Serial.begin(38400);   
  Serial.println("Slave is ready!");
  Slave.begin(38400);
}

void loop() {
  while (Serial.available()) {
    val = Serial.read();
    Slave.write(val);
  }

  while(Slave.available()) {
    val = Slave.read();
    Serial.write(val);
  }
}

The actual effect is as follows:

Explain why the soft serial port is used instead of the serial port directly, because the Arduino serial port needs to be used to download the program. In order to avoid the need to unplug the module when downloading the program (I think it is more troublesome), I use the programming soft serial port here, of course If you don’t find it troublesome, you can use the serial port directly.

Hi Citric,
thanks for your effort, I only need a little step more because, as I pointed before, We’re working on wio terminal devices and the desidered wiring is the one shown in the enclosed picture (RIGHT grove port).

Maybe be we only have to change the software serial pins ? In this case, which are the right pins ?

Thanks as always !
MZ

I don’t have a wio terminal that can test it for you. You can try to see if it is successful.

Hope this could help someone, it’s not the solution I need but a little step forward.

Thanks to user Kenta IDA that posted this code :
https://gist.github.com/ciniml/bd2bb4dea22a55c067ca6790ad0c3eae

I got the LEFT grove port working as per picture enclosed

While RS485 grove module accept both 3.3 and 5v, some receiving device can’t cope with 3.3v signal given by grove port so in this case you’ve to modify the cable and get the 5v and gnd from rpi connector

Here is a picture of the modified cable :

Going on with experiments because the RIGHT grove port (the one I need) isn’t working with the code provided by Kenta IDA.

Dear Citric,
just to understand, are you an official seeedstudio support ?

I’m asking this only to “calibrate” better my request (I.E. if you’re officially supported you should have a wio terminal)

Thanks