Tutorial advanced 1:


Web Server: control a Switch




Content of the tutorial:


- What is a Web Server.

- How to configure a Web Server.



Introduction


Dear User, this is the first of a serie of tutorials where we will learn about how to configure and use the Web Server functionality of your controller, so that you can execute actions on your devices usign a web browser that is installed on your remote PC, Tablet or Mobile

In other words here we will start seeing how to control your devices while you are both inside and outside of your home.

In this example, that you can as usual find in the examples drop down list placed in Devise Home page, we will learn how switch on/off two devices connected to your controller, using your web browser instead of a push button.



Top



What is a Web Server


A Web Server is a service that allows your browser, once connected, to display a web page. Inside the web page you can generally find text, pictures, videos, virtual buttons and so on. The page of this tutorial is, for instance, an example of web page.

In Devise Home a web page is a page that shows text, values, input fields, buttons, sliders and maybe other controls useful to give your devices the right commands. This page is generated by the Web Server everytime you connct to or reload it in your browser. So it will always display updated values read from your sensors and from everything you want to take under control.

In this tutorial will show how to give commands to switch on/off two devices, so the web page will display a couple of buttons only. Next tutorial will show how to read values from sensors.

Ok, let's go inside the example that is the better way to understand how to use a Web Server on your project and discover how it is simple.


Top



How to configure a Web Server


A web server is compose of more objects:

- the Web server itself (red arrow in the picture below);
- some set objects needed to give some commands (green arrow in the picture below);
- some get objects needed to get the value of something (not present in this example);

Furthermore it needs of an Ethernet interface (Ethernet Shield, blue arrow in the picture below) that is basically a device useful to connect your controller to your internet router. Yes, of course you need of an internet connection as well!

In this example your controller is connected to your router through an Ethernet cable. In future I will explain how to connect it using a Wi-Fi connection.



Let's now understand the meaning of all those objects:


Top

1. The Web Server object

When you want to implement in your system the web connectivity, the Web Server object is needed to tell Devise Home tool to implement a Web Server service. However Web Server object is an empty container only. In other words, once a Web Server has been added to your project, nobody has told him what devices should be controlled by the Web Server.

So we need to fill up him with the right info about the devices we want to control.

But how can we do that?

Well, we can do it by adding to the server some "Set" and "Get" objects.


Top

2. The Set object

The Set objects is the virtual controller (button or similar) that will be shown on your browser, and is needed to set the status (i.e. on or off) of the "linked to him" device.

So, every time you want to remotely control a device, a Set (or Get) object should be present in the project.

However you don't need to add it manually! In fact, to make it easier, when you add a Web Server to your project, a Set object will be automatically placed for each of controllable devices already present.
Also when you add a new controllable device, a new Set object will be automatically added if a web server is already present in the project.
In this way you cannot forget to add any Set (and Get as well) object.

If you don't want a specific Set object, because you do not intend to control a particular device from your browser, simply press the right button of your mouse on it and remove it.



For more details of how configure Web Server objects please refer to Web Server section in Devise Home User Manual.


Top

4. The Ethernet object

The last device to configure is the Ethernet interface.

The purpose of the Ethernet interface is to provide your control system the connectibity toward your internet access. It is composed by a shield, that is a small board that can be plugged over the main Arduino board, and a Ethernet cable.



The Web Server always needs of an Ethernet interface, so when a new Web Server is added to the project, a check if an Ethernet device is already attached to the same controller is performed by the tool. If it is not found, a new Ethernet device will be automatically created. In this way there is no risk to forget it.

Ethernet interface needs to be correctly configured. For more details please refer to Ethernet Shield section in Devise Home User Manual.


At this point the Ethernet interface can be connected to your home router and everything is ready to be controlled. You are not required to do any other actions.


Top


<< - Index - >>