Category Archives: IoT

It’s still winter …

Last week just as we were getting used to sunshine again the weather reminded us it’s still winter. Sitting in a meeting Thursday afternoon hearing the wind and rain crashing around the building I pulled up the weather feed and you can see when it really hit. Screen Shot 2014-07-31 at 4.25.29 pm
This shot is from about 4:25pm. Temperature dropped about 10 °C in an hour. You can see the humidity shot up too with the rain.
This morning we woke up to a coating of frost on everything, and the weather station told me that despite the bright sunny morning it was -0.4 °C outside. Guess there’s still more days to go skiing this season!

 

New weather feed online

The new Xively feed is here:
https://personal.xively.com/feeds/1558166025

Data being logged is:

  • indoor temperature
  • indoor humidity
  • outdoor temperature
  • outdoor humidity
  • air pressure
  • total rainfall (since the weather station was set up)
  • light levels (on my study desk, but will be outdoor soon)
  • wind speed, gust speed and direction

The iPhone app simply creates a list of the elements in the datastream, so it is consistent. I also figured out how to display the units in the app.

Putting it all back together

After merging the XC0348 code I had which was receiving the data transmitted by the outdoor sensors with the Xively code there was a bit of tweaking to do to get the sketch to play nicely. The last step was to add the code back for the pressure sensor. This was problematic as the sensor uses I2C and soon as I added the Wire library the whole thing stopped running properly. After some reading I wondered if I was just running out of memory so I commented out a whole lot of serial print statements and it this got things working again. Of course, without the print statements there was a whole lot less debugging going on.

A couple of things that still need attention:

  • the pressure sensor has been timing out often, so I get false values where a negative error code is returned. I’ve increased the timing loop and am seeing if this works better
  • we had a heap of rain overnight and my rainfall figure suddenly dropped because I was only using the LSB, and the count had overflowed. A bit of trial and error and now it is showing the true total. A problem with rainfall is that the sensor reports total rainfall, so this will just keep going up and up. I need some way to keep daily totals. Perhaps I need to add a real time clock?
  • my light values are related to the resistance in the photoresistors, so the curves are inverted i.e. when it is light the value is lowest FIXED Apr 10 – I chose an arbitrary dark value of 1000 and am using that as a reference point to subtract from, so now a bigger value does mean more light rather than more dark!
  • wind direction is returned as an integer between 0 and 31, which seem to correspond to 16 compass points. I think there might be some sort of moving average calculation used by the base station to reduce errors due to rapidly fluctuating wind shifts.

Belkin WeMo

ImageJust picked up one of these Belkin WeMo switches to try out. I wasn’t worried about the motion-sensing switch version, just the plain single outlet. On opening I expected to find more complicated setup instructions, and thought I would have to set up port forwarding on my router so I could control it over 3G from the phone. Considering the average home user wouldn’t know how to do this, I wondered how they would make this easy to do. However, it doesn’t work this way.

Anyway, it was incredibly easy to set up:

  1. Plug it in. I plugged in a reading lamp as a test. The LED alternately blinked blue and orange. I tried the manual switch and the lamp turned on and off.
  2. Download the WeMo app from the app store. Launch the app, then it asks you to go into Settings to join the phone to the WeMo’s local WiFi network.
  3. The app begins setup and once finished, the single remote switch appears in a list view.
  4. That’s it! At this point you just hit the button in the list item and the light turns on and off.
  5. The app notified that a firmware update was needed, which installed with no problems.

Image 1So, first experiences are favourable. I’m still curious as to how remote control works from outside the WiFi network. I am assuming that the device must be sending requests out to a server somewhere and polling for state changes.

At the moment I’m probably just going to use it to switch the Christmas lights (when they actually get set up). This saves me going outside or down to the garage to switch the powerpoints off. We do have some old-style mechanical timers around but this is far more fun.

Belkin also publish an SDK for WeMo, which is a nice change considering that most manufacturers have no interest in making their devices open or interoperable. Building the demo app for my iPhone immediately finds the configured WeMo outlet and I can switch it from the iOS simulator. I do wonder what security implications this may have, but assume that only devices recognised by my local network can control the WeMo switch. Some testing may be required.