Archive

Archive for November, 2009

Web based photo galleries – the unusable and the reasonable

November 16th, 2009 Ed 1 comment

So, after yesterday’s Pinewood Derby with funky racing traffic lights, I looked for a simple, quick photo album tool to display the photos, and stumbled on Piwigo, which looked reasonable and the whole “Simple powerful” philosophy seemed to match what I wanted. So, I downloaded the single php installer script, which automagically downloads the latest version and installs everything. So far, so good.

Now to actually create an album. Yes, pretty easy. Upload a file, not so easy, but doable. Get that file to be shown – next to impossible. This is the worlds most convoluted software I have ever seen! To get a photo to be shown, you first have to syncronise, then go and create thumbnails – but wait, by default the synchronise does a dummy run, so go back and tick a tick-box. Grr, really not usable. So, I tried looking at the documentation (which goes against my beliefs of websites should never, ever, need any help – they should be usable) and even that is appauling! It’s a wiki with a very poor navigation structure (if there is any structure), so impossible to find anything useful. Turn to the forums to find others having the same problem, and being told to read the instructions…

Right, rant over, software uninstalled.

Plogger was the next on the list, the demo looked clean and simple – just what I needed (PHP/MySQL based). Installed it in a couple of minutes, saw a test album had been created for me so uploaded a photo and job done – it was there! Then spent the next hour cropping and adjusting the photos, uploaded them, and bob’s your uncle, I have a nice and simple photo gallery for the scouts! The styling is very minimal, it’s designed to be part of a larger site, although there is one style that’s a little less minimal which I’ve gone for as there’s no “larger site” for this.

So steer clear of piwigo, and let me know if you have any recommendations…

Categories: Web Tags: , , ,

Scout racing lights – naturally arduino powered!

November 16th, 2009 Ed No comments

Inspired by techcobweb’s SlotCarDuino, the night before our scout group’s “Pinewood Derby” (cars made by the kids from a block of wood race down a track, powered by gravity), I decided to make a traffic-light system, and an indicator to say which car one (as there’s sometimes a debate)!

So, in between power cuts (6 days on the trot of less than 8hrs of power per day), with only a few hours of awake time before the event, I dismantled my home automation system (no loss, given there’s barely any power for the heating) and connected up the breadboard, ambient lights and a couple of wires that will act as trip wires. As there are no pull-down resistors, and I have absolutely no components, the trip-wire is connected to ground and then digital pin 3. Running digitalWrite(3, HIGH); enables the pull-up resistor, so whenever the circuit is complete (i.e. car hasn’t driven through the wire) it reads 0.

The way I made the trip-wire was to stick one wire over the track, and rest it in a small uninsulated loop of wire. A quick trip to the scout hut proved this worked, although was in serious need of some debouncing as the vibrations on the track caused the wire to jump around a little.

Simple but reasonable effective race switch

The main loop of the code is very simple, it reads the two trip wire readings, and if one changes it increments a winning counter. If that counter is more than 7000 (fairly random number that seems to work), it turns that lane’s ambient light green. After that happens, when the next trip wire is broken, the appropriate light goes red.

I stole the one component I did have, a switch, from the B&Q ambient light, and wired that up in a similar way to the trip wires. At the start of the loop, it checks this value to see if it has changed (the button is a normal switch, not a temporary push-button), and if it has changed (after some debouncing), it resets some variables, checks the trip-wires have been reconnected (and if not, flash the appropriate light), then runs the red-amber-green starting sequence.

The kids seemed to like it, and other than the odd dodgy connection, and a particularly streamlined car going under the wire, it worked perfectly!!

Next year will be a little more high-tech as I’ll change the trip-wires to some kind of optical sensor, and possibly have one at the start of the race so we can display track times, speeds etc. May even make an automatic releaser, we shall see…

Categories: Arduino Tags: , , ,

Ambient Light and Arduino boxed up and ready to rumble

November 12th, 2009 Ed 2 comments

One bitsbox order and a trip to buy some deodorant later, and my arduino is boxed up, and ambient light has a stand!

The cap off an addidas deoderant can makes a nice enough base for the orb from a B&Q disco lamp (no link as can’t find it online). I soldered the ends of some CAT5 to the BlinkM, and left the other ends loose to be shoved into the arduino.

