Wednesday, 25 June 2014

Temperature Twitter Bot

Twitter is an interesting thing. Share whatever you want, whenever you want. Twitter is cool and all but I don’t find much use for it until now.

I came across this project as you can see pretty weird but the idea itself is cool - automated twitter posts.

I took my Raspberry Pi and installed necessary files.

For my project I wanted to tweet my temperature, humidity, and air pressure. The main magic is done by the RbPi. The Arduino is connected via USB cable, meaning we have serial connection. The python script on the RbPi reads the data from serial and then tweets it. And it is as simple as that.

I needed to install couple of extra packages for python: pyserial and Twython.

Couple of lines of python and done.

To get the necessary authorizations: LINK

My code
import sys
import serial
import os
import time
from twython import Twython

ser = serial.Serial('/dev/ttyUSB0',9600)
while True:
cmd = '/opt/vc/bin/vcgencmd measure_temp'
line = os.popen(cmd).readline().strip()
temp = line.split('=')[1].split("'")[0]
posttemp = ('CPU temperatuur on '+temp+' C. ')

vaartused = (ser.readline().strip()+' C. '+ser.readline().strip()+'%. '+ser.readline().strip()+' mBar. ')




Thursday, 5 June 2014

Arduino Weather Box

Couple of nights ago I decided to mess with my Arduino. All of my sensors and displays had arrived so I decided to build something. All basically sensors that show different climate properties so I named it Weather Box – Go figure!

With Arduino it is as simple as the alphabet. Connect everything and then remember where you connected your things and of course you need the necessary Arduino libraries so your Arduino can talk to your sensors.

Alpha build/testing.


So what I have is Arduino Nano V3.0, BMP180 (pressure and temperature), Nokia 5110 display module and famous DHT11 (humidity and temperature sensor.)

So the idea was to display all of that information on that Nokia display.


So then I had an idea to make this into something permanent. For example make a case for it, making it portable. I had this case from some old project. For me it looked too bulky and weird. So using only the bottom half I decided to make a case.


[gallery ids="247,246,254,253,248,249,250,251,252"]


Everything in there is super crammed together but it works.

The 9v lead out of it is just for demonstration purposes. The case is so packed that it would not fit anything more.