0

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.

user16307
  • 11,802
  • 51
  • 173
  • 312

4 Answers4

2

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.

Kortuk
  • 13,362
  • 8
  • 60
  • 85
  • 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:(( – user16307 Apr 17 '12 at 00:12
  • @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. – Kortuk Apr 17 '12 at 01:35
  • Thanks, is that easy to establish an adhoc network between iPhone and Arduino? I couldn't find a detailed tutorial – user16307 Apr 17 '12 at 02:56
  • @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. – Kortuk Apr 17 '12 at 03:47
1

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.

Nick Johnson
  • 7,739
  • 3
  • 28
  • 44
  • 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. – Kortuk Apr 17 '12 at 01:36
  • @Kortuk Well, a phone definitely doesn't have wifly support, but probably has bluetooth serial profile support. – Nick Johnson Apr 17 '12 at 01:37
  • 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. – Kortuk Apr 17 '12 at 01:48
  • @Kortuk Oh, right, I understand what you're saying. I'd be interested to see what sort of range the OP can get with a bluetooth shield and a phone, though. I'm actually working on something using the iteaduino myself, so I'm in a similar situation. – Nick Johnson Apr 17 '12 at 01:50
  • just research the sensitivity of the phone and output power and when you find yours you have a good baseline. We used a device that was pretty cost effective for our pocket but a 30 dollar chipset for a phone is not reasonable, it was just an easy way to give us great range. – Kortuk Apr 17 '12 at 01:54
  • nick thanks but i need to establish an adhoc network between iPhone and Arduino. the guys i am working with told me i cannot use Bluetooth shield with iPhone. i think it is about Apple thing. Guys changed their mind now they dont want a PC in between. Maybe i should edit my question.. – user16307 Apr 17 '12 at 02:59
  • 1
    @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? – Nick Johnson Apr 17 '12 at 03:01
  • the company i’m working with wants me to demonstrate Arduino control directly by an iPhone via WiFi network. There will be no PC running, no additional accessory attached to the phone, no server should be used. I need to establish an Adhoc network betwwen Arduino and iPhone. something like sending UDP packets to the Arduino – user16307 Apr 17 '12 at 03:13
  • 1
    @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? – Nick Johnson Apr 17 '12 at 05:21
1

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.

Nick Johnson
  • 7,739
  • 3
  • 28
  • 44
  • 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? – user16307 Apr 17 '12 at 06:11
  • 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. – user16307 Apr 17 '12 at 06:18
  • 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. – Nick Johnson Apr 17 '12 at 06:20
  • 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? – user16307 Apr 17 '12 at 06:27
  • 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 – user16307 Apr 17 '12 at 06:51
  • @cmd1024 Your iPhone will probably be able to still use its 3g connection for internet access when connected to an adhoc network. – Nick Johnson Apr 17 '12 at 06:58
0

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.