[SOLVED] DFR0259 RS485 Shield

I need some advice getting my DFR0259 shield working.
I have a sparkfun redboard and dfr0259 as my project is to make a MODBUS RTU slave.
I have the redboard programmed as an RTU slave fine and working with a MODBUS master simulator fine over the USB interface.
Now I am trying to get this working via RS485, but cant get the dfr0259 to work.
I am back to basics and am testing using the dfrobot tutorial.
I have even bought the same DTECH USB to RS485 converter as used in the tutorial but still can not get the tutorial to work. I enter “V” and get no response.
To troubleshoot I have modified the sketch to just print OK every second.
When I do this I get OK every second on the DTECH serial monitor, but I also noticed that i get OK displaying on the redboard USB serial monitor, which is not correct. My operating / program switch is in the ON position.
I have wired exactly per the dfrobot tutorial. The redboard is sending data but not receiving for some reason.
Any advice would be appreciated as unless there is a board problem (low probability) I can’t see any error I have made, as with the exception of using a redboard instead of an uno I am following the tutorial exactly.


Hey @Chris48654, thanks for bringing your question to the forum.

It’s a little tricky to keep up with what configuration you have everything in - Do you mind uploading a quick hand-sketch of the hardware layout?

If I understand correctly, you’re having a message appear on a device you’re not intending to broadcast to.
From memory, I think Modbus RTU supports a “broadcast to all slaves” address. It might be address zero that does this. This might explain the behaviour you described.

Michael, Thanks for your response.
Yes you are correct in that Modbus RTU address 0 is a broadcast message.
For this query there is no modbus involved, thats just my end goal.

I am trying to get the DFR0259 RS485 shield using the dfrobot tutorial code and sketch.
My test layout is identical to the tutorial except I am using a redboard instead of an uno.
My components are:

  1. Redboard.
  2. DFR0259 RS485 shield
  3. DTECH USB to RS485 converter
  4. Three wires linking A,B and GND. note GND is not necessary but I have added per the tutorial.
  5. IDE 1.8.4 using the code from the tutorial for automatic transmission.

I guess my queries are:

  1. Any known compatibility issues between redboard and DFR0259.
  2. Anyone ever got a dud DFR0259.
  3. Any suggested next step, like try an uno, another DFR0259, another RS485 shield?

To reiterate: You’ve modified the Arduino sketch to transmit “OK” every second, which should be sent through the RS485 sheild, received by your DTECH hardware and finally displayed on your computer.
It sounds like you also have a USB cable plugged into the Redboard, and you’re monitoring the Redboard’s serial port with the Arduino serial monitor.

Here’s the thing: the RS485 is using the same Tx/Rx pins as the Redboard’s serial adapter: pins 0 & 1.
So the behaviour you’re seeing makes sense. The Redboard sends an “OK” which goes out it’s Tx pin. The Tx pin is connected to both the USB port via a UART converter and the RS485 shield. So the OK message goes to both terminal monitors.

What this ultimately means is you cannot use the Redboard’s USB connection as a (complete) serial monitor. If you must have an independent serial connection to the Redboard you can seize some digital pins for use with the Soft Serial library. This would also require additional hardware - a UART-USB adapter for your new soft-serial pins.

Here’s a hack of the example sketch. Remove the Redboard’s USB lead and try powering your Redboard from a different supply eg. 9V battery or plugpack. You should see LED (D13) activity every time you transmit any data from DTECH → Redboard.

int led = 13;
void setup()
void loop() {
  int temp;
  if(Serial.available()) {

If that works out, try the vanilla example again and the LED should toggle only on a “V” being received and the OK message should be returned on your DTECH serial monitor for any data received.

Best of luck and keep us posted with your progress!

1 Like

Thanks for the suggestion to just test the serial.available() and use an external power.
The results are that with your small sketch, then yes serial.available() does become true and the led flashes when I send some data. I even added another LED just to make sure.
When I go back to the dfrobot tutorial sketch and send “V”, still nothing. The pin 13 LED flashes and even I see the Tx LED flash, but nothing back on the serial monitor.
See picture below of my setup.
I also noticed this time that to download a sketch now I have to remove the shield, otherwise the sketch will just sit on downloading for an extended time, regardless of the program switch position. I am sure previously this worked.
I dont see I can investigate further without new parts. I will order another type of uno board and another RS485 shield and try again.

Ok I have received another DFR0259 shield and a another generic UNO board.
I first tested the new shield with the redboard and got the same result. (ie could not get the standard DFR0259 sketch to work).
I then tried the new UNO board with the new shield.
First problem was that to get the sketch to load on the generic UNO board I had to re-install the Arduino IDE on another computer. Remember the redboard uses different IDE drivers from UNO standard.
Anyway once I got the sketch loaded on the UNO and tested everything worked correctly.
Tested the old shield on the new UNO and that worked as well.
Conclusion is that either I have a faulty redboard OR there is some incompatibility with the redboard and this Dfrobot shield. I suspect the latter due to the different drivers.
Just glad my problem is solved and I can now complete my project

1 Like

Hi Chris,

Wow, certainly sounds like you’ve done some digging with that one. I think it’s safe to say that you’re now an oracle for board mapping and compatibility! Glad to hear you got everything worked out in the end. I’d be interested to hear if you ever get the Redboard sorted with the DF shield…strange.