Communication with an Android device using WiFly RN-XV

I am building a self balancing robot for a class using a Maple (I know this is the Arduino forum, but this site is way more active than the LeafLabs forum), and my professor wants us to use an Android tablet as a sort of controller to steer the robot. Each group was given a WiFly RN-XV and a Sparkfun XBee shield. I know basically nothing about network programming, so I've been doing a lot of searching around, and I've found a few libraries designed for use with the WiFly (such as WiFlyHQ), but they seem way more complex than what I need.

Basically what I want to do is use the RN-XV in adhoc mode, have my android device connect to it, and send a few commands from the android to my balance bot. Once I get that implemented, I'd also like to be able to send sensor data from the bot to my android tablet (or possibly a separate computer). Granted, since I don't know much about wireless communications, this might be harder than it seems, but can anyone offer me tips on how to get started?

A Chevy dealer probably has a lot more customers than a Packard dealer, too. That doesn't make it more likely that the Chevy dealer will be able to solve your Packard problem.

Go talk to the Packard dealer about your problem.

Unfortunately, I don't seem to be as witty as you in coming up with car dealer analogies, so all I can say is that I did ask the Packard dealer, I posted in both forums. There seem to be quite a few similarities between Maple and Arduino boards (I'm using a shield designed for the arduino after all). I figure any advice here is going to be pretty much as applicable as advice I'd get there.

Basically what I want to do is use the RN-XV in adhoc mode, have my android device connect to it

So your Android device is rooted? AFAIK Android doesn't support ad-hoc WiFi if the device wasn't rooted.

You can configure your RN-XV so that it acts like being a serial connection when a PC connects to a preconfigured port. This way you don't have to use special libraries (which might not work on your Maple), just use the serial interface as if the Maple is directly connected to the PC via USB. This is, in my opinion, the biggest advantage you have by using a RN-XV instead of a WiFi shield.

When I set up the adhoc network, the tablet I was using seemed to recognize it and connect correctly. I didn’t try sending any data, though, seeing as I didn’t have any programs written for it yet.

Thanks for the tip on how to set it up. I think I got so overwhelmed by all of the huge libraries that I may have missed some of the simpler stuff. I’m back to reading the WiFly manual now, so hopefully I can take care of everything with that.

I am building a self balancing robot .... and my professor wants us to use an Android tablet as a sort of controller to steer the robot.

Well, I hope you have 4 other team members, and till the end of the school year to finish this project. Just the computer/comms/Android part alone is gonna be some work, not to mention the robot.

Here is the best info I've seen on balancing robots,

http://geology.heroy.smu.edu/~dpa-www/robo/nbot/

In regards RN-XVee, I would "first" do the following,

  1. put off Android till I know what's going on.
  2. attach XVee to the Maple, and write a utility-sketch to talk to Maple from your PC via USB to one UART, and pass the comms straight over to a 2nd UART connecting XVee. This is a trivial sketch, but allows you to talk directly to the XVee from the PC.
  3. now you can go into configuration mode and configure the XVee.
  4. setup XVee for a local adHoc network.
  5. download ZOC from the internet.
  6. load ZOC onto a 2nd PC, setup for an adHoc wifi connection to the XVee, select UDP or TCP mode, and you're talking via XVee between the 2 PCs.
  7. spend the next 9 months doing the rest of the project, :-).