Trouble using Wireless Shield and RN-XV

Hi,

I just got a Wireless SD Shield (http://arduino.cc/en/Main/ArduinoWirelessShield) and a Roving Networks RN-XV. I am having trouble getting started using the module to host a webserver.

I discovered the WiFlySerial library and figured it would work with this setup. However I cannot get it to work.

I have been able to manually configure the wireless module using the arduino serial monitor, so I am guessing that the WiFlySerial library is not the correct library to use. Can anyone point me towards a tutorial or anything that might help get me rolling?

Thanks

Never used it as a web server, but did use it with an iPhone app that sends udp messages that the arduino will respond to. Do a search for my posts, I don't have too many, and the should all be about the RN VX wify module...

Cheers!

Waltermixxx:
Never used it as a web server, but did use it with an iPhone app that sends udp messages that the arduino will respond to. Do a search for my posts, I don't have too many, and the should all be about the RN VX wify module...

Cheers!

Thanks I will look them up.

I am still having the problem that I cannot communicate with the RN-XV via my code. If I use an empty sketch I can communicate with the the RN-XV via the serial monitor in the Arduino IDE. So I guess it works.

However, I cannot figure out which pins to use to talk to the module from my sketch. Can anyone help me out? I have the official Wireless SD Shield and an RN-XV.

Do I have to do some sort of configuration to tell the RN-XV which pins to use as TX and RX? And how do the Arduino pins and the RN-XV pins sync up? I.e. is arduino pin #1 the RN-XV pin 1? Maybe that is what is throwing me off.

I've read through everything I can find but I am having no luck. I figured since there was now an "official" wireless shield that there would be some sort of working code and a tutorial demonstration but I cannot find anything.

I guess the main help I need is: what pin on my arduino uno corresponds to the TX pin on the RN-XV and what arduino pin corresponds to the RN-XV RX pin?

I could not find this in any of the documentation. If it is there, I apologize, but can you please point it out to me.

Thanks

The shield you are using connects the WiFly serial to the Arduino's hardware serial ( pins D0 and D1). To make development easier I'd suggest removing D0 and D1pins from the shield and using two jumper wires to connect those pins to two other digital pins (e.g 8 and 9), then use software serial to communicate with the WiFly and keep the hardware serial for debug via the hardware monitor. If you want to later switch the WiFly back to the hardware serial interface ( e.g. for faster baud rates) you can connect the jumper wires directly to the D0 and D1 sockets on the arduino, or solder two new pins to the shield.

I've written a library for the RN-XV available here: GitHub - harlequin-tech/WiFlyHQ: WiFly RN-XV Arduino Library. It's at version 0.1 and I'll add an http server example and update to it today.

Edit: fixed link.

dhunt:
The shield you are using connects the WiFly serial to the Arduino's hardware serial ( pins D0 and D1). To make development easier I'd suggest removing D0 and D1pins from the shield and using two jumper wires to connect those pins to two other digital pins (e.g 8 and 9), then use software serial to communicate with the WiFly and keep the hardware serial for debug via the hardware monitor. If you want to later switch the WiFly back to the hardware serial interface ( e.g. for faster baud rates) you can connect the jumper wires directly to the D0 and D1 sockets on the arduino, or solder two new pins to the shield.

I've written a library for the RN-XV available here: GitHub - harlequin-tech/WiFlyHQ: WiFly RN-XV Arduino Library. It's at version 0.1 and I'll add an http server example and update to it today.

Edit: fixed link.

Thanks for the response. I will give your library a shot. It looks good. The only problem is that I need to run in ad-hoc mode and ad-hoc is listed as a to-do on the github page. I have set the module to default to the ad-hoc network I need, so maybe I can skip network setup in the library and just use it for the webserver interaction.

dhunt,

Thanks so much for sharing your library. My arduino is now connected to my network. I cannot remove pins on my shield because I am borrowing the Wireless Shield at this time. I am thinking I could possibly use a log file for debugging output and make it available via the http server when needed instead of adjusting the pins. Anyways, I'm going to tinker some more. Just wanted to let you know I got it working and thank you for sharing the library.

Thanks

Cool that that's working for you.

A low-cost shield that I've found to be good for the WiFly RN-XV is this one from SeeedStudio. It has a switch to change the serial connection for D0,D1 to D11,D12. Good for SoftwareSerial as long as you don't want to use the SPI interface for something else.

Trying to get stand alone RN-XV module to work here. I have this RN-XV WiFly module paired with an XBEE shield stacked ontop of my Uno (R2). The shield has a switch that changes TX/RX to pins D2 and D3. Trying to use the WiflyHQ library but I can't get it to work.

I loaded the httpclient example.
Set mySSID and myPassword according to my Wi-Fi network. I changed the pins from 8,9 to 2,3 and hit upload ... It compiled with no problem and uploaded with no problem. But when I opened my serial monitor, this is what I see:

Starting
Free memory: 1161
setPrompt failed
Failed to enter command mode
Failed to start wifly
Auto-Assoc roving1 chan=0 mode=NONE FAILED
Auto-Assoc roving1 chan=0 mode=NONE FAILED
Auto-Assoc roving1 chan=0 mode=NONE FAILED
Auto-Assoc roving1 chan=0 mode=NONE FAILED
... ad infinitum

Any ideas?

KirAsh4:
Trying to get stand alone RN-XV module to work here. I have this RN-XV WiFly module paired with an XBEE shield stacked ontop of my Uno (R2). The shield has a switch that changes TX/RX to pins D2 and D3. Trying to use the WiflyHQ library but I can't get it to work.

I loaded the httpclient example.
Set mySSID and myPassword according to my Wi-Fi network. I changed the pins from 8,9 to 2,3 and hit upload ... It compiled with no problem and uploaded with no problem. But when I opened my serial monitor, this is what I see:

Starting
Free memory: 1161
setPrompt failed
Failed to enter command mode
Failed to start wifly
Auto-Assoc roving1 chan=0 mode=NONE FAILED
Auto-Assoc roving1 chan=0 mode=NONE FAILED
Auto-Assoc roving1 chan=0 mode=NONE FAILED
Auto-Assoc roving1 chan=0 mode=NONE FAILED
... ad infinitum

Any ideas?

This means that you're wifly is working on the correct serial ports however it's still setup for the default settings of auto-connecting to an open wifi network.
See where it says "Failed to enter command mode"? That indicates that the program was not able to re-configure your wifly's SSID and passphrase settings.
Check the code again and reboot. I ran across this once when I first started using the WiflyHQ library but after a quick reset and re-upload it started working again.
If your RN-XV uses an external antenna, make sure it's connected.

It looks like the WiFly is not recieving any data from the arduino, but the arduino is recieving data from the WiFly.

Can you try a simple sketch to check the connection?

E.g try this for your loop:

void loop() 
{
    wifly.terminal();
}

Once the terminal starts, try sending $$$ without a newline from serial monitor. The WiFly should respond with "CMD". After that you can send any of the commands from the WiFly user manual. "set uart mode 0" will turn echo back on so you can see what you are typing.

If you can't get the "CMD" response then there's something wrong with the wiring for the serial connection, or the pins being supplied to software serial.

dhunt:
The shield you are using connects the WiFly serial to the Arduino's hardware serial ( pins D0 and D1). To make development easier I'd suggest removing D0 and D1pins from the shield and using two jumper wires to connect those pins to two other digital pins (e.g 8 and 9), then use software serial to communicate with the WiFly and keep the hardware serial for debug via the hardware monitor. If you want to later switch the WiFly back to the hardware serial interface ( e.g. for faster baud rates) you can connect the jumper wires directly to the D0 and D1 sockets on the arduino, or solder two new pins to the shield.

I've written a library for the RN-XV available here: GitHub - harlequin-tech/WiFlyHQ: WiFly RN-XV Arduino Library. It's at version 0.1 and I'll add an http server example and update to it today.

Edit: fixed link.

Hello I'm using exactly the same setup with a Wifly RN-XV, Wireless SD Shield and Arduino UNO and experiencing the same problem. I am able to remove pins on My shield but Not sure what pins D0 and D1 are. Pins I have are A0 to A5, RX 0, TX 1 - 13. Thanks for the information so far this has been very useful as I have messed around with this for weeks and unfortunately I a noob at Arduino :grin:. Please Can anyone be kind enough to help?

D0 and D1 are digital pins 0 and 1. If you clip them off and jumper them to another two digital pins you can use software serial at 9600 or 19200 to talk to the WiFly.

dhunt:
It looks like the WiFly is not recieving any data from the arduino, but the arduino is recieving data from the WiFly.

Can you try a simple sketch to check the connection?

E.g try this for your loop:

void loop() 

{
    wifly.terminal();
}




Once the terminal starts, try sending $$$ without a newline from serial monitor. The WiFly should respond with "CMD". After that you can send any of the commands from the WiFly user manual. "set uart mode 0" will turn echo back on so you can see what you are typing.

If you can't get the "CMD" response then there's something wrong with the wiring for the serial connection, or the pins being supplied to software serial.

Alright, I'll try that later this evening when I get home. I did check all the connections and I know they're done right. However, I do wonder if this is a similar case as using the XBEE explorer regulated where it doesn't work with it for some reason or another (I don't think anyone's actually figured out why, but I could be wrong.) The XBEE shield (what I'm using) does have other "stuff" on it, so it's not just a straight through on the signal pins. A lot of people suggest using the plain old XBEE breakout boards instead of of the explorer boards, so that's why I'm wondering whether this is a similar situation.

