The CDC Website

Mapping My Domain Name

WordPress is now my friend! Having initially setup a blog using WordPress for another assignment it made sense to use it again for this project. This time I decided to host it on my own (paid for) server with 1and1 and map my domain name to it. My original intention was to have a URL that used either a sub domain or sub directory – cdc.jakestrickland.co.uk or www.jakestrickland.co.uk/cdc – to link to this site. My main domain name ‘www.jakestrickland.co.uk’ will link to my new personal site that I intend to build once I’ve handed in this project. Having looked into this idea further I went down the route of building a ‘WordPress Multisite’ installation. I often create simple sites to showcase work to clients using a subdomain as a link. So Multisite made sense if I was going to manage multiple WordPress projects. Alas this the led to three days of fruitless coding and configuring that got me know where. Changing a WordPress URL for a site is well documented but none of it seemed to apply to my installation. Redirecting a domain or subdomain using my 1and1 control panel is something I’ve done several times but nothing worked on this occasion. Normally I’d simply point the domain at the main WordPress directory and then change the ‘SiteURL’ and HomeURL’ within WordPress’s settings page, but these were greyed out. Then I was advised to edit ‘PHPMyAdmin’ – but just added my domain name to the end of the installation URL (digitaltwit.apps-1and1.net).

Several emails and an hour on the phone didn’t solve the problem but 1and1 said they’d look into it and get back to me. Which they did and now www.jakestrickland.co.uk and www.jakestrickland.co.uk/cdc  points to the static home page of the CDC project website. 1and1 also said they’d send me documentation on the process they used to make this work, which at time of writing I’m still waiting for. They also advised against using Multisite, which I don’t agree with, but once the documentation turns up I’ll have a better idea of what’s going on and how much it related to 1and1 specifically. In the mean timer my old, personal website is now mapped to a subdomain – mywork.jakestrickland.co.uk

Hemingway Theme

The Hemingway Theme designed by Anders Noren is a simple, clean, free template. It employs a bit of parallax functionality, the header rolls away as you scroll down. The title in the header used a black, block background that spoilt the header image I wanted to use so I edited the code to introduce some transparency.  I choose not to put the tag cloud, recent posts or search bar on the side of the static home page. I wanted this landing page to use more width. These links are in the footer and on the right side of the blog pages.

By default the template places a 1px border on pictures. As I wanted to overlay some images on block-quotes so I used ‘Inspect Element’ to find the line of code (style.css line 964) to remove the border. I could have made a specific DIV Class for the ‘Attributes’ page, so borders were retained else where, but decided this wasn’t necessary as I liked the cleanness of the images without borders.

Plugins

1&1 WP Wizard was used for the installation. This may have caused me more problems than it solved, waiting to hear back from 1and1 about domain mapping. Once this assignment  is marked I may start again with a fresh install.

WordPress Importer was used to migrate my existing blog on Goldsmiths igor server. Worked on the most part, left a fair bit of media behind. Not a bad solution if you’re blog has been long running and full of comments.

GRAND Flash Album Gallery has some cool features for displaying images galleries. I stopped short of paying to remove the branding, wanted to get some feedback from users on difference devices before I commit to permanent use.

SyntaxHighlighter Evolved allowed me to paste code into a blogpost while retaining syntax highlighting and line tabs. When this project is complete and ready for distribution all code will be available on Github. I edited ShCore.css file so I could reduce the height of the window the code appeared in and introduce a vertical scroll bar. Although this worked it did add space on shorter windows. I’ll need to dig a bit deeper, probably need to set a minimum and maximum height so I don’t have to set the height in pixels to invoke the scroll bar. Also need to look into why the line tabs aren’t as clear as I’d like.

WordPress SEO by Yoast has directly influenced my writing. The simple but comprehensive traffic light system means I’m always making sure the blog’s title, first paragraph, keyword and meta data contain the same word/s. Even the writing style of a post is examined using the Flesch Reading Ease Test! Having set up this blog with a new host and URL I’m already receiving Spam comments so something is working!

Sheffield Pi Station

Albeit a chat in my local inspired me to build the Creekside Weather Station, the Sheffield Pi Station was the proof it could and should be done. As documented in the blog, the Python script and associated modules used a different sensor, I’m now in the process of trying to adapt it to work with the Dallas DS18B20 and 1Wire – i2c bridge. I have contacted the Romilly Close, an undergraduate Aerospace Engineering student at the University of Sheffield, but haven’t heard back yet.

Raspberry Pi

A phenomenal bit of kit. Aimed at education it seems to have inspired all ages and all types of projects. I’m using Model A Revision 0007 running Debian GNU/Linux 7.8 (wheezy). If and when I install this weather station at other sites I’ll upgrade the Pi so it will have a better chance of being supported in the future.

