• The timeline of the Sydney Siege

    Watching the live news feeds of the Sydney siege, it soon became clear to me that a proper timeline of events leading up to the police raid needed to be done.

    So the day after, I grabbed as many TV news feeds as I could. I then went through each of them in an attempt to work out when each critical incident occured.

    I posted this on Twitter a few days ago, but I thought I’d write it here for a more permanent recording of it.

    The times (seconds in particular) are slightly different (3-4 seconds) on each transmission feed, due to the various delays that occur in any live transmission.

    2:04:00am - There is a sound of a gunshot, mentioned by a reporter on the scene. It can also be heard in one of the TV feeds. 2:04:02am - Seconds later, six people escape the cafe.

    Not much really happens after that for about 7 minutes, until the reporters on the scene report hearing another gunshot.

    2:11:16am - TV Presenter on 9 says there is news of “another bang”. It’s noted that it sounded very familair to the gunshot at 2:04:00am. 2:11:39am - Another hostage escapes. It’s likely that she’s a staff member.

    2:14:21am - Cops start the assault on the cafe, breaching the doors and going in.

    By my maths:

    • 17 hostages to begin.
    • 5 escaped that afternoon
    • 6 escape at 2:04am
    • 1 more escapes at 2:11:39.

    That left 5 in the cafe when the police went in.

    After the time of what is reported as the first gunshot at 2:04am - it’s 9 and a half minutes before the police are in the cafe.

    Additional times:

    • The shooting/explosions ended around 2:14:56am, about 35 seconds after the cops went in.
    • Interestingly, at 2:17:14am - about 2 minutes after the first lot of shooting - there’s another round of explosions of some sort. It seems like many of the police outside weren’t expecting it, because they all duck/take cover pretty quickly.

    Note:

    • The times are taken as best I could from the transmission feeds of all the major networks - 24, Sky, 9 and 7.
    • The News24 feed I used is exported from the transmission log, which has a timestamp burnt into the vision.
  • A week with Phant

    I’ve written a bit over the last week about Phant, SparkFun’s data storage service.

    I just wanted to write a quick update on how it’s going.

    image

    This is a screenshot of the ever reliable service taking data from my temperature and light sensor. Currently, the light sensor is between 444 and 447. That means the main lights are on (that’s how it’s set up at the moment).

    The temperature is supposed to be between 144 and 146. The 173 is a little odd. The Arduino does that from time to time, but I don’t know why.

    Random1 is the version of the code running.

    Random2 is currently reporting 1. That means the lights are on (according to simple code on the transmitter)

    if (LightReading < 650)
    {
    	LightStatus = 1;
    }
    else 
    {
    	LightStatus = 0;
    }
    

    Not very exciting or clever, but it’s creating useful enough test data.

    So far Phant has proved very, very reliable. Data is being submitted once every 11.5 seconds. There was a slight problem a day or so ago, but I think it’s with the Ethernet shield, because the problem was fixed as soon as I reset it.

    Next, I need to write a program (likely a web app) that takes the data from Phant and processes it into useful information.

    EDIT: SparkFun is having a sale until the end of the month, with 15% off sensors that could be used for with its Phant service! Cool.

  • Eagle and PCB design

    I’m currently trying to learn how to make little PCB boards in the computer via Eagle, so I can use OSH Park to print them (or via an interesting looking Aussie company Bread Board Killer)

    Anyway, these YouTube tutorials were really helpful.

    I’m yet to watch this one, but I’m sure it’ll be as helpful as the first two.

    (This page is really just here for my reference. I’ll likely need to come back to these soon, so why not just publish them on the blog?)

    EDIT:

    I watched this last night too, and it was good. It goes through it a lot quicker, but it’s still useful.

  • Sensor Project - A small success

    I’ve been trying to create a bunch of little low-powered sensors for a month or so now, so I can use them to track various metrics around my house.

    I want to measure simple things like when the light is turned on/off, what the ambient temperature is, the times of doors opening and closing, etc. I also want to install a little sensor on my electricity meter so I can “count” the “pulses” (i.e., count the time it takes for the little wheel to go round - from this you can work out the amount of electricity usage across the day).

    Of course, having sensors measure things is one thing - getting the data is just as important.

    It was a very lucky coincidence, but the other day SparkFun released an awesome little service that is perfect for what I want. I’ve written a little bit about it here. Incidentally, I’ve also expanded my PHP class, PHPePhant, since then too.

    Anyway, on the sensor project, yesterday I had a very small win. I’ve not got a transmitter and a receiver - and amazingly, both are working!

    The transmitter sends data from two sensors - a light sensor and a temperature sensor - across the room to my receiver. That then pushes the data up to SparkFun. From there, I can plot the various changes in values.

    The links above will take you to the GitHub repositories where the code is. It takes two arduinos, one with an ethernet shield.

    There’s a lot more I need to do. Firstly, I need to introduce more sensors into the network. That way I can have multiple sensors around the house doing different things. Secondly, I want to investigate the use of a better radio transmitter. I’m using a very simple one at the moment that only sends data one way. It’d be nice if I could mesh them in some way, or at least have a two-way radio channel. Thirdly, I need to condense them down from a breadboard into a more permanent solution. I might start with a simple single-sided copper PCB prototype board, and once I’ve done that learn how to make a PCB board in Eagle and send it off to a manufacturing house for printing!

  • Arduino, an Ethernet shield and Phant - A quick howto

    Last night, my Arduino Uno Ethernet shield finally turned up.

    I’ve been waiting for it to arrive for a while, as it’s the key part of my little system to log and store sensor values from around the house.

    I was playing with the Ethernet Shield last night, and I found it a little hard to get the damn thing to send a simple POST request to the internet. It turned out the problem was that while I was assigning it an IP address, I didn’t tell it about the router’s gateway or DNS information - so it’s likely the requests weren’t getting though.

    In any case, it works perfectly now and every 10 seconds a request is being sent - and stored - by Phant over at data.sparkfun.com.

    It’s just random data at the moment, but it shouldn’t be too hard to connect up the sensors to the Ardunio and go from there.

    The reason I’m writing this post is really just to log and document an early version of my code. I have a bad habit with the Arduino of writing code and solving my problem, only to lose the code and have to start again. I reckon it’s down to the way that the IDE forces you to store the files in certain places.

    Here’s the receiver code, in a GitHub repo - you’ll need to include a public and private key of your own.

    Here’s a quick walk-through of the code in case you’re trying to get the Ethernet working with Phant in a really simple way.

    Include all the fun stuff, making sure to include your public and private keys.

    #include <SPI.h>
    #include <Ethernet.h>
    #include <Phant.h>
    
    char server[] = "data.sparkfun.com";
    Phant phant("data.sparkfun.com", "public_key", "private_key");
    

    Set your network details:

    byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
    
    // the dns server ip
    IPAddress dnServer(192, 168, 1, 254);
    
    // the router's gateway address:
    IPAddress gateway(192, 168, 1, 254);
    
    // the subnet:
    IPAddress subnet(255, 255, 255, 0);
    
    //the IP address is dependent on your network
    IPAddress ip(192, 168, 1, 23);
    

    Then, you need to create an instance of the ethernet class. The “client” bit, as you’ll see below, is what the code uses to send data out.

    EthernetClient client;
    

    In the setup loop, you should start it all up. The bottom line in will display the IP address. In my case, it is 192.168.1.23.

    //initialize the ethernet device
    Ethernet.begin(mac, ip, dnServer, gateway, subnet);
    
    Serial.println(Ethernet.localIP());
    

    From here, I split the actual sending to data into another little function called “httppost”. I do this for the simple reason of keeping everything tidy.

    The loop is:

    void httppost()
    {
      if (client.connect(server, 80))
      {
        phant.add("light", "Random Numbers:");
        phant.add("random1", 1);
        phant.add("random2", 2);
        phant.add("room", 3);
        phant.add("temp", 4);
        client.println(phant.post());
      }
      else
      {
        Serial.println("Nothing happening...");
      }
    }
    

    What this is doing is using the Phant class (provided by SparkFun) to collect the data and then in phant.post() create a sting that the Phant service uses to store/log the data.

    In the example above, the fields are: light, random1, random2, room and temp. I’m just using random data at this point, but they could be anything - sensor values, strings, etc.

    Finally, the bit that gets it all working is in the loop() function:

    Serial.println("Starting...");
    httppost();
    Serial.println("disconnecting.");
    client.stop();
    delay(10000);
    

    This will just display Starting... in the serial window, then it will call the httppost() function I talked about a little earlier.

    The key bit I needed to add to make the whole thing work though was: client.stop();

    That stopped the request, so after the 10 second delay and when the loop started running again, it would then start the client.connect(server, 80) process over again. In this case, the “server” part is defined at the top of the script - it’s data.sparkfun.com.

    It was all a bit confusing at the time, but it mostly makes sense now. This may not be the best way to go about it though, so if you can see any errors (there’ll be many) or want to suggest improvements - let me know in the comments below.

    Creating a network of sensors and transmitters

    Now that’s done, the next step it to program the receiver to parse the incoming strings from the transmitters. They include a string (of sorts) which will include the data.

    The radio payload looks a little like this: S:1#L:%i#T:%i#R:%i#C:%i

    There’s lots of hashes, %i, and things in there, so to break it up, S is sensor number, L is light value (from a photo resistor), T is temperature, R is random (likely replaced down the line), C is count (to try to work out if I am missing packets).

    In reality, the packet may look like this: S:2#L:555#T:234#R:123#C:232

    So I don’t lose it all, here’s the early transmitter code, in a GitHub repo.