I'll let you know what happens when I do the above test.

Oh good point. The sparkfun XBee shield is no good for the WiFly because the voltage level shifting solution for the rx pin does not work. That would explain why the arduino can't send anything to the WiFly. Take a look at the comments from WiFly users on that sparkfun page.

You should be able to replace the diode on the shield with a voltage divider to get it working.

Ah screw it. I have some 2mm headers, I'll just solder wires to them and run the WiFly "bare" on that. The shield can go back to it's dusty shelf. Will report back later.

Lol ok. You should still put a 5V to 3.3V voltage divider on the Rx pin to protect it from the Arduino's 5V output. A couple of resistors will do the job (10K + 20K ?). This site has a good write up: Savage Circuits Interfacing 5V and 3.3V devices.

KirAsh4:

dhunt:
It looks like the WiFly is not recieving any data from the arduino, but the arduino is recieving data from the WiFly.

Can you try a simple sketch to check the connection?

E.g try this for your loop:

void loop() 

{
    wifly.terminal();
}




Once the terminal starts, try sending $$$ without a newline from serial monitor. The WiFly should respond with "CMD". After that you can send any of the commands from the WiFly user manual. "set uart mode 0" will turn echo back on so you can see what you are typing.

If you can't get the "CMD" response then there's something wrong with the wiring for the serial connection, or the pins being supplied to software serial.

