This instructable shows you how to publish your data to AskSensors IoT Platform using Arduino Ethernet Shield. The Ethernet Shield enables your Arduino to easily get connected to the cloud, send and receive data with an internet connection.
We will be learning the basics of connecting an Arduino Ethernet shield to the AskSensors web server, and sending dummy data over HTTP requests. At the end, will visualize live data streams in the AskSensors cloud.
AskSensors supports HTTPS, however, MCUs mounted on Arduinos don't handle HTTPS connections. For this reason we will be using HTTP instead of HTTPS.
Requires an Arduino board.
Operating voltage 5V, supplied from the Arduino Board.
Ethernet Controller: Wiznet Ethernet controller W5100 with internal 16K buffer
The Wiznet W5100 provides a network (IP) stack capable of both TCP and UDP.
Connection speed: up to 10/100Mb
Connection with Arduino on SPI port: It uses the ICSP header pins and pin 10 as chip select for the SPI connection to the Ethernet controller chip.
The latest revision of the Ethernet Shield includes a micro-SD card slot on board, which can be used to store files for serving over the network.
The Ethernet Module has a standard RJ45 connection, with an integrated line transformer.
The connection to a network is made with a RJ45 Ethernet cable.
We will need to change some network settings in the program to correspond to our network.
Later, you may need to verify the Ethernet status using the informational LEDs:
The hardware required for this tutorials is:
A computer running Arduino IDE software.
An Arduino board such as the Arduino Uno.
A USB cable for powering and programming the Arduino.
An Ethernet cable, for connecting to your network router.
AskSensors requires the following:
Each Sensor provides several Modules that the user can send data to them separately. The user can also visualize the collected data of each module in a graph. AskSensors provides multiple choices of graphs including Line, Bar, Scatter and gauge.
So at this moment we have been able to register a new Sensor in the AskSensors platform, Now we are going to write some code in the Arduino for its connection to the platform. There are hundreds of tutorials about connecting the Arduino to the web through the Ethernet Shields, so I'm not going to explain this part.
Download this Arduino sketch example from github. The code uses DHCP and DNS for the server and is supposed to work right away with few changes:
// MAC
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 1, 177);
// ASKSENSORS config.
const char* apiKeyIn = "MTWN7AQOLWJNEIF8RGMAW5EGKQFAHN2K"; // Change it with your API KEY IN
// dummy data
int dumData = 100; // set your data
Now that your data is published well to the AskSensors cloud. You can see this data in graph or export it to CSV file.
Each Sensor has its own dashboard that currently allows monitoring its state in real time(last update date, connection state ..).
Click your Sensor from the list, set a graph to your module (Module 1). The image above shows an example of display using the gauge graph type.
Thank you for reading. you can find more tutorials here.
If you have any queries, join the AskSensors community!