So time for a new patio and drive.
The build as it evolves…
A number of projects have been created to log sensor data from various things such as temperature or server availability etc. One of the most popular ways has been to use the cosm website or to write to google docs. In a previous experiment I used mrtg to create graphs on my own web server. So having a spare raspberry pi and a bunch of scripts from other people I hacked it all together… Some example graphs:- The first one is my router throughput and the second is a temperature sensor
I’ll start with simply gettung mrtg to run on the Pi and then show how to log other things. Currently I’m logging two different temperature sensors, pressure, humidity, ping response from 2 servers and my adsl router usage. First step is to install apache web server and mrtg. This post may help sudo apt-get install apache2 php5 libapache2-mod-php5 type “sudo groupadd www-data”, then Then install mrtg. Amongst the other web sites, this one provides a lot of hints and tips. Sudo apt-get install mrtg Create the mrtg work directory Sudo mkdir /var/www/mrtg You will need to enable snmp on your router and change the community string from public to a more secure value. In this case we will use ‘community’ Assuming this is done then create an mrtgconfig file. Replacing the ip address below for yours. sudo cfgmaker –output=/etc/mrtg.cfg –global “workdir: /var/www/mrtg” community@192.168.0.1 This looks at the snmp mibs in your router and creates a standard cfg file. Next we need to create the html file to display the graphs. Sudo indexmaker –output=/var/www/mrtg/index.html /etc/mrtg.cfg Finally we need to set a cron job to refreshh the graphs every 5 mins. Edit the cron file. Sudo nano /etc/cron.d/mrtg To add the line */5 * * * * root env LANG=C /usr/bin/mrtg /etc/mrtg.cfg >> /var/log/mrtg/mrtg.log This line may already be configured by MRTG. Essenstially it causes MRTG to run every 5 minutes and read the config file /etc/mrtg.cfg. The graph will then be output into the /var/www/mrtg directory where it is then displayed precio del viagra using thr /var/www/mrtg/index.html file. MRTG can be used to graph many other data series. All it needs is 2 values output to the screen. So a simple script for the temperature sensor just needs to return two values. e.g. the command:- sudo ./bmp085.py 11 4 # read temp 0 24 MRTG would then plot the two series as 0 and 24. In my example only 1 value is significant as the sensor only provides temperature. Another example may provide temperature and humidity. e.g. sudo ./dht11 11 4 24 35 MRTG can then plot the two values on the same graph. To plot ping stats for an IP address i installed mrtg-ping-probe. This just returns a couple of values. e.g. mrtg-ping-probe 192.168.0.1 24 133 In order to get mrtg to add thes feature we need to add another element to the config file A sample cfg file… Target[temp2]: `/home/pi/bmp085/bmp085.py` MaxBytes[temp2]: 100 YLegend[temp2]: Deg Legend1[temp2]: . Legend2[temp2]: . Legend3[temp2]: . Legend4[temp2]: . LegendO[temp2]:Events LegendI[temp2]: ShortLegend[temp2]: Temp Title[temp2]: Temp2 Options[temp2]: gauge, nopercent, integer, unknaszero Colours[temp2]: GREEN#00eb0c,BLUE#0000ff,GRAY#AAAAAA,VIOLET#ff00ff WithPeak[temp2]: ymw PageTop[temp2]: <H1>Temp2</H1>
I had to get one. So i got two! The first one is just running XBIAN (XBMC). For those that dont know this is a media centre and with a few plug-ins such as TVCatchup it hangs off th eback of a spare HD TV and streams some free TV channels. I also discovered i can send any media on my phone to this setup as well. The second one is more for playing around with. At the moment its running a NAS drive for backups and music etc. Theres plenty of help for this on the net at http://elinux.org/R-Pi_NAS and it works quite well. I’m also playing around with bluetooth. I discovered this site http://www.dreamgreenhouse.com/projects/2012/rpibt/index.php . I followed it more or less. I tried using it on Arch linux but this wouldnt find any devices so i installed Raspbian and it worked. I then mashed up a couple of scripts to send an email whenever the Pi scans and finds another bluetooth device in range. I used this script to scan for a bluetooth device #!/bin/bash if hcitool scan | grep “:” > string then /home/pi/sendit.sh else echo “failed” fi The second script is a small python script to send an email. Its not pretty but it works and send the contents fo the file “string” which is the BT or MAC address of the devices found in the scan. #!/usr/bin/python import smtplib import sys message = “””From: Pi from@email.com To: Home destination@email.com Subject: Bluetooth Alert “”” bluetooth = open(‘string’, ‘r’).read() mssg=message+bluetooth server = smtplib.SMTP(“mail.server.com”) server.ehlo() server.starttls() server.ehlo() server.login(‘from@email.com’, ‘password’) # print message print bluetooth server.sendmail(‘from@email.com’,’destination@email.com’, mssg) server.quit()
It’s a year since I decided to start running again. About this time last year i found myself enterred for ‘The Run 10’. I had previously entered The Run 09 but had to drop out due to a torn calf muscle. I hadnt trained for a while last year and managed to go round in 1:05. I’m hoping to beat that and ideally make jt I’m under an hour. I have beaten an hour on my last 2 10k runs but the weather is likely to make that a real challenge. But I’ve run more or less 500 mikes since last year so I should do better …. The one fly in the ointment… 26 degrees! Hotter than July … Well it was warm alright. I managed 59:57 pretty close to the hour lol. Ther were over 1500 finishers which made it pretty crowded at the start and finish. After months of searching I finally managed to get s new coffee machine. I’ve been searching for a bean to cup machine so I can chose espresso or make my own latte etc. The machine is a Delonghi esam4200 and it’s so cool. Fill up with water and beans and just dial the strength and quantity. Press the button and off it goes 🙂 It seems to go from cold to americano in the same time it takes the kettle to boil. It even cleans itself on switch on and switch off! Some nice goodies. Caramel shortbread and cherry and almond slices! Trying to run a half marathon in my birthday 17/7/2011. Not sure I’ll make it but my runners pack arrived so I’m getting nervous! The route is now published here. Only 2 days to go! 343 miles this year in training and the weather is going to be cool with some rain. Perfect for me. Race day Update!
The dedicated few took part in the warm up while we connected up our Garmins and iPhones. Being first timers we lined up with the sub 3hour marker. It wasn’t long and we were off. The first 500 yards was along an estate road but then we turned onto pathway’s. This was quite crowded and until 3 miles it was a little bit challenging. So the question I still feel uncomfortable answering is… Am I s runner or a jogger? It’s always nice to visit Deddington farmers market. the whole village comes alive and naturally the church get in on the act too. The church put in a coffe and biscuit stall as well as a few local craft stalls. The result is a very pleasant day. The produce is all local and pretty high quality and I can never resist a nice joint of beef |