Hello adam,
awesome Project! Unfortunately I am a rookie here an not keen
in programming at all, so I just copied your Project with a DHT22.
Connection to mydevices works fine, but any Idea why I stuck in a Humidity loop?
Setup[20383] Connecting to xxxxx
[21886] Connected to WiFi
[21886] My IP: 192.168.xxx.xx
[21886] Connecting to arduino.mydevices.com:xxxx
[22319] Ready (ping: 152ms).
Entered Humidity
Humidity: 43.90
Entered Humidity
Humidity: 44.70
Entered Humidity
Regards Erik
Iām not exactly sure to be honest, but I would suspect that the differences between the DTH11 and DTH22 are enough that my code doesnāt work copied and pasted. I have a DHT22 that I can try later (havenāt even taken it out of the package yet). Iāll get it working and upload the code for you.
I also forgot to update how long it lasted. With 2 AA batteries this project updated the dashboard from 9/22/16 to 10/11/16 - 25 days! I have 2 AAA batteries hooked up now to see how long they will last.
Adam,
I got it fixed!
(You must define all three Graphs in the
dashboard, for data handshake, otherwise
the routine does`t run troughā¦)
[7597] Ready (ping: 2172ms).
Entered Temperature
Temperature: 73.94
Entered Humidity
Humidity: 53.90
Entered Heat Index
Heat Index: 73.34
Got all values - sleeping
Cheers
Made a mistake on Ebay and had 3 boards arrive on which to mount an esp-12 not the esp-12s.
Re-ordered hopefully the right items.
The battery holders and DHT11s arrived ok and I bought some boxes from a charity shop.
Should be good to go soon.
The AAA batteries didnāt fare very well. They only lasted 3 days, but there could have been a Cayenne outage in there that drained the batteries. I have some LiPO laptop batteries that Iām going to try as soon as my HT7333 voltage regulators are delivered from China (hopefully soon - ordered them 2 weeks ago). These voltage regulators have a very low voltage drop (90mV as opposed to the 1.1v on the AMS1117) and will allow the ESP to run for longer when the battery voltage hits less than 4.4v.
ESP12s now arrived. Aim to make up 2 or 3 modules.
IDE setup and sketch verified - just need to get the soldering iron out.
I think I will wire in a programming socket to make it easy to connect the FTDI module as I may use these to record temperatures in other places, so it this would make it easier to change the WiFi settings.
Really interesting project.
I already have a dht11 on a nodemcu running, but looking into making it battery driven.
Have you thought of monitoring the battery volts if possible? and ofcourse transmit the value to cayenne, and then be able to trigger a mail when getting low.
Or would it be more logic to just send a mail when it has been silent for too long?
I think there is a lot we can do here.
- Power your DHT module using I/O so it isnāt a parasite.
- Use an efficient switching regulator vs. a linear regulator.
- Evaluate whether MQTT gets messages through faster.
- Using a Lipo along with a switcher, we can discharge to 3.3V and still maintain regulation, getting 90+ discharge out of the battery.
- Investigate incorporating a solar cell to harvest a bit of energy.
Looking forward to trying dis.
Cheers,
Craig
Never thought about the DHT being on all the time, Iāll definitely do that.
The HT7333 regulator I have on now only drops 90mV and the Quiescent Current is only 8 mA max. What did you have in mind? The major downside to the HT7333 is that its legs donāt line up with a standard perf board so itās a pain to solder it in. To get one up and running quick I ended up soldering some solid wire the board and then soldering the HT7333 to the wires. Definitely need to look in to a better way to integrate them.
Iām not checking if the message got through or not, just sending and praying it makes it. Easy enough to run a check on the last date stamp received on the MQTT server and send an alert that data is not being received.
I have a lipo and a charger that I am going to hook up after these 4AA batteries finally die (been running for 2 days shy of a month and still have mover 3.3v left). My concern with the lipo is draining it completely dead, which Iām assuming you were referring to with the switcher. What do you have planned there?
Iāve also been contemplating this, just havenāt pulled the trigger on a solar panel yet. The lipo charger I have supports charging and a load up to 1A so it should work absolutely fine with the ESP. Might order one tonight!
You can monitor the VCC volts using ADC_MODE(ADC_VCC); below your defines (basically before the setup function) and then call vcc = ESP.getVcc(); to get the voltage. I havenāt had much luck with it being accurate, but it has been consistent. If you monitor the value of VCC you could come up with a conversion formula.
After doing some googling it looks like it is possible to solder it right to a perf board, just have to be very careful. This guy pulled it off.
Get something like this, and you get a sleep current of less than 500 uA with a LiPo supply.
Craig
Oops, meant to say the HT7333 uses 8 uA max (according to the datasheet anyway) in my last post. My only problem with that module is that is only accepts up to 6v, but I like that it comes with headers on it. Might order a few of those if I can find it on amazon.
Argh.
I meanā¦really. I can BARELY SMT solder an ESP12-e.
The smaller SMT stuff- cripes, I canāt even see it clearly enough to solder.
If things continue to shrink,
Iāll be required to pay an independent assembler
to build it for me!
Can you specify the AA batteries you use? Normal oder rechargeable ones? Which capacity?
Any AA batteries will work. Specifically the ones I used were from Amazon (Amazon brand) but I also have some 2700mAh POWEREX AA rechargeable batteries that are that are really good https://www.amazon.com/Powerex-MHRAA4-2700mAh-Rechargeable-Batteries/dp/B00A9KTPY8/ref=sr_1_4?ie=UTF8&qid=1478455224&sr=8-4&keywords=powerex+aa and I use a POWEREX charger as well https://www.amazon.com/PowerEx-MH-C9000-WizardOne-Charger-Analyzer-Batteries/dp/B003DIGKOG/ref=sr_1_3?ie=UTF8&qid=1478455270&sr=8-3&keywords=powerex+charger I think when I ordered the charger they threw in the batteries for free but it was about 4 years ago so it may be a separate purchase now.
Iāve actually moved on to recycling old laptop batteries to power this project now REUSE YOUR OLD LAPTOP BATTERY TO MAKE a POWER BANK : 9 Steps (with Pictures) - Instructables. I use this for the charger for the batteries Amazon.com with no fires (yet). Iāll update the post after MQTT is released.
Tried to modify this for HTU21d with is much more accurate then the DHT sensors.
But like the other project i tried with cayenne and nodeMCU this seems not to work.
Is here anybody who got cayenne and nodemcu working???
My monitor output:
bBĆĆā BrĆ»ĆĀ¦ĆŖƶĆæSetup[269] Connecting to networxSAVE2
[2272] Connected to WiFi
[2272] My IP: 192.168.200.37
[5001] Connecting to arduino.mydevices.com:8442
[10247] Connecting to arduino.mydevices.com:8442
[10495] Connecting to arduino.mydevices.com:8442
[10740] Connecting to arduino.mydevices.com:8442
[11157] Ready (ping: 170ms).
Entered Humidity
Exception (28):
epc1=0x40203e9d epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
ctx: cont
sp: 3ffef6e0 end: 3ffefac0 offset: 01a0
>>>stack>>>
3ffef880: 3ffe8500 00000000 3ffee9dc 40203e99
3ffef890: 3ffee794 3ffee79c 3ffee9dc 40203f4b
3ffef8a0: 40102a7d 3ffefa04 3ffee9dc 40202987
3ffef8b0: 00007fff 00f85e25 3ffed490 40102c0c
3ffef8c0: 3ffe9858 00000000 00000000 00000000
3ffef8d0: 00000000 00f85e25 4010304a 00000100
3ffef8e0: 7fffffff 3ffe9858 3ffe9858 00000001
3ffef8f0: 00000001 00007fff 00000000 4000050c
3ffef900: 401030e7 00f85e25 00000000 4000050c
3ffef910: 3fffc278 40102de4 3fffc200 00000022
3ffef920: 3ffefa03 00000000 0ccccccc 00000009
3ffef930: 00000019 00000001 00000000 3ffefa05
3ffef940: 00000000 3ffe8cec 00000001 3ffefa00
3ffef950: 00007276 3ffefa04 3ffee7a0 4020101c
3ffef960: 3ffefa04 3fffc6fc 00000001 4022333d
3ffef970: 3fff0b74 00000000 3ffeea98 3ffefa00
3ffef980: 00007276 3ffefa04 00000000 40202c4c
3ffef990: 3ffefa00 3fff0b74 3fff0a44 40203c85
3ffef9a0: 40204a00 3ffee7d4 00000030 40203ce6
3ffef9b0: 40204b0a 3ffee7d4 3ffeeaa0 3ffefa03
3ffef9c0: 3ffee7a0 00000004 40204ab8 3ffeeaa0
3ffef9d0: 00000005 3ffefa00 3ffee7a0 3ffefa00
3ffef9e0: 00000004 00000001 3ffee7a0 40202ec2
3ffef9f0: 00000000 3ffee7c0 3ffee7a0 40202d24
3ffefa00: 30007276 3fffda00 3ffeea98 00000030
3ffefa10: 04000314 00002000 3ffeeaa0 3ffee7c0
3ffefa20: 00000004 3ffefa00 40204ab8 3ffeeaa0
3ffefa30: 3ffe84a0 000020fa 3ffee7a0 00000001
3ffefa40: 00000000 3ffee7c0 3ffee7a0 402030b5
3ffefa50: 00000000 ff000000 01c8a8c0 40201513
3ffefa60: 3fffdad0 3ffe8358 3ffee7ec 40202709
3ffefa70: 3ffee7c0 25c8a8c0 feefeffe feefeffe
3ffefa80: 3ffe834c feefeffe 3ffee9dc 3ffeea98
3ffefa90: 3fffdad0 00000000 3ffeea90 402030f1
3ffefaa0: 3fffdad0 00000000 3ffeea90 40204b04
3ffefab0: feefeffe feefeffe 3ffeeaa0 40100718
<<<stack<<<
My modified sketch:
//#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
// #define DHTTYPE DHT11
// #define DHTPIN 14
#include "CayenneDefines.h"
#include "BlynkSimpleEsp8266.h"
#include "CayenneWiFiClient.h"
// #include <DHT.h>
#include <SparkFunHTU21D.h>
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "";
// Your network name and password.
char ssid[] = "";
char password[] = "";
//Variables for DHT11 values
//float h, t, hif;
float h, t;
bool Humidity = false;
bool Temperature = false;
//bool HeatIndex = false;
//DHT dht(DHTPIN, DHTTYPE);
HTU21D myHumidity;
void setup()
{
Serial.begin(9600);
Serial.print("Setup");
Cayenne.begin(token, ssid, password);
Humidity = false;
Temperature = false;
//HeatIndex = false;
}
void loop()
{
//Run Cayenne Functions
Cayenne.run();
//Check if we got all values we wanted and sleep for 10 minutes if we did
// if (Humidity && Temperature && HeatIndex){
if (Humidity && Temperature){
Serial.println("Got all values - sleeping");
delay(100);
ESP.deepSleep(60000000, WAKE_RF_DEFAULT);
delay(100);
}
}
CAYENNE_OUT(V0){
Serial.println("Entered Humidity");
//Check if read failed and try until success
do {
//Read humidity (percent)
// h = dht.readHumidity();
h = myHumidity.readHumidity();
delay(1000);
} while (isnan(h));
Serial.print("Humidity: ");
Serial.println(h);
//Set Humidity to true so we know when to sleep
Humidity = true;
//Write to Cayenne Dashboard
Cayenne.virtualWrite(V0, h);
}
/*CAYENNE_OUT(V1){
Serial.println("Entered Temperature");
//Check if read failed and try until success
do {
//Read temperature as Fahrenheit
// t = dht.readTemperature(true);
t = myHumidity.readTemperature();
delay(1000);
} while (isnan(t));
Serial.print("Temperature: ");
Serial.println(t);
//Set Temperature to true so we know when to sleep
Temperature = true;
//Write to Cayenne Dashboard
Cayenne.virtualWrite(V1, t);
}
CAYENNE_OUT(V2){
Serial.println("Entered Heat Index");
//Check if read failed and try until success
do {
//Read humidity (percent)
h = dht.readHumidity();
//Read temperature as Fahrenheit
t = dht.readTemperature(true);
//Calculate Heat Index as Fahrenheit
hif = dht.computeHeatIndex(t, h);
} while (isnan(t) || isnan(h));
Serial.print("Heat Index: ");
Serial.println(hif);
//Set HeatIndex to true so we know when to sleep
HeatIndex = true;
//Write to Cayenne Dashboard
Cayenne.virtualWrite(V2, hif);
} */
Ok, i just want to get a feeling for the capacity in mAh which is consumed per day/week.