WiFi Module And BS2

I am following the tutorial that teaches how to turn on leds from a web page. That's fine and it works with the web page loaded in the wifi module which is connected to my LAN.
What i'm not getting is how to access that page from the internet at some remote location.
Any help?
Jack3585

Comments

  • 10 Comments sorted by Date Added Votes
  • edited February 21 Vote Up0Vote Down
    I was hoping to have an example posted before the first person asked. Looks like I lost the race, but now that you've asked, challenge accepted!

    [edit] Sorry, I didn't notice the BS2 in the title, so most of this (below) is Propeller-centric. At any rate, I'll try a test on my home router and report the steps.[/edit]

    In the meantime, there are some examples in ...\parallax-esp-2016-11-02-1804-x\Examples\Propeller C that make the Wi-Fi module get information and send updates through various services.

    - IFTTT Send Email.side
    - Temperature from OpenWeatherMap.side
    - Text from www page with TCP.side

    Tutorials for these are in the queue, but not posted yet.
  • P.S.

    The OpenWeatherMap app is pretty straightforward, just subscribe to a free account, and use the info they give you in the program.

    If-This-Then-That takes a little work to figure out how to set up their events after setting up the account. Here are the details of the Maker Event I created to make IFTTT Send Email.side work:

    If Maker Event "MicrocontrollerEvent", then send an email from SomeTempAddressYouCreated@gmail.com

    Receive a web request
    This trigger fires every time the Maker service receives a web request to notify it of an event. For information on triggering events, go to your Maker service settings and then the listed URL (web) or tap your username (mobile)

    Event Name
    The name of the event, like "button_pressed" or "front_door_opened"

    Send an email
    This Action will send an email to up to five recipients from your Gmail account.

    To address
    SomeTempAddressYouCreated@gmail.com

    Subject
    The event named "MicrocontrollerEvent" occurred on the Maker service

    Body (optional)
    What: {{EventName}}<br>
    When: {{OccurredAt}}<br>
    Extra Data: {{Value1}}, {{Value2}}, {{Value3}},
  • edited February 21 Vote Up0Vote Down
    ...
  • Alright, I just finished Step 1, checking with our IT on an approach that has the best chance of working with the way the Wi-Fi module serves pages. From what I've gathered, many wireless routers can be configured to do network address translation (NAT) from outside world to inside network, and also to consistently assign the same IP address to the Wi-Fi module by setting up a DHCP reservation based on its MAC address (which is also listed on the Wi-Fi module's Networks configuration page). I'll test this on my home router and report back either tomorrow or Friday.
  • Thanks everyone for the help.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    From what I've gathered, many wireless routers can be configured to do network address translation (NAT) from outside world to inside network, and also to consistently assign the same IP address to the Wi-Fi module by setting up a DHCP reservation based on its MAC address (which is also listed on the Wi-Fi module's Networks configuration page). I'll test this on my home router and report back either tomorrow or Friday.

    Many of the routers I have worked with require a static IP address in order to use Port Forwarding properly.
    Chris Savage | Engineering Tech | Main Office: (916) 624-8333 | Direct to Tech Support: (888) 997-8267 | Website | Twitter | Google+
  • Just don't try to forward port 80 on a non-commercial ISP account. If your project is on a LAN, say 192.168.1.100 and it is listening on port 80. In the router you forward a higher port, say 12000 TCP to your 192.168.1.100 port 80.

    You'll have DHCP issues on the LAN and WAN. For the LAN, use the reservation, or set a static IP on the device. For the WAN, you can get something like this - http://www.noip.com/free

    What router are you using?
  • Ah, good, thanks for the tip xanadu! I'm using the router that AT&T installed at my house, and I see on its labeling that there's an address I can go to to access its settings pages. Let's say that the Wi-Fi module is a station on that home router's network and can serve http://192.168.1.100/files/val-from-micro.html to other devices on the network. Let's also say that forwarding and a reservation have been set up and I have gone to whatsmyip.org and found that my router's ip facing the outside world is 123.456.789.123. If I'm elsewhere on the internet, would I access that page with http://123.456.789.123:12000/files/val-from-micro.html?
  • That should do it. Here are some other notes;

    If you're troubleshooting using ping, you may or may not be able to ping your router from afar. There's usually a setting called "allow ICMP echo" that needs to be enabled for ping to work.

    The firewall is going to block LAN traffic from the WAN. If you're on your LAN, be sure to use the LAN IP (and port 80), not the WAN IP (and port 12000) or the NoIP hostname, as they will not be reachable from your LAN (with most routers).
  • edited February 25 Vote Up0Vote Down
    Alright, I verified that it works. Hoorrraaayyyy!!!

    Start by making sure you can access an application web page with your BS2 and Wi-Fi module joined to your home router's network using these pages:

    - Test the BS2 to Webpage Connection
    - Join Another Wi-Fi Network

    Make sure that you can go to the ip address that your wireless router assigned your Wi-Fi module. For example, if it assigned your Wi-Fi module 192.168.1.100, make sure that http://192.168.1.100/files/val-from-micro.html works.

    Next is the tricky part since the approach will vary with Wi-Fi router. For example, if you have a DLINK DIR-625 or ATT UVerse router, instructions on this page (starting at "Setting up the router for port forwarding") are helpful.

    http://internetofhomethings.com/homethings/?p=490

    Those two examples might either be enough to tweak the settings on your router, or at least provide search nomenclature for a similar example that uses your router. I followed the AT&T NGV-589 instructions on the page. Even though I have a different model, the the overall link path was similar. I used 12000 to 12000 as the port range and mapped it to port 80 on the connection to my Wi-Fi module.

    After that, I went to http://www.whatsmyip.org/ to find my router's address (though it's also accessible while you are in the router's configuration pages). For this example, I'll use 123.456.789.123.

    Then, I used my phone (disconnected from the network) to go to http://123.456.789.123:12000/files/val-from-micro. The page came up, and I clicked the button repeatedly and got new values from my BS2. Fun!
Sign In or Register to comment.