View
112
Download
0
Category
Preview:
Citation preview
Open Source Home Automation With
LinkSprite.IO
Jingfeng Liu
LinkSprite IO
LinkSprite IO
LinkNode R4
LinkNode D1 based Home Automation
Hardware List LinkNode D1 Linker Base for D1 Llnker Oxygen Sensor Linker temperature & humidity sensor Linker relay module Linker LED module IR distance sensor Servo 1602 LCD
Software Arduino IDE with ESP8266
hardware package Android SDK and Java
Arduino Code for WiFi include <ESP8266WiFi.h> #include <WString.h> #include <DNSServer.h> #include <ESP8266WebServer.h> #include <WiFiManager.h> void linksprite_io_init() { WiFiManager wifiManager; wifiManager.setAPStaticIPConfig(IPAddress(10,0,1,1),
IPAddress(10,0,1,1), IPAddress(255,255,255,0)); wifiManager.autoConnect("LinkNodeAP"); Serial.print("WiFi Connected ...\n"); Serial.println("WiFi connected"); }
json format to LinkSpriteIO using HTTP post request
if (client.connect(server,80)) { String postStr ="{"; postStr +="\"action\":\"update\","; postStr +="\"apikey\":\""; postStr += apikey; postStr +="\","; postStr +="\"deviceid\":\""; postStr += deviceID; postStr +="\","; postStr +="\"params\":"; postStr +="{"; ... postStr +="\"humidity\":\""; itoa(h,hum,10); postStr +=hum; postStr +="\"\r\n"; postStr +="}"; postStr +="}"; client.print("POST /api/http HTTP/1.1\n"); client.print("Host: "); client.print(server); client.print("\nContent-Type: application/json\n"); client.print("Content-Length: "); client.print(postStr.length()); client.print("\n\n"); client.print(postStr);
Zigbee pcDuino based Home Automation
Thank you!
Recommended