Alright, I'll try that later this evening when I get home. I did check all the connections and I know they're done right. However, I do wonder if this is a similar case as using the XBEE explorer regulated where it doesn't work with it for some reason or another (I don't think anyone's actually figured out why, but I could be wrong.) The XBEE shield (what I'm using) does have other "stuff" on it, so it's not just a straight through on the signal pins. A lot of people suggest using the plain old XBEE breakout boards instead of of the explorer boards, so that's why I'm wondering whether this is a similar situation.

I'll let you know what happens when I do the above test.

dhunt,

I have put following code in my sketch as you mentioned in your post. But the arduino still is not able to communicate to RN-XV. Can you please help me out....

#include <WiFlyHQ.h>

#include <SoftwareSerial.h>
SoftwareSerial wifiSerial(8,9);

//#include <AltSoftSerial.h>
//AltSoftSerial wifiSerial(8,9);

WiFly wifly;

/* Change these to match your WiFi network */
const char mySSID[] = "XYZ";
const char myPassword[] = "abc";

char buf[80];

void setup()
{
    Serial.begin(115200);
    Serial.println(F("Starting"));
    Serial.print(F("Free memory: "));
    Serial.println(wifly.getFreeMemory(),DEC);

    wifiSerial.begin(19200);
    if (!wifly.begin(&wifiSerial, &Serial)) {
        Serial.println(F("Failed to start wifly"));
	wifly.terminal();
    }

    /* Join wifi network if not already associated */
    if (!wifly.isAssociated()) {
	/* Setup the WiFly to connect to a wifi network */
	Serial.println(F("Joining network"));
	wifly.setSSID(mySSID);
	wifly.setPassphrase(myPassword);
	wifly.enableDHCP();
	wifly.save();

	if (wifly.join()) {
	    Serial.println(F("Joined wifi network"));
	} else {
	    Serial.println(F("Failed to join wifi network"));
	    wifly.terminal();
	}
    } else {
        Serial.println(F("Already joined network"));
    }

    wifly.setBroadcastInterval(0);	// Turn off UPD broadcast

    //wifly.terminal();

    Serial.print(F("MAC: "));
    Serial.println(wifly.getMAC(buf, sizeof(buf)));
    Serial.print(F("IP: "));
    Serial.println(wifly.getIP(buf, sizeof(buf)));

    wifly.setDeviceID("Wifly-WebServer");

    if (wifly.isConnected()) {
        Serial.println(F("Old connection active. Closing"));
	wifly.close();
    }

    wifly.setProtocol(WIFLY_PROTOCOL_TCP);
    if (wifly.getPort() != 80) {
        wifly.setPort(80);
	/* local port does not take effect until the WiFly has rebooted (2.32) */
	wifly.save();
	Serial.println(F("Set port to 80, rebooting to make it work"));
	wifly.reboot();
	delay(3000);
    }
    Serial.println(F("Ready"));
}

void loop() 
{
    wifly.terminal();
}