Follow Us
Facebook Twitter Google Plus Linkedin Instagram YouTube

Hello world of IoT

Almost all tech enthusiasts have performed “Hello World” practicals when learning any new programming language, which displays “Hello World” statement on output console.

People from embedded system background have performed “LED Blinking” as a Hello World while learning any new embedded platform. In similar manner, an IoT engineer performs a Hello World practical while learning IoT, it is known as sending data over internet using HTTP protocol.

There are plenty of easy to use platforms available to send and observe data using HTTP protocol like ThingsSpeak, Freeboard, Node-Red etc. But out of these all, most easy platform is


It is fast, free and ridiculously simple— it’s like Twitter for social machines.

We will be using NodeMCU hardware platform to send data collected on analog pin A0 to cloud. If you are new to NodeMCU then first check out Getting Started with NodeMCU(ESP8266) tutorial.



You could interface any analog sensor of your choice to pin A0 or you could connect a jumper wire which could be switched between 3v3 pin/ GND pin to have variation at the input of A0 pin.



Now it’s time for programming. Copy and paste the following code in Arduino IDE. Change “ssid” and “password” with your respective WiFi ssid and password. So that NodeMCU could be connected to internet.

#include <ESP8266WiFi.h>
const int AnalogIn = A0;
const char* ssid = "Your_ssid";
const char* password = "Your_Password";
const char* host = "";
const char* thing = "cirkitect";   //replace it with your thing name
const char* thing_content = "A0";

void setup() {
// We start by connecting to a WiFi network
Serial.print("Connecting to ");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.println("WiFi connected");
Serial.println("IP address: ");

int value = 0;

void loop() {
value = analogRead(AnalogIn);
Serial.print("connecting to ");
// Use WiFiClient class to create TCP connections
WiFiClient client;
const int httpPort = 80;
if (!client.connect(host, httpPort)) {
Serial.println("connection failed");
// We now create a URI for the request
String url = "/dweet/for/";
url += thing;
url += "?";
url += thing_content;
url += "=";
url += value;
Serial.print("Requesting URL: ");
// This will send the request to the server
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Connection: close\r\n\r\n");
int timeout = millis() + 5000;
while (client.available() == 0) {
if (timeout - millis() < 0) { Serial.println(">>> Client Timeout !");
// Read all the lines of the reply from server and print them to Serial
String line = client.readStringUntil('\r');
Serial.println("closing connection");

After successfully uploading code on NodeMCU, open the serial monitor and see weather your NodeMCU have started sending data.

Now to observe this data on platform go to this URL :

You should relace “cirkitect” with the thing name used in program. Try making changes in sensor output and observe the respective changes on webpage in the form of graph.

Leave a Reply

Your email address will not be published.Required fields are marked *