Archive

Posts Tagged ‘home easy’

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…

Two-way communication via Nuelectronics ethernet shield…

October 30th, 2009 Ed No comments

…is possible, and does work – but only sometimes.

I struggled last night for several hours trying to get reliable two way communications. The idea is that every time the arduino receives a home easy command from a remote or motion detector, it sends a message to the MPC-L. Then, with some funky programming, the server will decide what events to fire off.

Unfortunately while I can reliably receive messages, and reliably send messages, I can’t do both – it just hangs. I’m thinking it’s the nuelectronics ethernet shield, the software certainly isn’t very nice, so as I’ve only been playing with this for a few days, I’m splashing out on an official shield. As a by-product of this, it is supported by Nicholas O’Leary’s MQTT code. So, moving away from last night’s PHP start, I’ll write a small java program to receive these, process them, and fire off any events if need be.

The logic for the event firing will end up being more complicated, but initially, I want a bunch of events/desired actions, and each event has a sequence of signals required, each of which have to happen within a changable amount of time. Only if a path through the sequence is achieved in the right time will the action be fired.

For example, a motion detector in the hall, and a door open/shut detector on my front door. An event (i.e. turn off all lights) with a sequence of 1. Motion detector fired, 2. Door opened will detect when someone has just left the house, but obviously you only want it to happen if the time between 1 and 2 isn’t too much, otherwise the person could have walked upstairs and someone else came in through the front door!

I got this working in PHP, so will Java-it-up tonight. Then will code the more complicated (and more useful) central heating logic (i.e. I want the house at 18 degrees at 7PM, it’s now 16 degrees, and takes 45mins to warm up to 18degrees, so turn on centreal heating at 6.15PM).

AM Transmitters Arrived

October 28th, 2009 Ed 13 comments

Farnell delivered two packages, ordered at 4PM, the next day via UPS – very impressive, must have costed more than the £8 it cost me (free P&P).

So, with the help of the arduino playground and homeeasyhacking, my arduino could receive and transmit home easy messages.

Prototype

The photo shows my prototype of all parts of the project (ambient light – bit of paper coiled up, will be improved soon – and home easy controller).

Wire the data line of the receiver (any of the two work on my receiver) to pin 8, and the data line of the transmitter to pin 6, and connect power/ground/aerials accordingly (I haven’t used an aerial for the receiver yet). A 23cm piece of wire works well as an aerial. All my cables are strands from CAT5 – I’m a cheap-skate!

To use the following code, first download the HomeEasy package from homeeasyhacking, add the .h and .cpp file (Sketch > Add File), then copy and paste the following code. Upload it, then start the serial monitor.

Press a button on a home easy remote and you should see the sender code – copy this, and replace “2427994″ in the code below with yours. Then restart the program, and whatever you programmed the first button on the first slider of the remote should turn off and on. Make sure, unlike me, you haven’t plugged your computer into that device – I eventually got the code working only to kill my computer’s power, oops!

To control another device, change the setHEDevice(0) line.
Read more…