As I’ve got an arduino and ethernet shield, I went for the second largest ABS box and even then, I had to break off the screw connectors on one side so that the plugs could stick through the outside. I soldered the AM receiver and transmitter onto a small piece of stripboard (also from bitsbox), added a couple of wires for aerials (with a knot in each to prevent someone pulling it out the circuit). So that’s pretty much the finished product, what a shame! I will add a thermometer to it so it can become a thermostat in another room – eventually this’ll go in the sitting room, so will have the current cost meter producing one temperature reading from the kitchen, this one in the sitting room, and have just ordered another arduino for my bedroom’s ambient light/thermometer/development board.

The java code has been working nicely, turning the heating on and off via the hacked home-easy plug! I sent a text from my phone to turn the heating on, very proud of actually finding a use for it as I was stuck in traffic but had friends coming round so the heating would have cut out at 5.30 (it heats up til 5.30, then waits for movement) – only to find there was a street power cut that has lasted 3 days (intermittently)! So, if the power holds up a little longer, I should get a tweet tomorrow telling me how long the central heating was on for, fingers crossed!

So, time to write the web interface, pretty dull :(

Home Easy Interrupts everything!

November 7th, 2009 Ed No comments

Ok, so all the parts of the arduino code work fine – just not all at the same time! The setup is as follows:

An interrupt procedure gets the home easy (HE) signal, and sends it to a callback function. This converts the sender/recipient/state into strings, and then publishes the data to MQTT. Problem with this is it takes time, and may be interrupted by the next HE signal. This problem is exaggerated by the HE motion detectors, which send about 15 on/off messages one after the other. When this happens, MQTT is interrupted and it leaves the arduino in a very strange state – loop() is paused, and nothing happens until it receives another HE signal, which kicks the arduino back into action – but by that time, any signals like “turn off the central heating” will be lost, so my energy efficient house becomes boiling hot!

So, after lots of hitting my head against a wall, my solution is to add the data to a global “string”, and then in the loop() method, to read this string, split it up into the MQ topic and the data to send to it, and then send it. I have found the WString library crashes the arduino, so it’s all done by manipulating individual characters in the array. Really missing the simplicity of Java!

And there are more problems…

Read more…

Get number of unread posts from google mail

November 1st, 2009 Ed No comments

Here’s a simple bash script that gets the number of unread messages, and runs a command that does something with that. In my case, a java program that puts a message on a MQTT topic, which indirectly flashes an ambient light.

#!/bin/bash
while (true)
do

rm atom
rm atom_process

wget https://gmail.google.com/gmail/feed/atom --user=XXXXX --password=XXXXX 2&>1  /dev/null

cat atom | grep fullcount > atom_process
count=`sed -n -e 's/.*>\(.*\)<.*/\1/p' atom_process`

java -jar /home/ed/rrd/MQTTRunner.jar mpc_google 3 $count
sleep 60

done

Categories: Web Tags: ,

Arduino Central Heating Control (Home Easy Hack)

November 1st, 2009 Ed No comments

Firstly, I have no qualifications in electronics, I do not totally understand all the different types of central heating programmers, so I accept no responsibility for you screwing up your system. As I don’t have proper central heating cable, I the colour coding is way off – there are no earth wires, despite the pictures showing earth-coloured wires. This is safe – neither the central heating programmer nor the home easy device need earths, so I use the earth wires as control lines.

However, with that over… I’m on a quest to automate my home with arduinos, and central heating is something that “needs” automating. Yes, I could buy a Home Easy central heating controller for £75, but I already have three plugs and in all honesty, nothing to do with them (yet). After reading an article at instructables, I decided to do something similar but hopefully a lot easier. The final result I aimed for was to have my usual central heating/hot water programmer running as usual, but have the home easy plug sitting between it and the pump/boiler so I could make it act like a thermostat. Then, by leaving the central heating on 24×7 on the programmer, I can take full control over it via arduinos and an AM transmitter. Naturally you could use any home easy remote to control the heating as well, but that’s not very exciting! As I’m prone to playing, I also want to be able to bypass the home easy device and let the programmer work as usual – just in case the code/hardware fails!

Read more…