Project - WiFi RN171 ( XBee RN-XV ) Driver and Utility

I just posted WiFi RN171 ( XBee RN-XV ) Driver and Utility on Codeshare. Feel free to discuss and make suggestions here.

9 Likes

What perfect timing! I am just refactoring an old project to use the RN-XV and Cerb Bee… thanks!

@ ransomhall -
Glad to hear that it may be helpful. Cerbuino Bee and WiFi RN-XV is a perfect couple. Please tell me if you find any bugs.

@ RoSchmi -

Somehow I missed this one…

Thanks for the code! (Better late than never)

Just what I needed

This is my first post to this forum:
I have a Cerbuino bee module and a WI-FI bee v2.0 using RN171. I used CoolTerm software to make the connection with the WI-FI module, but it is not recognized by CoolTerm, neither by Comm operatar v4.8. My question: Can I use WI-FI bee V2.0 directly on the Cerbuino bee board ? Do I need to connect it to a Gadgeteer adapter ? Thank you. Here is a picture of my board with the Wi-Fi v2.0

@ microu -
Hi, welcome to the forum.
If the pin layout of your module is the same as of the XBee RN-XV there should be no problems. It can be used on the Xbee socket of Cerbuino Bee. The proper #define directives must be set in program.cs and the driver class.
I would first try with a baudrate of 9600 .

Edit: There was a discussion about the module and the driver in this thread:

https://www.ghielectronics.com/community/forum/topic?id=17026&page=7

Perhaps you can find there some useful informations.

Thank you RoSchmi for your answer.

I have another question about WiFi. Since my last post about RN171, I have received my new RN-XV Wifly module. Before plugging this new module into the Cerbuino bee, I would like to know if there is a startup procedure to be made with any serial module and CoolTerm software ?
If yes, what would like to know: What would be the best serial module to use for this startup process.
If no, I will understand that I can put the RN-XV in the xbee socket of the Cerbuino bee and I will be able to use your driver program and go on with my C# programming.

Thank you again.

@ microu -
Hi, I think that you do not need a startup procdure with another terminal program. Just plug in the RN-XV WiFly module. Set the credentials for your wlan router in this line of program.cs


bool ActionResult = wifi_RN171.JoinWirelessNetwork("mySID", "myPassword", 0, Gadgeteer.Modules.RoSchmi.WiFi_RN171.WirelessEncryptionMode.WPA2_PSK, "80");

and deploy my driver project to the Cerbuino Bee and look what happens.
If you don’t have additionally connected an GHI USB -Serial module with the Cerbuino you must comment out the Code segements that belong to this module.

trying to use this with a Raptor and 4.3. Just doing the simple connect test before I try doing an connect and update firmware so its still running 4.0. The RN171 is plugged into socket 4 and I have button on socket 18 which creates the following output which looks there is a problem, any suggestions as I hope its something simple I’m missing.


        void button_ButtonPressed(Button sender, Button.ButtonState state)
        {

            wifi_RN171 = new WiFi_RN171(4, 57600, GTI.SerialParity.None, GTI.HardwareFlowControl.UseIfAvailable);

            wifi_RN171.SetDebugLevel(WiFi_RN171.DebugLevel.DebugAll);

            wifi_RN171.EnableDHCP();

            bool ActionResult = wifi_RN171.JoinWirelessNetwork("xxxx", "yyyyy", 0, Gadgeteer.Modules.RoSchmi.WiFi_RN171.WirelessEncryptionMode.WPA2_PSK, "80");
        }

@ Duke Nukem - I’ve been told (by GHI support) that flow control does not work on the Raptor, so if RN171 requires it (like the IoT Labs IL-G-WF121) then we have to wait for a firmware update.

The Raptor is likely way over kill for this device (but if you need a hammer and have a thermal nuclear device handy, its hard not to want to use it to really get that nail in good), so I’ll try it with a Spider and see if it works, thanks.

@ Duke Nukem - Let us know if the Spider works. I’ve tried the Raptor, Hydra+, Ceberus, Octopus, Cerb40 II, and Cobra II Eco. All except the Raptor and Hydra+ worked with the IoT Labs module.

@ Duke Nukem -
Hi, I just tried to run the application on the raptor and I can confirm, that switching from using hardwareflowcontrol to not using harwareflowcontrol and automatically changing the Baudrate does not work properly on the raptor. I did most of my tests on a Cerbuino Bee. However, if you set the RN171 module for example to Baudrate 57600 and not using hardwareflowcontrol.


wifi_RN171 = new WiFi_RN171(2, 57600, GTI.SerialParity.None, GTI.HardwareFlowControl.NotRequired);

on the Cerbuino Bee and then use this RN171 module on the Raptor it will work.

Keep in mind that there is still a bug in my program even if using the Cerbuino Bee: If you want to switch from not using hardwareflowcontrol to using hardwareflowcontrol you must change the baudrate as well, that the changes are performed properly. When the switch of hardwareflowcontrol is performed, you can go back to the baudrate you used before.

@ munderhill -
Hi, I did some more tests.
I think you are right, the RN171 does not work with harwareflowcontrol on the raptor.
On the Spider it works with hardwareflowcontrol.

However my mechanism of changing hardwareflowcontrol and bautrate automatically (as set by parameter in the constructor of the Driver class) actually seems to work only on the Cerbuino Bee. So at the moment I have to set the wanted seetings on the Cerbuino Bee and than can use the module with these settings on the other boards (But not with hardwareflowcontrol on the raptor).

As I read you use always the baudrate of 115200 with hardwareflowcontrol.
How do you handle the case if the serial port of the WiFy module is set to another baudrate (e.g. by another driver or program)?

That is a relief to hear that as I thought I was losing my mind. The GHI driver lets me do command sessions with the board so I can probably use that to set the speed and flow control and then temporarily take it out of this driver.

If the actually set baudrate and hardwareflowcontrol status of the RN171 match with the parameters used in the constructor of the driver class it should work without changing the Driver (but as I said, hardwareflowcontrol seems not to work on Raptor).
Please tell me, if the other functions of the driver work for you.
There is still work to do in the next year, since the connection to my Client randomly hangs after numerous successful requests.

Dear Roschmi,

I have installed the RN-XV Wifly on my Cerbuino bee and I used your driver to control it. It works fine and I just wanted to let you know that I am really happy. Thanks a lot, Michel.

@ microu -
Thank you for your feedback. Please tell me if you find issues or if you have suggestions to improve the driver.

Now that my Cerbuino bee is connected to the Wi-Fi using this driver, I am trying to use the NETMF to consume a WebService yet with no success. My code is working on the PC, but not on the Cerbuino bee with the RN-XV Wifly.

I would like to know if someone can provide me a working example of code consuming WebService that can be executed on the Cerbuino bee with the Wifly RN-XV.

Thank you.
Microu.

I’m not at home til next sunday. Can You describe a Little Bit more what you Want to do?