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:
DS18B20 : 3.0-5.5v
DHT11 : 3.0-5.5v (flaky at ~2.7v)
nRF24L01+ : 1.9-3.6v
BMP085 : 3.0-5v
Update 2: I’ve been experimenting and I think I’ll go with 3xAA batteries (my rechargeables are 1.35v fully charged, not the usual 1.2v it seems) and a diode with 0.7v forward voltage drop on the RF24.
I’ll have to change the BMP085 wiring to use the 5v pin instead of the 3.3v as the 5v pin seems to work fine down to 2.9v and certainly handles the 4v approx I’ll get from three batteries, either that or put a diode on the 3.3v pin of the BMP085 too!
It would be easier just to use a voltage regulator, but that would require 4xAA batteries (as you need at least 3.3+1.2v) which seems like overkill. I can’t find any 3.3v boost converters that are just DIP chips, they all seem to be breakout boards.