0

I'm trying to sending and receiving data via RS485 communication. Interfacing Arduino and PC(laptop) using SN75176 RS485. I wrote a program to send a string "Hello" from arduino via Tx pin. My intention is to receive the "Hello" string in my PC's hyperterminal. After uploading the program im receiving junk data. The baud rate i've mentioned in my program and i gave in hyperterminal are same. I've checked the wire connection, it is ok. Then, what is the problem?

Code:

#include <SoftwareSerial.h>
int Txpin = 1;
int ditpin = 5;  //for 1st rs485
int ditpin1 = 2; //for 2nd rs485
void setup()
  {
          // put your setup code here, to run once:
    Serial.begin(9600);
    pinMode(Txpin,OUTPUT);
    digitalWrite(ditpin, HIGH); //For transmit data from arduino
    digitalWrite(ditpin1, LOW); //For receive data to hyperterminal
  }

void loop() 
  {
    Serial.println("Hello\r\n");
    delay(1000);
  }

Wire connection:

enter image description here

  • No ground on the PC side? – Mikael Patel Dec 14 '15 at 6:01
  • Thanks for the reply...No. I didnt connect. Will it be the problem? – user6161 Dec 14 '15 at 6:14
  • Instead i short both rs485 GND. – user6161 Dec 14 '15 at 6:22
  • The control pin, VCC and ground is not correctly wired on the PC side. Google how to connect RS485. Too many issues with this wiring. Please see this reference. gammon.com.au/forum/?id=11428 – Mikael Patel Dec 14 '15 at 6:25
  • 1
    I think I understand what you are trying to do. You do know that the signal (R) is not RS232 levels? It is 5V. I think you are looking for a TTL to RS232 converter and not RS485. Something like pdfserv.maximintegrated.com/en/ds/MAX3222-MAX3241.pdf. Or ebay.com/itm/… – Mikael Patel Dec 15 '15 at 14:12
0

You cannot connect from Arduino serial input/output with RS485 circuit and then to the PC RS232 port. You need a TTL to RS232 adapter. For instance an adapter based on MAX3222.

MAX3232 circuit diagram

Cheers!

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.