1

I want to have two RF transceivers communicate, one as transmitter and one as a receiver, for longer distances. For that I'm using WIR 1186 RF modules with Arduino.

Pin connections are as below:

  • Arduino :5v,gnd,RX,TX,2,3
  • WIR1186 :VCC,gnd,Tx,Rx,prg,cts

But Arduino is not serially communicating with the WIR1186 module.

Below is the code:

char ch;
int prog = 2;
int cts = 3;
int stat;
unsigned int output;

void setup() {
  Serial.begin(9600);
  pinMode(prog, OUTPUT);
  digitalWrite(prog, LOW);
  stat = digitalRead(prog);
  Serial.println(stat);  
  Serial.write("B=9600\r\n");
  output = Serial.read();
  Serial.println(output); 
  digitalWrite(cts, HIGH);
}

void loop() {
  Serial.write('a');
  delay(1000);
}

Here is the datasheet of WIR1186

Please help me out with this.

5
  • digitalWrite(cts, HIGH); --- Are you sure about that?
    – Majenko
    Oct 2 '17 at 12:13
  • yes,clear to send should be high when we are sending Oct 2 '17 at 12:32
  • Err... have you read the datasheet?
    – Majenko
    Oct 2 '17 at 12:33
  • yes i referred that and i have downloaded WIR library from GIthub, based on the header file function i have given cts High, Before that the commands in setup are also not sending to WIR module Oct 2 '17 at 12:49
  • Is your WIR-1186 on some kind of carrier board with voltage regulator and logic level translation?
    – Majenko
    Oct 2 '17 at 13:17
1

If you use pin 2 and 3 for serial communication you have to use SoftSerial, because Serial is hardwired to pin 0 and 1.

1
  • pin 2 and 3 of arduino has connected to prog and cts pins of WIR module Oct 2 '17 at 5:42
1

Two things are wrong:

  1. You aren't setting PROG to HIGH to enable transmit mode - you are stuck in programming mode.
  2. CTS is an output from the module to an input on the Arduino. You don't set it high - you look to see what level it is to see if it is safe to send more data.

To quote from the datasheet you link to:

The WIR-1186 offers data flow control hardware to allow for zero data over-run and loss when sending large files and data packets. The internal data buffer on the WIR-1186 module is 128bytes. When the data terminal1 sends a large file for wireless transmission the module2 will except 128bytes and then set the CTS pin LOW to alert the data terminal to wait for the CTS to back HIGH before sending more data over UART.

(footnotes mine)

Also you cannot use pins 0 and 1 for serial if you are at the same time using them for USB debugging. You will either have to move to another pair of pins and use SoftwareSerial, or invest in a better Arduino with more than one UART.

Another thing of importance: If your WIR-1186 isn't on some kind of carrier board with voltage regulator and logic level translation it's safe to say that you have killed it. Well done.

Warnings

  • The maximum allowable voltage on any of the interface pins with respect to GND is 3.6V
  • The maximum input voltage VCC with respect to GND is 3.6V
  • The baud rate setting in configure mode is fixed 9600bps
  • Do not leave the UART_TX input pin of the module open. The module will send junk data on thewireless channel. It must be pulled up to VCC if not used.

1 Arduino 2 WIR-1186

3
  • but it is not entering into command mode also ,when i send a command in setup as in the program it is not giving any response Oct 2 '17 at 13:02
  • Your program isn't looking for a response. It's looking to see if there's a single character in the RX buffer at the moment you send the command. Learn the basics of serial before trying to use it. hackingmajenkoblog.wordpress.com/2016/02/01/…
    – Majenko
    Oct 2 '17 at 13:04
  • no response is getting, Serial.read() is printing -1 Oct 3 '17 at 4:24

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.