Shop OBEX P1 Docs P2 Docs Learn Events
Making the XBee WiFi module accessible via the internet — Parallax Forums

Making the XBee WiFi module accessible via the internet

MJHanaganMJHanagan Posts: 189
edited 2015-06-23 09:32 in Accessories
I got an XBee WiFi module the other day and managed to get it configured on my home WiFi network. Using techBASIC installed on my iPhone I successfully connected to the XBee WiFi module and can send serial data back and forth with relative ease. The XBee module is wired to a Propeller Activity Board so I can turn LEDs on and off using a simple app on my iPhone.

The next feat I wish to accomplish is to do the same type of serial data communication with the XBee when I am not home (i.e. not connected to my home WiFi). As you might have guessed this is the beginnings of some home automation with remote capabilities.

It seems from this link (http://www.savagecircuits.com/content.php?201-XBee-Wi-Fi-via-WAN-IP) that this can be done. However, I am in no way internet savvy and so starting from the lowest of levels. From what I have been able to piece together I need to do something called "port forwarding" on my home router in order to expose the XBee to the internet. My home internet service is Verizon FIOS. To complicate things a bit more I have an Apple Time Capsule hard wire connected to the FIOS router. The XBee and my iPhone connect to the Time Capsule's WiFi and not the FIOS WiFi. So I am guessing I need to do some type of port forwarding on the FIOS router to expose the Time Capsule and then port forward on the Time Capsule to the XBee. Does this sound right? Can someone point me in the right direction of how to get my XBee exposed to the internet?

Assuming my XBee is now "open" to the internet can I expect to use the same techBASIC openTCPIP( filenum, IPaddr, port, ) routine to establish a TCP link with the XBee via the WWW? This sounds a little too easy to be true, but would be great if it were! Are there any step-by-step instructions on how to communicate with an XBee WiFi module via the internet?

By the way, for those just learning the basics of these XBee WiFi modules you should ave a look at this Savage Circuit video of using the XCTU to configure the S6B modules: http://www.savagecircuits.com/content.php?219-Short-Circuits-3-XBee-Wi-Fi-Setup-for-Existing-Wireless-Networks Chris did a really nice job of explaining some of the basics of these nifty devices. Thank you, thank you, thank you!!

Comments

  • NWCCTVNWCCTV Posts: 3,629
    edited 2015-05-01 17:14
    I can help you out on the Port Forwarding issue. You should not have to do anything to the Apple device. You will need to know either the IP address or the MAC address of the XBEE device. Open your FIOS router and go to the Advanced settings. You should then be able forward whichever Port that needs forwarding in there. If you do not know how to access the Router, post the actual make and model number and I will get tat info for you.In order for it to be accessible via the Internet you will either need a Static IP address or a free DDNS service such as Free DNS. To answer you last question about using the same info to establish a link,NO. You will need to use the Static IP address and if the Port used is anything other than 80 on HTTP or 443 on HTTPS you will need the port number after the IP address.
  • xanaduxanadu Posts: 3,347
    edited 2015-05-01 17:46
    You can also check the airport utility and on the network tab see how the Time Capsule is configured. There is a router mode, bridged would be preferred for this.
  • MJHanaganMJHanagan Posts: 189
    edited 2015-05-04 05:00
    Thank you for the input on the port forwarding. I got sidetracked this weekend with the nice spring New England weather so did not get a chance to fiddle with my FIOS router. I will give it a try during the week and report back.
  • MJHanaganMJHanagan Posts: 189
    edited 2015-05-05 17:44
    NWCCTV wrote: »
    I can help you out on the Port Forwarding issue. You should not have to do anything to the Apple device. You will need to know either the IP address or the MAC address of the XBEE device. Open your FIOS router and go to the Advanced settings. You should then be able forward whichever Port that needs forwarding in there. If you do not know how to access the Router, post the actual make and model number and I will get tat info for you.In order for it to be accessible via the Internet you will either need a Static IP address or a free DDNS service such as Free DNS. To answer you last question about using the same info to establish a link,NO. You will need to use the Static IP address and if the Port used is anything other than 80 on HTTP or 443 on HTTPS you will need the port number after the IP address.

    I took a stab at the port forwarding on my FIOS router without success. I have an Actiontec MI424WR Rev I router. My S6B has a static IP address of 10.0.1.38 and uses port 9720 (hex 2000). Here are the networking and address setting on the module:

    Address settings:
    XBee WiFi Address Settings.JPG
    Network settings:
    XBee WiFi Network Settings.JPG


    And here is how I attempted the port forwarding:

    Port Forwarding.jpg


    It seems to have been accepted by the router:

    Port Forwarding 2.jpg


    I can use my WIFI TCP Test Tool on my iPhone to connect to the module using an IP address of 10.0.1.38 and port 9750. Using the XCTU tool I can send data to my iPhone app and receive data sent by the iPhone.

    I then got my router's IP address using whatismyip.com. I disconnected my iPhone from my WiFi network and used the cell phone connection. I then replaced the 10.0.1.38 address with the router's IP address and used the same 9750 port but unfortunately I could not connect to the XBee module using my iPhone.

    Any thoughts as to where I went wrong with the port forwarding?
    999 x 799 - 50K
    999 x 799 - 140K
    647 x 464 - 55K
    648 x 398 - 52K
  • xanaduxanadu Posts: 3,347
    edited 2015-05-05 21:46
    Did you check to see if the time capsule was bridged?

    Also you mentioned port 9720 and 9750, looks like you have 9750 configured in the router.

    You could have a blocked port too, don't rule out the ISP, use another way to test it.
  • MJHanaganMJHanagan Posts: 189
    edited 2015-05-11 13:51
    xanadu wrote: »
    Did you check to see if the time capsule was bridged?

    Also you mentioned port 9720 and 9750, looks like you have 9750 configured in the router.

    You could have a blocked port too, don't rule out the ISP, use another way to test it.

    I checked the Time Capsule and it was set for "DHCP and NAT" so I changed it to "Off (Bridge Mode)". After making that change my S6B fell off the network (two short blinks followed by an off). I tried refreshing the connection using XCTU and reentering the WiFi passphrase but that did not help. I then ran the "Active Scan" on the XCTU software and according to XCTU successfully reconnected to the WiFi network, but the blue LED on the USB board for the XBee S6B still indicates no network connection.

    I then changed the Time Capsule back to the "DHCP and NAT" mode and was able to reestablish the WiFi connection.

    Is there some other setting I need to change on the S6B module to get it to connect when the Time Capsule is in the "Off (Bridge Mode)"?
  • MJHanaganMJHanagan Posts: 189
    edited 2015-05-11 19:18
    I did a bit more fiddling this evening and got the XBee WiFi module back on the wireless network with the Time Capsule in the Bridge Mode. Below are the settings as configured by the XCTU. I started the configuration in the XCTU by resetting the module to its factory settings. I then used the "Active Scan" to identify the WiFi networks in the area where I picked the network setup in the Apple Time Capsule. The XCTU got it connected to the WiFi network as indicated by the steady blinking blue LED on the USB board (Parallax 32400 Rev C). However, this was configured with MA (IP Addressing Mode) set to DHCP not Static. Previously I had used Static mode with an IP address of 10.0.1.38 where now it is using 192.168.1.17 and the same port of 9750 (hexidecimal 2626). I then tried to change the MA setting back to Static but when I did I could not get the XBee back on the WiFi. I changed it back to DHCP and it came back.

    I can use my TCP tool on my iPhone to connect and converse with the XBee S6B and my techBASIC code can also communicate with the device once again. However I still cannot connect to it via the internet (i.e. my iPhone WiFi turned off). So, I have the Time Caplsule in the Bridge Mode but still unable to connect via the outside internet connection. Do I need to go back to Static IP addressing?


    XBee WiFi S6B module configuration settings:
    XBee WiFi Address Settings V2a.JPG
    XBee WiFi Address Settings V2b.JPG
  • xanaduxanadu Posts: 3,347
    edited 2015-05-11 20:35
    Nice job, sounds like you're one step away.

    When the Time Capsule was in NAT mode it created a 10.0.1.0 network while your router's NAT created a 192.168.1.0 network. When you bridged the TC the XBee couldn't communicate with the old settings on the new network. Essentially the TC is now a wireless access point and no longer a router of its own. It will use the 192.168.1.0 network's router for services like DHCP.

    Usually when something works on the LAN but not via the internet it could have an invalid gateway specified. The gateway is your router's LAN IP.

    It could also be a port forwarding issue, those range from mismatched settings to ISP blocking.

    Be sure to reboot your router if you haven't.
  • MJHanaganMJHanagan Posts: 189
    edited 2015-05-12 04:51
    xanadu wrote: »
    Nice job, sounds like you're one step away.

    When the Time Capsule was in NAT mode it created a 10.0.1.0 network while your router's NAT created a 192.168.1.0 network. When you bridged the TC the XBee couldn't communicate with the old settings on the new network. Essentially the TC is now a wireless access point and no longer a router of its own. It will use the 192.168.1.0 network's router for services like DHCP.

    Usually when something works on the LAN but not via the internet it could have an invalid gateway specified. The gateway is your router's LAN IP.

    It could also be a port forwarding issue, those range from mismatched settings to ISP blocking.

    Be sure to reboot your router if you haven't.

    Sigh, this is complicated stuff, I just went two steps back!

    I checked my TC's WiFi speed this morning and found it was in the 20-25 Mbps range. Previously, when the TC was setup as its own router (DHCP and NAT mode) I was routinely getting 50+ Mbps download and upload speeds. When I am connected to the FIOS router's WiFi I generally get speeds in the 25-30 Mbps range. So in the fog of morning I decided to reconfigure the TC back to being its own router and in doing so broke it (lesson learned: don't fiddle with network settings while you are trying to make coffee and get out the door to work). Looks like a hard reset and full reconfiguration for the TC when I get home.

    However, in my fiddling around yesterday I seem to recall at one point having configuring the XBee S6B module to be connected to the FIOS router's WiFi network AND was able to connect to it using the TCP tool on my iPhone when the iPhone was connected to the TC's WiFi. So if my recollection is correct and my iPhone can see/connect with the Xbee S6B when connected to the FIOS WiFI while the iPhone is connected to the TC's WiFi network then I would much prefer that setup. This gets me back to a much faster WiFi network which is handy when the kids are each hogging bandwidth watching Netflix. This may also make it easier to port forward if the XBee is on the FIOS router's WiFi.

    So I am going to try reconfiguring the whole thing this evening with the new found knowledge.
  • mindrobotsmindrobots Posts: 6,506
    edited 2015-05-12 11:38
    For what it is worth:

    I have a Time Warner cable modem that presents me with an IP address. It has no routing services and no WiFi. Behind it are a pair of Time Capsules that provide the WiFi in my house and all routing within my 10.x.y.z home network.

    TC#1 is set to "DHCP and NAT" in it's Network tab and is directly connected to the TW Modem. It is the boss of my internal network and acts as a gateway to the TW network (174.100.80.x).
    TC#2 is set to "Off (Bridge Mode)" in it's Network tab. It has a WiFi connection (used to be Ethernet) to TC#1 and is just a WiFi extender and Ethernet AP at the other end of the house plus TC and storage functions, of course.

    The house is one big happy, private Ethernet and WiFi network.

    To expose one of my internal IP addresses to the Internet, I go to TC#1, and on the Network tab, there is a section called Port Settings. From there I can hit the "+" to add an item and then fill out the dialog presented. Name, public port, private IP, private port, etc. and save it. Once I reboot my TC, it will be exposed.

    Your situation will be different, since you have a FIOS router sitting in the middle with its own network. Plus Verizon may be blocking traffic. I Haven't been blocked on anything by Time Warner yet.
  • MJHanaganMJHanagan Posts: 189
    edited 2015-05-13 08:10
    I really mucked up my LAN yesterday before somehow finding my way back to where I started (or so it seems). I put the TC back to its original DHCP and NAT mode and simply selected the option in the Airport utility on my Mac to ignore the double NAT problem. The TC's status indicator went to green and I'm back to 55-60 Mbps upload and download speeds when connected to its WiFi. The Actiontec's WiFi speed is still in the 35-40 Mbps range. I am surprised by the difference in WiFI speed but it has been consistently different since we switched to FIOS in July 2014. From what little I read online the TC is apparently one of the faster WiFi modems on the market yet the Actiontec datasheet also claims high WiFi speeds. I can only conclude from this that when the TC is in the "DHCP and NAT" mode it is somehow bypassing the Verizon imposed speed limit. Does this make any sense? Seems odd that there would such an easy workaround to a speed limit.

    Tonight's goal to to get the XBee S6B back on the WiFi.
  • xanaduxanadu Posts: 3,347
    edited 2015-05-13 19:07
    It sounds like you might be better off bridging your cable modem/router and using TC #1 as the only router. Think you can do that?

    The wifi issue half the speed is probably not dual band, hard to say though. The XBee doesn't care about bandwidth as much as it does latency.

    What you wrote makes sense, not sure if you should exploit it or not but if you were to call tech support and ask they help you bridge your current FiOS router I don't see how you could be doing anything wrong regardless of what speed you pay for. Wifi isn't a good judge of ISP speed though, it's better to use a wired test to measure your ISP. Wireless can be crippled by all kinds of other factors. Especially if you have two in the same space and they are on the same channel.

    So far it sounds like bridge the FiOS router and disable it's WiFi and use TC #1 as your router and access point for the best results.
  • MJHanaganMJHanagan Posts: 189
    edited 2015-05-14 11:04
    xanadu wrote: »
    It sounds like you might be better off bridging your cable modem/router and using TC #1 as the only router. Think you can do that?

    The wifi issue half the speed is probably not dual band, hard to say though. The XBee doesn't care about bandwidth as much as it does latency.

    What you wrote makes sense, not sure if you should exploit it or not but if you were to call tech support and ask they help you bridge your current FiOS router I don't see how you could be doing anything wrong regardless of what speed you pay for. Wifi isn't a good judge of ISP speed though, it's better to use a wired test to measure your ISP. Wireless can be crippled by all kinds of other factors. Especially if you have two in the same space and they are on the same channel.

    So far it sounds like bridge the FiOS router and disable it's WiFi and use TC #1 as your router and access point for the best results.

    Yes, I have been reading up on if/how the Actiontec could be retired in favor of the TC. I saw a few posts on the Apple Discussion board that says this can be done. I currently have a coaxial cable supplying the WAN connection to the Actiontec so this would need to be replaced by an Ethernet cable (something that Verizon apparently needs to come out to do). My only fear is that in doing so is Verizon somehow imposes a speed limit much like the 30-40 Mbps I get using the Actiontec's WiFi and when my work laptop is hard wired to one of the its LAN ports. If I instead connect the laptop via the TC's WiFi I get speeds in the 50-60 Mbps. I use the OOKLA website on the computers and their app on my iPhone to test the connection speeds. I can't explain the speed duality since the TC is fed from the Actiontec. The speed really tanks when I have to connect to the company's VPN, it drops to 8-10 Mbps since the traffic now needs to be routed to and from the VPN server in MN.

    Retiring the Actiontec and using only the TC would likely simplify things on my end as I would have just one router that seems to be fast and easy to configure. Then maybe I could get back to playing with the toys rather than wrestling with the network beast. Probably worth a call to Verizon to what it would take.
  • mindrobotsmindrobots Posts: 6,506
    edited 2015-05-14 12:36
    Do you have access to log into your Actiontec? If so, I imagine you could shut down it's WiFi and essentially turn it into a FIOS MODEM like my connection to Time Warner is a Cable MODEM. Once you do this, you should be able to use it as a gateway to the Internet for your TC managed Ethernet and WiFi network. The TC then handles DHCP management, traffic passing within your private network and anything it can't reach, it just passes out to the gateway to be routed by Verizon.
  • TumblerTumbler Posts: 323
    edited 2015-06-23 09:32
    I think i was the topic starter at S///C

    Yes, it could work, if you use correct network settings.

    The only things you need is your wan-ip (whatsmyip.com) , your local ip (network) and port settings.
    and uses port 9720 (hex 2000).
    <= what calculator you are using???

    Xbee needs Hex port values, router needs decimal values

    You can ask Chris if he had a backup for that thread.

    And you want to connect your xbee while you are not on your home network: take a look here: http://www.noip.com/
  • Hello sir,

    i'm working on XBEES6B module but i'm not able connect XBEE S6B with wifi router . can u send please arduino program and xctu connection
  • Hello gau,

    Welcome to the Parallax forums!


    We can help you here with code for Parallax microprocessors (Basic Stamp, Propeller).

    Do you have one of those you'd like code help with?


    You can find examples here: http://learn.parallax.com/tutorials/language/spin/propeller-board-education-project-builders/wireless-xbee-communication-0

Sign In or Register to comment.