0

I want to send an HTTP command to MKR1000 from outside my local network.

So far, all the googled resources point to getting the local IP (example 192.168.0.10) of MKR1000 and sending a command like http://192.168.0.10/H to it and then parse it.

How do I send a command to MKR1000 from outside its local network?

I should clarify that I want this to be a consumer product and can't have the end-user fiddling with their routers for port forwarding etc.

8
  • 1
    Google "port forwarding" along with the make and model of your router.
    – Majenko
    Commented Sep 24, 2016 at 10:15
  • I want it to be a consumer product and don't want every end user to be fiddling with their router. Edited my question accordingly.
    – Kashif
    Commented Sep 24, 2016 at 10:15
  • 1
    Well you can't. Simple fact: devices on an internal network, regardless of how you may wish it, are not accessible from outside. Only the user can configure their router to forward access to it.
    – Majenko
    Commented Sep 24, 2016 at 10:17
  • But a lot of consumer IOT products (e.g. NEST) are controlled from your mobile device from anywhere?
    – Kashif
    Commented Sep 24, 2016 at 10:18
  • 2
    No they aren't. An external service is controlled from your device, and the IoT device queries that same external service.
    – Majenko
    Commented Sep 24, 2016 at 10:19

2 Answers 2

3

The only way I can think of to achieve this would be to port forward your router, and forward port 80 (http) to your MKR1000. You can check out https://portforward.com/ for instructions on that.

If you don't want to port-forward, you'd have to have the MKR1000 connect to a centralized IOT server somewhere, and have the user go through the server to access the MKR1000. That's how other iot devices such as nest cameras do it.

2

You now can try this UPnP_Generic library to do the auto-portforwarding for you without manually touching the router.



Many of us are manually port-forwarding in Internet Gateway Device (IGD, Router) in order to provide access to local Web Services from the Internet.

This library provides the easier way to automatically port-forward by using the Simple Service Discovery Protocol (SSDP), running on nRF52, SAMD21/SAMD51, STM32F/L/H/G/WB/MP1, Teensy, ESP8266/ESP32, using ESP WiFi, WiFiNINA, Ethernet W5x00, ESP8266/ESP32 AT-command WiFi supporting UDP Multicast.

The SSDP provides a mechanism whereby network clients, with little or no static configuration, can discover network services. SSDP accomplishes this by providing for multicast discovery support as well as server based notification and discovery routing.

The SSDP is used for advertisement and discovery of network services and presence information. It accomplishes the task without assistance of server-based configuration mechanisms, such as Dynamic Host Configuration Protocol (DHCP) or Domain Name System (DNS), and without special static configuration of a network host. SSDP is the basis of the discovery protocol of Universal Plug and Play (UPnP) and is intended for use in residential or small office environments.

This UPnP_Generic library is created to automatically update your IGDs with the requested port-forward information, using one of the many available boards / shields. See Currently Supported Boards.

The time between checks to update the UPnP Port Mappings is configurable to match your use case, and is set in the examples at 10 minutes. The LEASE_DURATION is also configurable and default to 10hrs (36000s). The Virtual Server Name can also be specified in the sketch and is shown in the IGD, e.g. NRF52-W5X00 or ESP8266-WIFI as in the following picture:

The UPnP_Generic code is very short, can be immersed in your Projects and to be called in the loop() code.

Your Answer

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

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