OWFS

1wire i2c Host Interface

1wire i2c Host Interface

The One Wire File System and the 1Wire to i2c host interface is described as:

The 1-Wire® port is based around a DS2482-100 I2C to 1-Wire® bridge device. The DS2482-100 provides bi-directional protocol conversion between the I2C port on the Raspberry Pi and any attached 1-Wire® slave devices.  An ESD Protection Diode is used to protect the 1 Wire Pi and Raspberry Pi from electrostatic spikes on the 1-Wire® port.  Connections to the 1-Wire® port can be made through the RJ-12 socket or the solder points on the PCB.

The idea being this device would allow me to add multiple sensors to the Pi via the RJ12 socket. Provide 5v power to the sensors and protect the Pi from spikes. Following these instructions I installed the OWFS. As documented in the blog, this simple bit of Python code printed the temperature reading from the sensor:

# owtemp.py. This script prints the measured temperature in C and updates every minute.

import time
import os

file_name=os.path.join("/","mnt","1wire","28.AF6A9E050000","temperature")

while 1:
    file_object=open(file_name,'r')
    line=file_object.read()
    print(line+'C')
    time.sleep(5)
    file_object.close()

This code reads from the Pi’s ROM as apposed to an actual file. At this stage in the project I have tried to add some code to this script so it would write the temperature to a csv file that in turn could be uploaded to Google Sheets, or an equivalent service, but without success. I’ve also tried to use the same path as detailed above to another scripts but this too has proven difficult.

Maxim DS18B20

The Maxim DS18B20 is an inexpensive waterproof 1Wire compliant temperature sensors.

DS18B20 Waterproof Sensor

DS18B20 Waterproof Sensor

Each DS18B20 has a unique 64-bit serial code, which allows multiple DS18B20s to function on the same 1-Wire bus. Thus, it is simple to use one microprocessor to control many DS18B20’s distributed over a large area.

Bosch BMP180

Bosch BMP180

Bosch BMP180

The Bosch BMP180 air pressure and temperature sensor was part of the Sheffield Pi Station project and supplied and supported by Adafruit. Adding in my keys for Plot.ly and the MET Office I was able to successfully upload readings to both services at regular intervals. I could have weatherproofed this sensor but as outlined above, the 1Wire system would allow multiple sensors in series.

Plot.ly

Plot.ly is “the easiest way to graph and share your data.” Part of the Sheffield Pi Code it certainly did prove easy to use with good templates and graphs. I’ll certainly be using the service again in the future.

Met Office

Creating an account with the MET Office was also part of the Sheffield Pi Station project. Seeing my readings published on their site was the first real sense of contributing to a wider dataset. Curiously the MET office want temperature readings in Fahrenheit so the code has to convert the sensor readings from Celsius. Roughly speaking you can -30 from the fahrenheit reading then halve the result.  The DS18B20 sensor displays temperature readings to 4 decimal places which isn’t compatible with the MET office graph plotter. For the main project I’ll have to either change the sensor settings to two decimal places or change the script so it uploads the reading with only two decimal places. The latter being preferable as I’d like the raw data to be as precise as possible. Large bodies of water don’t change temperature quickly so four decimal places could prove to be a useful data point.

SQLite Temperature Logger

Another approach I’m trying is to build an SQLite database on the Pi. The more sensors I employ the more a database makes sense. The finished installation shouldn’t, in fact couldn’t rely on the Pi’s memory card for data storage on a long-term basis. I successfully followed this guide by Steve Breuning but I haven’t had the chance to interrogate the installation yet.

Github

I’ve uploaded the original Thermo Station Python script, my edited version and the script that could read the temperature from the DS18B20 via the Pi’s ROM to my github account. I’ve been in touch with a few people and sent them the link to see what help they might provide.

Miscellaneous

I considered posting all my search results for the project. Its a vast collection of project sites, schematics and code references, a great example of the web and all it’s wonders. But a lot of this is what anyone would do. Can’t praise Evernote highly enough, used it for years and again it’s been invaluable. I do have Text Wrangler Dreamweaver installed on my two main machines but  Sublime Text 2 has been my code editor of choice. Free and easy to use I will be donating. Transmit has been fantastic for accessing and editing remote files over FTP, SFTP etc. It’s not free but worth every penny. Terminal is a built in utility that I’m now more confident with than ever. I’ve always preferred keyboard shortcuts to using a mouse, with Terminal commands I’ve taken this to another level. Must give a nod to AutoMator as well. A powerful little utility that comes with Mac OSX, I’ve written several scripts using it’s drag-and-drop interface that have proven to be timesaving again and again. Batch renaming or resizing of files being the most frequently used and shared for that matter.