
The Internet is one of today’s most valuable tools for sharing and transferring data around the globe. It is used by just about everyone for a million different reasons. One aspect of the Internet that most people avoid is web hosting. It is a little known fact that Internet pages can be hosted from your home computer for free using your standard Internet connection. A few Internet providers do not like you doing this but as long as you do not exploit the privilege then they should not have any reason to complain. Here is a little guide on how to configure and share websites from your home PC.
http://www.technospot.net/blogs/host-a- ... r-home-pc/
We are going to ignore this and instead get an Embedded system online by using the same port forwarding principals and an EB023 Internet E-Block. As there are a lot of different ISPs, routers and other small differences that could potentially cause technical problems we will not provide support to get this working for you. However saying this the method should work as is on most systems without too much effort. Remember if you get stuck Google is your best friend.
Here is a large list of common household routers with information on how to configure the port forwarding correctly to allow your embedded system to be seen from the Internet.
http://portforward.com/routers.htm
For a demonstration we have created a demo application using the EB023 Internet E-Block combined with an analogue sensor. The EB023 was programmed via the Flowcode Webserver component and the program was based on the normal web server example available from our website. Simply configure the IP address of the EB023 board to sit on your home network and then configure your Internet router to forward internet page requests on port 80 to the IP of the EB023 and your ready to go. You could even go online and get a domain name that forwards the clients directly to the embedded system at your home so you don’t have to remember IP addresses. These domain names can be purchased or are available for free using services such as NO-IP.
The Flowcode component is capable of generating standard HTML as well as client side Javascript code. Using Javascript I have created two functions, one to refresh the web page every 2 seconds and one to detect if the temperature is above a threshold value. Depending on the temperature variable we get the following web pages shown below: One shows the temperature variable within the threshold and the other shows the variable outside the threshold. Remember Javascript runs on the client machine therefore less work for your embedded processor.


Here is my webpage code, It includes all of the Javascript functions and styles to allow for the different text colours and sizes shown above.
Code: Select all
<html>
<head>
<title>Embedded Temperature Monitor</title>
<script type="text/javascript">
function reFresh()
{
location.reload(true)
}
window.setInterval("reFresh()",1000);
function checkTemp()
{
var temp = %BOO1%;
if(temp > 100)
{
document.write('<span class=\\"style5\\"><b>OVER TEMPERATURE!!</b></span>');
}
else
{
document.write('<span class=\\"style4\\"><b>OK</b></span>');
}
}
</script>
<style type="text/css">
.style1 {
font-size: xx-large;
font-weight: bold;
color: #0000FF;
}
.style2 {font-size: medium}
.style3 {font-size: medium; font-weight: bold; color: #0000FF; }
.style4 {color: #00FF00}
.style5 {color: #FF0000}
</style>
</head>
<body>
<p align="center" class="style1">Embedded Temperature Monitor<br>
<br>
<span class="style2">System Status: <span class="style4">Online</span></span></p>
<p align="center" class="style3">Sytem Temperature: %BOO1% Β°C</p>
<p align="center" class="style3">Temperature Status: <script> checkTemp() </script></p>
</body>
</html>
Since the value returned by the sensor is a generic value of 0 to 255 to represent 0V to 5V we have several options to convert the data into a more standard temperature value. This can be processed on the microcontroller as a look up table or complex equasion, processed on the PC viewing the webpage by using a Javascript function or processed on a remote server using a scripting technology such as PHP or PERL.
If you are hosting a website from an embedded system anywhere in the world then you can use a scripting language such as PHP to take the page data and allow it to be included in a dynamic generated site. For example if you wanted to add the real time local sunlight level to your website.
Rather then using your embedded system to host a website or webpage you can instead use the Flowcode TCP/IP component to output UDP or TCP data that can be collected by your PHP or PERL server. This would cut down some of the overhead and allow much more data to be pumped through the systems.