-
• #2
Neat!
So how'd you do it?
-
• #3
What exactly are you powering with these 20mA?
-
• #4
This only one board Wemos D1 Mini + Sensor DHT21(AM2301)
My script:
// Init ESP8266 var ESP8266 = require("ESP8266"); //ESP8266.setLog(1); //ESP8266.printLog(); E.setClock(80); // Init WiFi Networks var wifi = require("Wifi"); wifi.setHostname("WemosD1mini"); wifi.connect("XXXX", {password:"XXXX"}, function(err){ setTimeout(function(){ console.log("connected? err=", err, "info=", wifi.getIP()); },5000); }); wifi.stopAP(); wifi.save(); var dht2 = function(){ var dht = require("DHT22").connect(D14); // GPIO0 dht.read( function(a){ console.log("Temp is "+a.temp.toString()+" and RH is "+a.rh.toString()); var newDht = a.temp.toString()+","+a.rh.toString(); postToServer(newDht); }); return true; }; // Send Every 5 min setInterval(function() { setTimeout(function () { dht2(); }, 20); }, 300000); setDeepSleep(1); function postToServer(data){ var options = { host: 'XXXXX', port: '80', path:'/event', method:'POST', headers: { "Content-Type":"application/json", "Content-Length":data.length } }; require("http").request(options, function(res){ var d = ""; res.on('data', function(data) { d+= data; }); res.on('close', function(data) { console.log("Closed: "+d); }); }).end(data); }
Input: 8.0V - 2x Liteon 2500mAh
Output: 5.52
Getting: 20mAh
Send to server every 5 min from sensor AM2301
1 Attachment