Arduino Uno + Wireless proto shield + Wifly module

Could you try doing a ping from the WiFly to your PC and see if it gets a response (ping 192.168.1.2)? Also can you ping the gateway and see if it responds (ping 192.168.1.1)?

Well, my problem lies with the fact that i cannot seem to use any of the WiFly libs. They either spit out a lot of errors when compliling in arduino 1.0, or the sketch compiles, but hangs while executing.
However i found your post, and i could try to modify it:

//displays on lcd what comes out of the serial buffer
void readFromWifly(){
delay(100);
while(Serial.available() > 0) {
lcd.print(Serial.read(), BYTE);
}
delay(100);
}

I will try this once i get the chance.

Did you have any luck connecting the unit to your network? (as in you can ping and telnet in to the unit)
Perhaps you have some firewall on your pc blocking ping requests / telnet?
Also, i notice in your config that you have:
HOST=192.168.1.2:19999
Doesn't the WiFly try to auto connect to this address?
can you set this to:
HOST=0.0.0.0:2000
see if that does it?

Hi dhunt
I will try updating da wifly when i get home. When I ping it from da PC i get this message "Destination host unreachable" but when i ping the gate away i get responses back plus some stats on no. of packets sent and round trip time are shown on the cmd...
I tried pinging both the PC (192.168.1.2) and the gate away (192.168.1.1) from the wifly terminal but am not getting any response. I didnt get the part u said i need to change the uart mode to autoconnect as there is no such option but i guessed (judging from the reference guide) u meant setting bit 2 high (DATA TRIGGER makes connection on RX data) and so i did it that but no change...
I have a server program i created using java running on ma PC (192.168.1.2) that will be responsible in sending short messages via the wifly to an arduino with an LCD connected to it...am not familiar with wireshark but it wouldnt be a problem using it to monitor the packets...thanks..

mc, your problem sounds like network related problem. (once i got an IP on my WiFly it responded straight away to ping & telnet, so i guess so should yours..)
"Destination host unreachable" normally occurs when you have a problem routing your network traffic, but this is unlikely since you can ping your gateway in the same subnet.
can you give us the readout from some command line tools just to be sure:

  • ipconfig /all (gets all the network settings from your pc)
  • tracert
  • tracert
  • route print (show your IP v 4 route table)
    this should tell us what path your pc is trying to take to the WiFly module, either there is something wrong here, there could be some software blocking ping / telnet requests (be it on your pc or router) or there are options in the WiFly module i'm not aware of :zipper_mouth_face:.
    Also, could you please confirm that your laptop is also connected through a wireless?

like i said, the problem is a network related one, i'm sure once you get that problem out of the way, you can telnet and ping from and to the WiFly straight away. Does (and what pattern) the WiFly blink?

Sponder,
Yah I can confirm that ma PC is connected to the wireless network.
This are the responses for the commands you requested...

