Embedded HTTP Server: Protocol For Embedded and SBC Device Communication
Embedded HTTP Server: Protocol For Embedded and SBC Device Communication
An embedded web server resides on a hardware product, such as a printer, rather than software loaded
on a network server. Can be Arduino or a BC like Raspberry Pi.
An embedded HTTP server is a component of a software system that implements the HTTP protocol.
Examples of usage within an application might be:
To provide a thin client interface for a traditional application.
To provide indexing, reporting, and debugging tools during the development stage.
To implement a protocol for the distribution and acquisition of information to be displayed in
the regular interface — possibly a web service, and possibly using XML as the data format.
To develop a web application
There are a few advantages to using HTTP to perform the above:
HTTP is a well-studied cross-platform protocol and there are mature implementations freely
available.
HTTP is seldom blocked by firewalls and intranet routers.
HTTP clients (e.g. web browsers) are readily available with all modern computers.
There is a growing tendency of using embedded HTTP servers in applications that parallels the rising
trends of home-networking and ubiquitous computing.
MQTT. The acronym stands for Message Queue Telemetry Transport, a protocol initially invented by
IBM. The aim of the protocol can be expressed as follows
1|Page
What makes MQTT more suitable than WebSocket or HTTP REST API in context of Embedded Systems?
MQTT provides publish/subscribe mechanism already in protocol level
MQTT provides Quality of Service policy
MQTT introduces minimal overhead in communication
MQTT is designed for narrowband communication channel and constrained devices
cURL (/kɝl/ or /kə:l/[4]) is a computer software project providing a library and command-line tool for
transferring data using various protocols. The cURL project produces two products, libcurl and cURL.
It was first released in 1997. The name originally stood for "see URL".
2|Page
Sample commands to retrieve.
3|Page
To retrieve the embedded-iot.net homepage, type:
curl www.embedded-iot.net
Chrome extension Postman REST Client, an HTTP client for testing web services. Build, test, and
document your APIs faster. ... The idea for Postman arose while the founders were working together,
and were frustrated with the existing tools for testing APIs.
Link to my program:
https://www.hackster.io/detox/send-esp8266-data-to-your-webpage-no-at-commands-7ebfec
4|Page
String data =
"Humidity="
+ (String) Humidity
+ "&Temperature_Cel=" +(String)
Temperature_Cel
+ "&Temperature_Fehr=" +(String)
Temperature_Fehr
+ "&HeatIndex_Cel=" +(String)
HeatIndex_Cel
+ "&HeatIndex_Fehr=" +(String)
HeatIndex_Fehr;
//client.println("POST
/dht11/dataCollector.php HTTP/1.1");
client.println("POST
/YOUR_SUBDOMAIN/YOUR_PHP_PAGE.php
HTTP/1.1");
//client.print("Host: embedded-
iot.net\n");
client.print("Host:
YOUR_TOPLEVEL_DOMAIN_HERE\n");
client.println("User-Agent:
ESP8266/1.0");
client.println("Connection:
close");
client.println("Content-Type: application/x-
www-form-urlencoded");
client.print("Content-
Length: ");
client.print(data.length());
client.print("\n\n");
client.print(data);
client.stop();
5|Page
<?php
date_default_timezone_set("America/Los_Angeles");
$TimeStamp = "The current time is " . date("h:i:sa");
file_put_contents('dataDisplayer.html', $TimeStamp, FILE_APPEND);
$var1 = $_REQUEST['Humidity'];
$var2 = $_REQUEST['Temperature_Cel'];
$var3 = $_REQUEST['Temperature_Fehr'];
$var4 = $_REQUEST['HeatIndex_Cel'];
$var5 = $_REQUEST['HeatIndex_Fehr'];
$WriteMyRequest=
"<p> The Humidity is : " . $var1 . "% </p>".
"<p>And the Temperature is : " . $var2 . " Celcius </p>".
"<p>And the Temperature is : " . $var3 . " Fehreinheit</p>".
"<p>And The Heat Index is : " . $var4 . " Heat Index Celcius </p>".
"<p>And The Heat Index is : " . $var5 . " Heat Index Fehrenheit </p><br/>";
file_put_contents('dataDisplayer.html', $WriteMyRequest, FILE_APPEND);
?>
6|Page
Input to: http://www.embedded-iot.net/dht11/dataDisplayer.html
http://devices.webofthings.io/pi/actuators/display/
embedded WebCode
http://www.embedded-iot.net/dht11/WoT_IoT.php
Go to: http://www.embedded-iot.net/dht11/WoT_SimpleSend.html
Now
http://devices.webofthings.io/camera/sensors/picture/
or embed:
http://www.embedded-iot.net/dht11/WoT_SensorValue.html
www.embedded-iot.net/dht11/WoT_Graph1.html
7|Page