If you had hundreds of these things connected, and wanted to run analytics, push the data to other devices off the local network, or store the data efficiently then a cloud networking architecture might be exactly what you're looking for.
If not, there are plenty of non-IoT sensors you can connect to a local machine or gateway with your choice of wired/wireless comms protocols. You could just leave also just leave this sensor connected to the computer via USB. It wouldn't be practical for much, but it would be simple!
As for how I would solve it, it seems like something like mDNS should be in the solution space. But I don't think consumer routers or operating systems make this easy enough.
I recognize that these things are tiny, but I've worked with extremely limited, real-time devices too - it can be done.
So far I have it sleep between every 15m measurement which brought it up from three days of battery life.
On the hardware side, consider using a switching power supply. Many cheap/small ESP8266 breakouts use inefficient linear regulators. You may also consider adding a big capacitor across the battery +/- lines. This will help smooth out the large current pulses consumed by the device, which can be quite important as the battery voltage starts to drop.
The ESP8266 is pretty power hungry, but you should be able to get much more than two weeks on those batteries. Even in the worst case scenario, I'd expect about three months.
I'd be happy to take a look at your schematics and code. (email in profile)
AT+SLEEP has 2 modes, light sleep and modem sleep.
AT+GSLP is deep sleep (low-power sleep.)
Spec sheet says: " A
minor adjustment has to be made before the module enter this deep sleep mode, i.e., connect
XPD_DCDC with EXT_RSTB via 0 ohm resistor."
If you have a scope, check the current draw when you sleep.
Surprises can happen depending on the rest of your circuit.
I have a ATTiny85 on a timer to do the actual readings from the DHT sensor, then turn on the CH_PD pin for the ESP8266, then send the reading over serial. The ESP then turns that into a POST request. (This design is partially because I could never get the ESP to read directly from the DHT.)
Could that 3.3v regulator be a problem? Could CH_PD not actually be making it use less power? There are also a bunch of small capacitors to get things working more reliably, but I don't have a good understanding of which ones are useful or how much energy they eat.
The 3.3v regulator could certainly be improved. Once you've verified that your sleep currents are within the expected range (<1mA), consider swapping it for something more efficient. A board like  should work reasonably well if you set UVLO to the minimum value of 0.3V . This should get you to a few months of battery life.
A large capacitor (500+uF) on VBATT will stretch this a bit further. You want something with low ESR (the batteries should be around 400 milliOhms total; try to stay under 100 milliOhms). Anything here  would be pretty reasonable (supercaps are also a good option).
If you want to go even further, switch to an ATtiny85V and run it directly from the batteries. (This will work with your ATTiny85 as well, but you'll drop below its operating voltage while there's still a fair bit of usable charge left in the batteries.) Instead of wiring to CH_PD, you can wire it to the enable pin on your regulator (unfortunately not exposed on ; it's pin 6 on the TPS61200). You'll need to level shift the ATTiny<->ESP8266+sensor signals. The advantage here is that the ATTiny power doesn't take an efficiency hit from a converter and the ESP8266 and sensors can be 100% powered down when not in use. This is what I'd do if creating this as an original design on a single board.
For comparison purposes, I just changed the 3 x AA batteries on my outside sensor, the batteries lasted for 13 months (again, in outside conditions, including a very harsh winter).
I'm planning to write a post one of these days, but the gist of it is:
- attiny84 (don't even think about using an Arduino)
- DHT22 sensor (looking into SHT7x for better accuracy, but they're expensive as hell)
- TX module (I went with 433MHz because of better penetration)
I made 4 of these sensors, powered by batteries, so I can put them anywhere (within range, of course).
They send the reading every 4..7 x 8 seconds, both to keep the frequency clear (as required by law, I think it was 95% of the time) and as a poor man's anti packet collision.
They all report to a master RX, which is connected via USB to my server (which is always on anyway).
A small parser reads from serial USB and saves it in Mongo.
From there I can see the data in a simple webapp.
Oh yeah, and as a bonus, I made another thing that intercepts the outside sensor and display it on a 7 segment display, which looks really cool (plus I don't have to open the web page to see what's it like outside)
You can pick up an SHT21 for about $3 (breakout included) and Sensirion sell clip on IP-rated membrane covers for outdoor applications - you just need to build it into your housing and provide an o-ring.
AFAIK the only difference between the SHT21 and SHT71 is the "packaging", they both use the same circuitry.
So SHT21 == SHT71 and SHT25 == SHT75.
> You can pick up an SHT21 for about $3 (breakout included) [...]
Any links? I've had a lot of trouble finding something with an "Arduino" friendly breakout in that price range.
You can even get a knockoff Sparkfun board (well it's open source, so not exactly knockoff):
I'd go for the first one though, it looks like it has a membrane cover and does all the level conversion for you (it's only 3V3 tolerant). For some reason the SHT7x is an order of magnitude more expensive, no idea why.
I have 8 of these, and they are up to 30%RH off - both in terms of their readings relative to each other, and relative to the true RH of a saturated salt solution. Moreover, some of them have a strange "stickiness" to certain levels.
I've heard good things about the BME280, and that's what I intend to replace my DHTs with.
 See e.g. http://www.omega.com/temperature/Z/pdf/z103.pdf
http://www.kandrsmith.org/RJS/Misc/Hygrometers/calib_many.ht... does a pretty comprehensive review.
To get started with e.g. the tiny85 you just lookup the pinouts and connect the programmer, then change the settings in the Arduino IDE to use the programmer instead of serial. If you wanna get more advanced you can upgrade to ATMega's, but those really need an external crystal so it's more parts, but not that bad.
Final step is to stop using Arduino and move to using the native C SDK or even assembly. Make Magazine has a book on programming AVR's, I highly recommend it.
This article is a good starting point that walks you through how to duplicate an Arduino Uno on a breadboard. It's a bit old though so make sure to do some googling for more.
For me it made more sense, because using just 3 x AA I get about 5V so I don't have to use a voltage regulator (less power used).
That way I can also use the attiny's internal voltage reference to measure remaining battery life without any additional circuitry.
Plus the smaller package, no annoying red lights everywhere, etc.
> I would like to the next level and use ATTiny's directly but I have no real electronics experience, how did you get started ?
I started with zero experience as well.
I bought an Arduino, did the LED example and put it away for a year.
Then I found a 37 sensor kit, together with a breadboard and some wires and this wonderful wiki and... everything was different, because I was doing real practical (albeit simple) things with it.
The rest was just experimentation and reading about it, which was easy once I've found my "spark".
See @gh02t's answer for the attiny part, I went the lowest friction way with using an existing Arduino to program the attiny84.
TX with more range (using it just for the outside sensor): http://eud.dx.com/product/zsd-t3-315-433mhz-ask-high-power-r...
Small breadboard: http://eud.dx.com/product/solderless-breadboard-with-400-tie...
Oh yeah, if you're from the US, I think you need to get the 315MHz version (instead of the 433MHz), so be sure to double check that.
In that case, you should get the attiny84 from anywhere reputable.
I got it from here: https://www.amazon.co.uk/gp/product/B00P4E2XUC
You are also going to need a battery holder: http://eud.dx.com/product/diy-4-5v-3-slot-3-x-aa-battery-hol...
And I'm using this arduino for the master RX hub: http://eud.dx.com/product/new-nano-v3-0-module-atmega328p-au...
And if you want to make your life easier, a little extractor tool: http://eud.dx.com/product/proskit-908-609-ic-chip-extractor-...
To program the attiny84, see @gh02t's post.
I opted for the use-another-Arduino-as-the-programmer method -- I don't know if you can do it with the nano, I did it with an old Arduino Duemilanove I had laying around.
And here's a fritzing sketch (ignore the fact that there are 4 batteries, the library didn't have a model for the 3 battery case holder).
If you need help with anything after they arrive, feel free to email me (email is on profile website).
The attiny85 can get to μA while sleeping.
Once I had two DS18B20 sensors (temp), one 1602 LCD (over I2C) and a PIR sensor to act as interrupt connected to a attiny85. One temp sensor shared the same pin with the I2C data line. I just had to make sure they weren't used at the same time.
This setup let me with two pins free, one of which I used as sink (ground) for the LCD, thus effectively being able to turn it off by pulling up the pin.
I'm using serial from ATTiny85 to a ESP8266 as my wireless transmitter already: https://i.imgur.com/vZzGGZL.png but the ESP itself is probably the root of the power problem.
I think they needed an extra timer that the attiny85 didn't have.
Attiny84 wasn't exactly plug and play either, as I had to adapt the Arduino libraries code to it, but at least all the hardware was there.
1. Consider powering the sensor via a GPIO pin that you set high when you want to take a reading rather than connecting it to the positive rail.
2. Research whether your chip can be easily put into deep-sleep mode (the -01 boards require a jumper wire to be soldered to one of the IC legs which is not super-easy to accomplish).
As others said, if you are really serious about this you would be much better to go with a ATTiny or similar, but then you don't get radio out of the box, so need to work with 433mhz modules or similar.
(I'm not affiliated in any way, just my go-to product for DIY IoT stuff)
I powered it from a programmer for now sticking out of a powered USB HUB (probably not so wise!), but ordered a few sub-dollar 'power' modules to try out as well.