1

Currently, I am using a Bluetooth shield, HC-05, which is working perfectly but there are two problems:

  • Only one person can connect to Bluetooth at a time.
  • I have to be in a specific place to be able to control the lights.

I want to be able to control everything from anywhere in the world. I've thought about using an Ethernet Shield, but I'd prefer using a Wifi Shield if it can do the task.

1
  • 1
    Yes, but realistically only with the help of a well-engineered and maintained intermediate server on the publically visible Internet - drilling holes in your firewall to expose an esp8266 to incomming connection is a bit dicey even if you work around your ISP's likely attempts to prevent it, so you are better off having both the ESP8266 and the controllers be clients which make outgoing connections to a real server which passes messages between them. Apr 30, 2016 at 1:22

4 Answers 4

3

answer on your comment on Majenko's answer: (cannot comment due to reputation)

  • build a simple web server on your device and make sure it is accessible from a local network node (e.g. a PC).To do this open from a web browser the page ip:port where ip is the ip assigned to arduino (usually from your router's DHCP service) and port is the port which your web server listens to. This is configured in your arduino code. For an arduino Wifi shield you can find a tutorial for this step here
  • Now you have to set up port forwarding. This means that when somebody from the internet sends a request on your router, the router will forward this request on your arduino and not on another node on your local network. The nodes on your local network are individually recognized by their IP address. Port forwarding is configured per port, so you must set up port forwarding from a specific in-port to a specific ip,local-port combination. For example if your arduino has been assigned ip 192.168.2.10 and your web server listens on port 80, you can forward all requests from port 8080 to 192.168.2.10:80. This means that every request comes from the internet on port 8080 on your router (internet side) will be forwarded on your local node on ip 192.168.2.10 and port 80. Note that for simplicity in-port and out-port can be the same and they usually are. Port forwarding is configured in your router's menu and the exact procedure is different for every modem. Your best bet is to search google for your modem's model + port forwarding. If you succesfully configure this, then you will be able to load web server's page from a node outside your local network by visiting ip:port where ip is your router's internet ip and port is the aforementioned in-port. A simple page to see your internet ip is this.

These are basically the main steps to have access from internet. Further improvements could be:

  • solving dynamic IP issue (in order to access your arduino, you have to know your router's internet ip which can change by your ISP anytime. Buying a static IP or setting up a dynamic DNS solves this issue)

  • turning your web server to non web server (more advanced topic).

1

The WiFi shield connects your Arduino to your local network. What you then do with that network is entirely up to you.

Yes, it is possible.

Is it easy, though? Well, if you have to ask the question then for you it won't be easy. You have to know how networks work for a start. Routing, port forwarding, client-server models, etc.

1
  • Can you put me in the right direction? Apr 29, 2016 at 15:59
1

It is definitely possible to control anywhere from the World where internet is available.

As @forivaras noted, there are a few accidental complexities involved in the network setup. It is nothing specific to Arduino, these come from the fact how Internet works nowadays.

For start, I suggest using an ESP8266 module (instead of any other solution), which is connecting to a readily available 3rd party server (such as dweet.io and visualize with freeboard.io, or Adafruit IO, or IFTTT).

In fact, you don't need the Arduino at all. The ESP8266 is a way more powerful than an Arduino, and yuu can program it as if it would be an Arduino plus Wifi.

So the hardware comes for less than $10, and you can find ready made howtos on the web such as: https://learn.adafruit.com/home-automation-in-the-cloud-with-the-esp8266-and-adafruit-io/introduction

This ensures a smooth start! Have fun :)

1

If you haven't already, take a look at Blynk.cc's website. Blynk provides a (drag-and-drop configurable!) smartphone/tablet app and a number of skeleton programs for many platforms and interfaces including, of course, the Arduinos.

In brief, your Arduino program can report data to their server, and the smartphone app can read and display that, as well as send control signals back to your board. They make it simple to accomplish basic things and quite easy to expand it to do more. The ESP8266 is a good choice for a web interface, especially if you're using an Arduino Uno or other Atmega328p-based platform, because it takes about the least amount of the MCU's limited resources of any of the compatible network interfaces.

Because your Arduino program will be configured as a network client you will avoid the hassles and potential security issues of configuring your local network to allow access to internal server from outside. The Arduino sketch opens an outboud connection to their server, just as a web-browser would, so you won't need to "poke holes" in your router's firewall to let in your client and anyone else that wants to mess with your stuff.

(Note: I have no connection with them, but I think they have a strong platform for Internet of Things hobbyists and I use their stuff.)

Update: Blynk supports Arduino WiFi, WiFi 101, CC3000, and ESP8266 w/original (AT) firmware. This device (Atmega328p with ESP8266) is logging temperatures from 3 DS18b20 thermo sensors to Blynk as I type this:

enter image description here

1
  • I have actually heard of Blynk. But I don't think they support wifi shield yet. Apr 30, 2016 at 20:15

Your Answer

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

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