Building a Temperature/Humidity Arduino Bot that Tweets updates!

Whilst testing out our various sensors I thought it would be fun to make the Arduino actually tweet out what the current status of our office is. The Arduino records the current, minimum, maximum and temperature change as well as humidity and then sends out a tweet to a Twitter account with an update every 15 minutes.

The following parts were used:

Requirements:

Click on any of the above links to download them. In order to use the Twitter library you will need to generate a Secret Token for your Twitter account – There are instructions on how to do this on the library page linked above.

Below is how you should connect up the pins to the Arduino; this diagram is from the DHT11 Datasheet which is linked above in the parts list.

dht11

 

I hooked up the data pin on the DHT11 to Pin 1 on the Ethernet Shield. That is about it for connecting up the components (simple isn’t it?), it is a really easy solution for monitoring temperature and the sensor is roughly around £1.50 to buy.

Before using the sketch below; make sure that you have downloaded the libraries listed above and placed them inside of your Arduino libraries folder (and restarted the Arduino IDE)

arduinoWe have the Arduino tweeting out updates every 15 minutes; this may be a bit much for some people so just alter the delay as needed; we also added the Update # number to the beginning of the tweet as if you send the exact same tweet consecutively to Twitter it won’t be posted… and if the temperature doesn’t change often this may happen a lot.

You can see a picture of it sat on my desk on the right hand side. It’s not the best photo we could have taken though (sorry!).

The code for the full sketch can be found below; it doesn’t have any scheduling, just a large delay as it is on one big loop. We also left 10s delay between polling the DHT11 sensor as it is quite slow and can throw back rubbish when polled too quickly..

Before running the above code make sure to set the Ethernet Shield’s IP/DNS/Subnet Mask and Gateway if you are using a static IP.

Our Arduino is still busy tweeting away; you can view it’s tweets by clicking here. It should be pretty easy to modify this code to do what you want it to do. There are a few handy functions such as getTempChange which will calculate the change in temperature; even with negative numbers, so passing in -10C and -5C will produce a 5C temperature change and passing in 10C and 2C will produce a -8C change.

If you have any comments, suggestions or questions please feel free to comment below or send us an email by using the contact us page.

Email this to someoneShare on Google+Pin on PinterestTweet about this on TwitterShare on RedditShare on Facebook

3 thoughts on “Building a Temperature/Humidity Arduino Bot that Tweets updates!

  1. Hi there,

    Can you help me. I only got the failure notifications for temp and humid. i tried some port on the arfuino but still the same notification. The sensor is good and works with other programs.

    i hope you can help.

    Greatings

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">