Temperature and Humidity Tweet Bot

A simple project to take temperature and humidity readings from my quail egg incubator with a DHT11 and Particle Photon and Tweet them via IFTTT.

Temperature and Humidity Tweet Bot

This project is very simple, almost embarrassingly so.

The need

While incubating my quail eggs (which I built an egg turner for), I found myself obsessed with what temperature the eggs were at throughout the day.

I thought it would be amazing to get something that takes a picture every hour and tweets it, with the temperature and humidity readings.

Simplifying requirements

The camera part of that idea was a bit tricky and would require buying additional hardware.
If I left out the camera, I already had all the pieces to build it.

Update a week later: I ended up doing the picture part as a separate project using an old android phone.

The equipment

Physically, all I needed was a programmable IoT device and a temperature/humidity sensor.
I already had a spare Particle Photon lying around and I found that I had a DHT11 module that measures temperature and humidity.

The Photon is an amazing bit of kit.
The programming is very similar to Arduino, making most Arduino sketches compatible and therefore importable.
It has WiFi built in, so connectivity is simple.
The Photon only communicates with Particle's servers, meaning that it is relatively secure.

The DHT11 board is not very accurate and claims to have a measurement error of +-2°C and only returns an integer temperature reading.
It wouldn't be suitable for making a thermostat out of, but it would do the trick for me. It would give me peace of mind that the eggs were in the correct temperature range.

With the addition of 3 wires to connect the Photon to the DHT11 and a micro-USB cable to power the photon, I had all the hardware that this project needed.

I did spend a bit of time making a development board for it and making a longer cable between the Photon and the DHT11 board.

The Code

The code wasn't too tricky, other than the non-blocking timer.

As I mention in the timer code, the Photon requires fairly regular contact with the Particle server and it doesn't like if you do a long blocking operation, like doing a delay for half an hour.
The device goes into a weird state and it is difficult to get it out of that state.
So that's why it does a continuous loop and only does the reading when the right amount of time has elapsed.

The Services

To make the data actually accessible, I needed to use the Particle library Publish function to push the data to Particle's servers.

From there, I wanted to get the data to Twitter.

I used IFTTT to connect Particle to Twitter so that the recipe would fire whenever the TempHumidityReading event is published from that particular Photon device and then tweet the data from the new Twitter account that I had set up for the project.

The results

Well... It works.

Here is the link to the Twitter account to see for yourself.
https://twitter.com/jayds_incubator

I don't suggest that you follow the account, unless you REALLY care about the temperature in my incubator and want to be spammed every half an hour by latest readings.