0
\$\begingroup\$

I am controlling Arduino from my phone through Processor program which sends commands to Arduino via USB cable. Now i need to put Arduino lets say 10 meters away from the PC. I still didn't get the difference between Xbees and Wifly.

I am trying to establish a simple wireless serial communication between PC and Arduino.

Is a Wifly shiled enough to achieve that?

Or pair of Xbees?

Which is easy to establish communication?

Thanks,

By the way i want to mention that i don't have access to the router. I just share Wifi in an apartment but the router does not belong to me and i can not access that.

\$\endgroup\$

4 Answers 4

2
\$\begingroup\$

Xbee shields easily act as cable extenders, you can have them both setup to communicate with eachother and just send simple RS-232 data over them. With a WiFly you are instead going to need to have the wifly act as a server or client in an exchange over TCP/IP.

I would suggest the XBee for their simplicity, but WiFly will allow you to go to a completely different location and use the internet as part of your range extender. If you have no way for the WiFly to connect to a router I think the options are limited here, you really cant use the WiFly at all. They are very different devices and this is almost apples and oranges.

\$\endgroup\$
4
  • \$\begingroup\$ you mean i should configure router settings to use Wifly? you said "allow you to go to a completely different location" you mean wifi range? by the way my real plan was to talk to Arduino wirelessly without a PC in between:(( \$\endgroup\$
    – user16307
    Apr 17, 2012 at 0:12
  • \$\begingroup\$ @cmd1024, with a module that connects to wifi you can connect to a wifi network somewhere else and use the internet to connect back. I misread that part, yes, you could use the wifly module to connect directly from phone, but I think Nicks answer makes more sense for the case you are in. \$\endgroup\$
    – Kortuk
    Apr 17, 2012 at 1:35
  • \$\begingroup\$ Thanks, is that easy to establish an adhoc network between iPhone and Arduino? I couldn't find a detailed tutorial \$\endgroup\$
    – user16307
    Apr 17, 2012 at 2:56
  • \$\begingroup\$ @cmd1024, you should be able to form a direct connection with wifly using sockets of some sort. Sorry to say that I know this is very easy on Android, I dont do iPhone development. \$\endgroup\$
    – Kortuk
    Apr 17, 2012 at 3:47
1
\$\begingroup\$

Since you're communicating with a PC, consider bluetooth. You can get bluetooth shields, or even Arduino clones with onboard bluetooth. Either one appears to the Arduino as a simple serial port.

Since you can use a standard bluetooth dongle on the PC end (or built in bluetooth, if your PC has it), this is likely to be cheaper than an XBee based solution.

Range, however, may be a concern - 10 meters is at the edge of the range you can reliably achieve with Bluetooth.

\$\endgroup\$
9
  • \$\begingroup\$ you might be surprised how far you can go with bluetooth but you need both ends to be controllable, in this case the phone is locked into its solution. 30M is probably a pretty accurate range estimate in my opinion also. \$\endgroup\$
    – Kortuk
    Apr 17, 2012 at 1:36
  • \$\begingroup\$ @Kortuk Well, a phone definitely doesn't have wifly support, but probably has bluetooth serial profile support. \$\endgroup\$ Apr 17, 2012 at 1:37
  • \$\begingroup\$ you misunderstand, I mean that the phone already has its Bluetooth chip and antenna selected. I have used bluetooth before were the host I was able to choose the chip for also so I chose a high sensitivity high power on both sides, amazing range. I gave your first upvote, I misread the phone part, so although my answer is for the question a bluetooth board is a much better alternative. \$\endgroup\$
    – Kortuk
    Apr 17, 2012 at 1:48
  • 1
    \$\begingroup\$ @cmd1024 Can you clarify what your requirements are (in the question)? Does the phone have to interact with the Arduino with no additional hardware on the phone? Is an accessory attached to the phone over USB okay? What about a third-party like a PC (as you mention) mediating communication? \$\endgroup\$ Apr 17, 2012 at 3:01
  • 1
    \$\begingroup\$ @cmd1024 Ah. You should have said so in your original post, because that changes the answer totally. Does it have to be adhoc? Can't you rely on an existing wireless network? \$\endgroup\$ Apr 17, 2012 at 5:21
1
\$\begingroup\$

If you need to connect over wifi, you cannot use a standard xbee - XBee/ZigBee use a separate networking protocol, not compatible with 802.11(b/g/n). There are a number of wifi shields for arduino, such as Sparkfun's wifly shield. This module definitely supports adhoc networks - see page 44 of the reference guide (pdf) for details.

There are other options, including other arduino shields, the blackwidow, which is an arduino clone with built in wifi, or the rn-xv wifly module, which is pin compatible with an xbee but speaks wifi. All appear to support adhoc mode.

Unless you have a compelling reason, I would go for the Sparkfun wifly shield. Of all the solutions, you're least likely to have issues sourcing more of them, and they even publish their schematics, so you could make your own if you had to.

Whichever solution you use, the procedure on the Arduino end will be much the same. The module includes a basic TCP/IP stack, so the Arduino doesn't have to implement its own stack. You speak AT commands to the shield (like a modem), including telling it to open or accept connections. In connection mode, you can treat the TCP socket like a serial connection.

\$\endgroup\$
6
  • \$\begingroup\$ many thanks for the detailed explanation. i think i should go for wifly shield since i am novice. i just need a step by step explanation for an adhoc network configuration. i will read the guide you gave. i am a bit new to this arduino business. lets say i have an arduino sketch which turns on/off an LED with a puch button. after wifly iphone adhoc connection, i need to implement it in a browser which sends the commands from iphone to wifly right? do i need any other upload to wifly shield or i should only modify arduino code? \$\endgroup\$
    – user16307
    Apr 17, 2012 at 6:11
  • \$\begingroup\$ by the way should i need a router ? i don't have access to the router of wifi network i can only connect to it. \$\endgroup\$
    – user16307
    Apr 17, 2012 at 6:18
  • \$\begingroup\$ You don't need a browser - that would require your Arduino to implement HTTP. Instead, implement a simple serial protocol on the Arduino for controlling the LED (you can do this using the USB connection to test), then hook it up to the wifly shield to control it over TCP. You don't need a router, you can use adhoc - it just adds a bit of extra complication. \$\endgroup\$ Apr 17, 2012 at 6:20
  • \$\begingroup\$ oh its too complicated for me. and there is not even one single tutorial explaining these steps. what way will i then use to send data from iPhone if not a browser? \$\endgroup\$
    – user16307
    Apr 17, 2012 at 6:27
  • \$\begingroup\$ Aha! By the way if i use an Adhoc connection it means i will be out of the router and the iPhoen will not be able to browse internet. hmmm it seems this adhoc business is a bit painful \$\endgroup\$
    – user16307
    Apr 17, 2012 at 6:51
0
\$\begingroup\$

Something else to consider is power. XBee can be configured to use very little power. This can be a huge issue in mobile applications. While the Wifly solution can provide the remote / internet connectivity, you should be careful about the power cost.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.