Tweeting Weather
I’ve re-written my rf24 wrapper to tweet its findings, although as you can see the DHT11 and BMP085 seem to have gone insane, so possibly low voltage or cold issues. I’m thinking I’ll have to move to three AA batteries and a 3.3v regulator:
Altitude: 645.97m, pressure: 14.65psi, temperature: 13.60/12.31/15c, humidity: 49%, dewpoint: 4.37c, date: Tue 29 Oct 2013 15:53:02
The code is below:
#!/usr/bin/env python
from time import strftime, localtime
import sys
from twython import Twython
# twitter auth
CONSUMER_KEY = '******'
CONSUMER_SECRET = '******'
ACCESS_TOKEN = '*******'
ACCESS_SECRET = '*****'
# open file for reading
file = open("/var/tmp/rf24weather.txt", "r")
# read the line
line = file.readline()
# split on colons into array
data = line.split(':')
# print results
tweet = "Altitude: %.2fm" % (float(data[0])/100)
tweet += ", pressure: %.2fpsi" % (float(data[2])/100)
tweet += ", temperature: %.2f/%.2f/%ic" % (float(data[1])/100,float(data[6])/100,int(data[3]))
tweet += ", humidity: %i%%" % (int(data[4]))
tweet += ", dewpoint: %.2fc" % (float(data[5])/100)
tweet += ", date: "
tweet += strftime("%a %d %b %Y %H:%M:%S", localtime(float(data[7])))
api = Twython(CONSUMER_KEY,CONSUMER_SECRET,ACCESS_TOKEN,ACCESS_SECRET)
api.update_status(status=tweet)
Update: I’ve confirmed the DHT11 problem is down to the low voltage of the coin cell, testing it with a regulated 3.3v supply works fine, 2xAA batteries does not work either. So I’ve either got to ditch the DHT11 or redesign the circuit to incorporate a 3.3v regulator and use 3xAA batteries or maybe a boost converter on 2xAA batteries. Power requirements of the components are: