Go Down

Topic: How to connect an A/D-converter via RS485? (Read 169 times) previous topic - next topic



is there a possibility to connect an analog-digital converter to the Due's serial ports via rs485?
I tried already a RS485-TTL-converter. but it's not working.


Why would you need an RS485 connection to an A/D converter ?

BTW, AFAIK RS485 is simply a physical layer mostly used when long distance wires are needed to avoid EMI thanks to a differential bus, and you have to code your own protocol. 

You can have this type of differential bus PLUS a protocol with a CAN bus. A CAN transceiver (3.3V CAN transceiver) is needed (unless your wires are shorter than 3 to 4 meters long) and a CAN library (see collin80 CAN library for the DUE on github).


The converter is the LDU 68.1 by Soemer.
Technical data of the converter.
The wires are very short (<0.5m)


You will find page 801 of Sam3x datasheet how you can set USART peripheral in RS485 Mode. Connect RX/TX/RTS to an RS485 transceiver (3.3V). Page 773 provides RTS pins locations (plus see Graynomad pinout diagram).

A basic sketch that I tried (without transceivers, only RX1 to TX2 and RX2 to TX1):

Code: [Select]
/*                          USART RS485 Mode                                    */
/*                    Hook RX1 to TX2  and RX2 to TX1                           */

char c = 0;
void setup() {


  Serial1.begin(115200); // Serial1 is for USART0
  Serial2.begin(115200); // Serial2 is for USART1




void loop() {
  String s;
  s = "";

  while (Serial1.available() > 0) {
    c = Serial1.read();
    s += c;

  if (s.length() > 0) {


Thanks for the sketch. But why do i need Serial2? For which purpose?


You don't need it, that's only an example to show how you select RS485 feature for USART and see the result with Serial by connecting USART0 to USART1 on a single board. 


Thanks. But the sketch is only receiving. Do I send commands just with Serial1.write?
A command consists out of one or two capital letters followed by a carriage return.
For example I want to accomplish the following communication:
Sending: OP1\r (Opening channel to converter one)
Receiving: OK 
Sending: GN\r (Get Data)
Receiving: N+12345

Another Question:
How do I connect the converter to the DUE? RX+,Rx-,Tx+,Tx- to just one RX Pin and one TX Pin

Go Up