C:\> ipconfig /all
Windows IP Configuration

   Host Name . . . . . . . . . . . . : mc
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Wireless LAN adapter Wireless Network Connection 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft Virtual WiFi Miniport Adapter
   Physical Address. . . . . . . . . : hidden
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Atheros AR5B93 Wireless Network Adapter
   Physical Address. . . . . . . . . : hidden
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::e9fc:cc7:322e:4c3e%11(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.1.2(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Tuesday, 14 February, 2012 11:09:45 AM
   Lease Expires . . . . . . . . . . : Wednesday, 15 February, 2012 11:10:46 AM
   Default Gateway . . . . . . . . . : 192.168.1.1
   DHCP Server . . . . . . . . . . . : 192.168.1.1
   DHCPv6 IAID . . . . . . . . . . . : 184555460
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-13-22-BD-89-70-5A-B6-41-2B-51

   DNS Servers . . . . . . . . . . . : 192.168.1.1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter Local Area Connection:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : hidden
   Description . . . . . . . . . . . : Broadcom NetLink (TM) Gigabit Ethernet
   Physical Address. . . . . . . . . : hidden
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.{E3E27219-19DB-443A-986D-9C4DBAE83E89}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter Teredo Tunneling Pseudo-Interface:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   IPv6 Address. . . . . . . . . . . : 2001:0:4137:9e76:30b6:3d4e:506e:9a2a(Pref
erred)
   Link-local IPv6 Address . . . . . : fe80::30b6:3d4e:506e:9a2a%15(Preferred)
   Default Gateway . . . . . . . . . : ::
   NetBIOS over Tcpip. . . . . . . . : Disabled

Tunnel adapter isatap.swinburne.edu.my:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.{3E168ECB-9D68-4F37-93EF-B6BE5D8AA658}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #3
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

C:\>tracert 192.168.1.1

Tracing route to 192.168.1.1 over a maximum of 30 hops

  1     2 ms     2 ms     2 ms  192.168.1.1

Trace complete.

C:\>tracert 192.168.1.9

Tracing route to 192.168.1.9 over a maximum of 30 hops

  1  mc [192.168.1.2]  reports: Destination host unreachable.

Trace complete.

C:\>route print
===========================================================================
Interface List
 14...06 17 c4 f0 ca 86 ......Microsoft Virtual WiFi Miniport Adapter
 11...00 17 c4 f0 ca 86 ......Atheros AR5B93 Wireless Network Adapter
 10...70 5a b6 41 2b 51 ......Broadcom NetLink (TM) Gigabit Ethernet
  1...........................Software Loopback Interface 1
 17...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
 15...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface
 18...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
 19...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.1.1      192.168.1.2     25
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      192.168.1.0    255.255.255.0         On-link       192.168.1.2    281
      192.168.1.2  255.255.255.255         On-link       192.168.1.2    281
    192.168.1.255  255.255.255.255         On-link       192.168.1.2    281
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link       192.168.1.2    281
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link       192.168.1.2    281
===========================================================================
Persistent Routes:
  None

IPv6 Route Table
===========================================================================
Active Routes:
 If Metric Network Destination      Gateway
 15     58 ::/0                     On-link
  1    306 ::1/128                  On-link
 15     58 2001::/32                On-link
 15    306 2001:0:4137:9e76:30b6:3d4e:506e:9a2a/128
                                    On-link
 11    281 fe80::/64                On-link
 15    306 fe80::/64                On-link
 15    306 fe80::30b6:3d4e:506e:9a2a/128
                                    On-link
 11    281 fe80::e9fc:cc7:322e:4c3e/128
                                    On-link
  1    306 ff00::/8                 On-link
 15    306 ff00::/8                 On-link
 11    281 ff00::/8                 On-link
===========================================================================
Persistent Routes:
  None

C:\>ping 192.168.1.1

Pinging 192.168.1.1 with 32 bytes of data:
Reply from 192.168.1.1: bytes=32 time=10ms TTL=64
Reply from 192.168.1.1: bytes=32 time=19ms TTL=64
Reply from 192.168.1.1: bytes=32 time=2ms TTL=64
Reply from 192.168.1.1: bytes=32 time=2ms TTL=64

Ping statistics for 192.168.1.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 2ms, Maximum = 19ms, Average = 8ms

C:\>ping 192.168.1.9

Pinging 192.168.1.9 with 32 bytes of data:
Reply from 192.168.1.2: Destination host unreachable.
Reply from 192.168.1.2: Destination host unreachable.
Reply from 192.168.1.2: Destination host unreachable.
Reply from 192.168.1.2: Destination host unreachable.

Ping statistics for 192.168.1.9:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

The green LED(P104) blinks slowly meaning that its IP address is ok...if i may ask what is the response u get after pinging from the wifly terminal your gate away or host PC because for me am not getting any response (what does this mean?).....

To cancel the effect of unknown commands that may affect the performance of the device i applied factory reset command. I then sent the necessary commands to connect to my network. After successful connection I used the following commands

<2.23> set wlan ssid habs
AOK
<2.23> set wlan join 1
AOK
<2.23> save
Storing in config
<2.23> reboot
*Reboot*WiFly Ver 2.23, 04-26-2011 on 131C11
MAC Addr=00:06:66:14:a7:c7
Auto-Assoc Alhabsy chan=1 mode=WEP SCAN OK
Joining Alhabsy now..
*READY*
Associated!
DHCP: Start
DHCP in 50ms, lease=86400s
IF=UP
DHCP=ON
IP=192.168.1.9:2000
NM=255.255.255.0
GW=192.168.1.1
Listen on 2000

I also tried to do firmware update over ftp but i am getting the following response....

<2.23> set ftp user roving
AOK
<2.23> set ftp pass Pass123
AOK
<2.23> set ftp filename wifly-GSX.img
AOK
<2.23> ftp upload
<2.23> FTP connecting to 208.109.78.34
FTP timeout=2

<2.23> ftp update
<2.23> FTP connecting to 208.109.78.34
FTP timeout=2

Since you do got a DHCP address, but then can't ping the gateway that the DHCP server gave the WiFly, I'd agree with sponder and guess that there's a network problem.

What kind of router do you have? Have you been able to use any other wireless devices with it ( laptop, smartphone, etc)?

Well, your laptop seems to be ok. (routing is correct etc.) Can you confirm this by pinging a smartphone or other laptop, which is on the same WLAN (and also got an IP address from the same DHCP server)? If this works without any problems, the problem must be the WiFly.
This is probably the case since the test the other way around also fails (letting the WiFly ping the gateway.)
I would first confirm it's not your laptop (by pinging another device) and if that's successfull, i would try a different another WLAN / router / network.
If your findings are the same on another network, i would contact Roving Networks support. You might have a defective unit.

I am using dlink router for my home network and I have other laptops n smartphones on the same network....so I tried pinging one of the PC's n smartphone but am getting da same result of "destination host unreachable"...The same thing happened when I pinged from one of the other PC's . am going to try on another network
Sponder..what kind of response do u get when u ping your gateaway from da wifly?....this might help to compare with mine....

Do you have the model number of the dlink router?

Its clear the problem hugely lies on my netw?ork since no device is appear to ping another...but wouldn't rule out defectiveness of the wifly since I her no response when I.ping da gate away?....can I get what kind of response to expect when you do so from the wifly serial terminal?.....

I don't have the unit at hand right now, but tried to test is like a week ago, i remember the response was a reply as you would expect.
Being unable to ping other devices on the network is a huge hint though! Try another router, see if you can ping across the network (from laptop to laptop to smartphone etc.) if that works you can bet your WiFly will start responding to ping / telnet / FTP as well.

edit: i did a quick google on DLINK routers and not being able to ping anything besides the router: read 4 stories, all four of them got solved by disabling the windows firewall. Can you check please turn off the firewall on both laptops and try pinging each other?

I am using Dlink router DSL-2640B....I guess its something to do with the router blocking the computers from pinging each other since turning off windows firewall hasn't solved the problem....

I remember reading several users using their WiFly in an adhoc connection with their laptops. Perhaps you could try that to confirm it's your router (before spending money on a new one)

Wishing i had more time to spend on this, i'm slowly getting somewhere.
Right now i have a sketch where the arduino puts the WiFly in command mode, sends the command to get the IP address, and puts the serial data received on a lcd.
The sketch works, but, the output (also via serial / telnet) contains:

<2.30>get ip a
get ip a

10.0.0.7

thus, the output doesn't only contain the IP address, but also the string we send, a few newline chars, and then the IP address.
The good news is that i can see the string, including a part of the IP address (the lcd isn't big enough to show the complete string of chars lol.)
Once i find the time to read up on parsing incoming serial data, (im sure there are plenty of examples online?..) i can try to parse the data to show only the IP address.
Would you be interested in testing / trying / reviewing / commenting on that code?

I did a google search for your router model and it seems that there are a number of hits for the same problem: Google: DSL-2640B unable to ping

I started reading through them but haven't found any solutions yet. Maybe you'd have better luck.

Hi guys...yah as u said the problem is my router not allowing devices to ping each other so i tried to change its configuration and it seems it doesn't support such protocol (icmp)...so i decided to use adhoc mode for the time being before i get hold of another advanced router..thanks guys for the help...let u know how i progress...

Sponder...did da function that u said u gonna use to read from the wifly work correctly i.e readFromWifly()...what do u want to display on the lcd...the commands and the response or the response alone?...if the characters are too long for the lcd you can make them to scroll left to right..(i believe there is such a function in the lcd library) or write a function to scroll up (worked 4 me)....

Well, like i said, i have trouble using any WiFly library. But as DHunt pointed out to me, you can also simply write all the commands to the WiFly module through the serial link.
I would like to display just the IP address on the lcd, but like i said in my previous post, the output of the get ip command is "get ip \n \n \n" instead of just the ip.
but hey, at least i can see some output, so it's just a matter of parsing the output before displaying it to the lcd. (right now everything in the serial buffer is shown on the lcd)
I hope to find some hours here and there upcomming weekend, so i can read up on parsing serial data on the arduino. (But since it's carnaval over here i dont think i can find those hours..)
I want the parsing out of the way before i'm even going to try to connect to a server, since once connected to a server i would like to let the server send a command, which in turn gets parsed (and executed) on the arduino.

did you allready connect your unit with a adhoc connection? Where you able to ping /telenet / FTP with it?

Yah with the adhoc mode i was able to ping and telnet successfully....but will be getting another router soon because am looking to send commands to arduino from quite a long range....

Yah me too am planning to do the same but first i tried to see if the app can be able to send the commands to the arduino but am getting unknownHostException.(Thrown to indicate that the IP address of a host could not be determined.) which is weird since i was able to ping and telnet the host(wifly)..Are you familiar with java?...maybe you can help. I am also looking for opinions in other forums and am also rechecking my code.

Thanks.

As soon as you solve one problem you run into another..thats the order of the day when dealing electronics...

I was able to ping and telnet successfully but the app couldnt communicate with the wifly shield...i am just running the terminal sketch that allows commands to be sent through the terminal...To implement server/client communication aren't we supposed to upload some kind of server/client sketch to the wifly?....I think my problem could be the wifly not accepting the connection in the first place from the app....hence the app throws unknownHost Exception....am i right?..

On the app i have this line of code and it seems it cannot get past the first of these two lines below...The output of the second line is never shown as the connection to the host i.e wifly shield is never made... I declared the host name as "WiFly-GSX" ( default device id of wifly) and port as 2000. I changed the port number but still same result.

Socket clientSocket = new Socket(host, port);
System.out.println("Connected to " + host + " in port " + port);