Maker Pro
Arduino

Temperature Monitoring with NodeMCU and makerarena.com

January 21, 2020 by Mutlu Yağlıoğlu
Share
banner

This project shows a temperature monitoring via free and flexible IoT platform "makerarena.com".

Hardware

Software

1 ArduinoIDE
1 makerarena.com

This is an example of DHT11 temperature sensor with makerarena.com IoT platform. 

makerarena.com

Free, flexible and easy to use IoT platform for your DIY projects. It has configurable alert, filter, e-mail functions, live data graphics and more. You can monitor your sensors or control on/off relays remotely. 

1- Sign Up

2- Add a project or select a project from your project list

3- Go to "Devices" page

3- Add a device and get the key

4- Use your key at your sketch below

Screen Shot 2020-10-06 at 10.36.09.png
#include <ESP8266WiFi.h>
#include <dht11.h>
#include <ArduinoJson.h>

String apikey = "ENTER YOUR APIKEY HERE"; 
const char* ssid = "ENTER YOUR WIFI SSID HERE";
const char* password = "ENTER YOUR WIFI PASSWORD HERE";
float t, h;
const char DHTpin = D4;

dht11 DHT11;
WiFiClient client;

void setup() {
  Serial.begin(9600);
  WiFi.begin(ssid, password);
  Serial.println('\n');
  Serial.println("Connecting... ");

  while (WiFi.status() != WL_CONNECTED) {
   delay(1000);
  }
  Serial.println("Connected");
}

void loop() {
  DHT11.read(DHTpin);
  data = DHT11.temperature;

  StaticJsonDocument<200> doc;
  char msg[128];

  doc["k"] = apikey;
  doc["d"] = String(data);
  serializeJson(doc, msg);

  String postdata = "apipost="+String(msg);
  Serial.println(postdata);

  if (client.connect("makerarena.com", 80)) {
    client.println("POST /api/insertpost.php HTTP/1.1");
    client.println("Host: makerarena.com");
    client.println("Content-Type: application/x-www-form-urlencoded");
    client.print("Content-Length: ");
    client.println(postdata.length());
    client.println();
    client.print(postdata);
        
        if(client.connected()) {
        client.stop();
        } 
     }
 delay(60000); // wait 1 min.
}
mcu-dht11_bb.png

For more details please visit makerarena.com

Related Content

Comments


You May Also Like