Tutorial advanced 2:


Web Server: read a Sensor




Content of the tutorial:


- How to read the value of a sensor.

- How to connect your mobile.



Introduction


Dear User, in the former tutorial we have seen how to use a Web Server to set the status of a device using your browser directly connected to the same local network as your control system.
In this tutorial you will learn how to read the status of a sensor (i.e. a temperature sensor) and diplay the read value on your browser. Then you will see how you can configure your local network, so that you can perform all the operations from a remote location.




Web Server: read sensor values


A sensor is a device connected to your controller. Normally it is used to know the value some entities belonging to the environment around. For instance a temperature sensor give us the temperature value, the umidity sensor the value of umidity, and so on.
All of them transform the entity value to an electrical value, that is a value that our system can read and in someway show us.



There are mainly two kind of sensors: analog sensors and digital sensor. Analog sensor are for instance: temperature, pressure, umidity, light, gas, liquid flow, wind and movement sensor. Digital sensor are counters, switches, buttons, triggers, proximity, security sensor.

We can manage both kind of sensor. The only attention we have to pay is to connect analog sensor to analog pins of our controller and digital sensors to digital pins as well.

Note that when an analog sensor is connected to an analog pin of the controller, the read value is converted in a value that is in a range that depends on how many bits are used for the A/D conversion (10 bits corresponds to 0-1023 range ov integer values). However the read value will be automatically remapped to the range we really need, simply by configuring the new range (normally the range for a correct remapping is provided by the sensor documentation/datasheet).


If you want a better accuracy to represent the read value, you can use an external A/D converter, but this is out of the scope of this tutorial.

Refer to Web Server section in Devise Home User Manual to see how to configure our Web Server to read values provided by our sensors.




Web Server: How to connect your mobile


A this point of this tutorial we have understood how to build a simple system that allows you to move one or more switches and/or read the value of one or more sensors. There is still one important thing that has not been explained yet: how to get the control of your system through your mobile.

What I'm going to describe to you is one of the most powerful features of Devise Home. As a matter of facts, you will soon discover that this operation is very simple, despite all the complex configurations (IP, Router, DNS etc.) that other systems normally require.

So, let's assume that, as preliminary actions, you have:
- chosen one of the Web Server examples from the example list,
- downloaded the project software files,
- built the small system hardware,
- uploaded the software files on the main board (Arduino),
- connected the ethernet interface to your internet Router through a RJ45 cable.

Well, it's now time to take in your hands your mobile, open your preferred browser (chrome and firefox are the most recommended), go to Devise Home website: www.devisehome.com and execute log in with your personal credentials.

At this point, if any of the previous steps have been done correctly, you can see a web page, named 'Control Panel', containing one (or more if you have connected more projects to internet) push button with the name of your Project (this button disappeares when your system is switched off or disconnected from internet). This button will lets you have access to the page of your system, where you can control everything is included in your project. Try it and see it is simpler than talk about it!

That's it!


<< - Index - >>