Links

Ben Laurie blathering

27 Nov 2010

Fun With Freeduino

Filed under: Arduino/Freeduino,Sustainable Energy — Ben @ 16:43

As I may have mentioned before, I have a place in Wales. That place is pretty primitive, we have a solid fuel heating system, otherwise known as a Rayburn, and until recently the extent of the control systems in the whole house was a thermostat strapped to the hot water tank. When the temperature hits the set point, a pump switches on, which pumps the hot water round the radiators instead.

I did consider adding a second thermostat for a while: if you let the Rayburn get overexcited it can boil the water in the convection system before the hot water tank is up to temperature. This is pretty exciting to be in amongst, the whole place vibrates and clanks. So, I mused about putting in a second thermostat that monitored the temperature of the pipes and switched on the pump if they got too hot. But then I learnt to control the Rayburn better and it has become a non-issue.

But anyway, the prospect of a house with basically no control systems in it has me thinking about building my own: something I’ve long wanted to play with. So, I started looking at the Arduino. I have read that Arduinos are not actually completely open (I believe their PCB design is not, even though everything else is), but in any case, Freeduinos seem to be cheaper, and completely compatible, so I got one from an outfit called nueletronics.

It turns out that there’s a package based on Processing which lets you very easily write and upload C/C++ code for the board, available from the Arduino site, so step one is obviously to write some code to do stuff with the LEDs on the Arduino board. I won’t bore you with that, since the source comes with the Arduino software.

Of course, that’s only fun for a short while, so I had to move on to something relevant to Wales. My first thought was to measure temperature, and perhaps do something about avoiding freezing when we’re not there. In a past life I played with 1-wire devices from Dallas[1] so the natural choice for the thermometer was a Dallas 18B20, also available from nueletronics, as it happens. It turns out that you need a 4.7 kOhm pull-up resistor for the parasitic power, so I bought some of those from eBay (amusingly buying 100 costs the same as buying 10, it seems, so of course I bought 100 – the cost was something like 1p each). Then I needed something to connect it to the Arduino, so I also bought a prototyping shield (shields are what they call daughter boards for the Arduino) and a breadboard, also from eBay.

Then I realised I’d need to communicate the temperature to some more serious machine, for recording/monitoring purposes. So I also bought an Ethernet shield, again from nuelectronics (note that this is not a “standard” Arduino ethernet shield). While I was browsing I realised I could be both lazy and a little tidier by buying yet more stuff from nuelectronics, namely a real-time datalog and I/O shield and a DS18B20 module. Ultimately I’ll probably connect the thermometer directly, but for now the I/O shield provides wiring (the rest of the board is unused in this little project) and the DS18B20 module saves me having a breadboard floating around – the software is exactly the same as it would be if I’d wired it direct.

So, now I’ve got all the hardware, my plan was to read the 1-wire temperature over Ethernet. Simples. Turns out that this was pretty easy once you have all the info (which is not so easy to find!) and cobble together the various bits of software. But since it was actually pretty painful to figure out all the bits, let me explain a step at a time.

  1. Connect the Freeduino to your PC/Mac/whatever with a USB cable.
  2. Fire up the Arduino software and configure it for the right USB port (sorry, no great advice on how to do this in general – in my case I had to install drivers on XP to do it).
  3. Convince yourself that you’ve got this working by running a sketch (this is what the Arduino software calls a program) that blinks the LED.
  4. Once you’ve done that, then disconnect the USB (which disconnects the power) and stack the I/O board and the Ethernet board on top of the Freeduino, in that order (the Ethernet has to go on top because the connector is too tall to fit between two boards).
  5. Connect the DS18B20 module to P7 on the I/O board (the centre connector).
  6. Plug the USB back in.
  7. Unzip the Ethernet shield drivers into the libraries directory of the Arduino software. They should end up in a directory called etherShield.
  8. Load up this sketch[2].
  9. Set an appropriate IP address[3] in the myip array at the top of the code. Also set the same address in baseurl.
  10. Build and install the sketch.
  11. Point your web browser at the IP address you configured. You should see the current temperature and a button to refresh.
  12. If you want to monitor temperature over time (and you are on Unix), run a script like this:

    while true
    do
            wget -q -O - 'http://193.133.15.111/?cmd=2'
            echo -n ' '
            date +%s
            sleep 60
    done
    

And that’s all folks. My first Arduino thermometer 🙂

What next? Well, firstly, the Arduino software environment is actually pretty annoying if you’re a professional coder like me, so I plan to figure out how to do this “properly” with the avr-gcc compiler suite (the Arduino software uses this under the hood, so it can’t be that hard). Secondly it seems to be quite hard to find out what pins are actually used by shields and what they connect to, so I’m probably going to start trying to gather that info in a useful format (does it already exist somewhere?), at least for components I have. I’m also planning to actually control some heating using the Arduino – for that purpose I’ll almost certainly use this relay module with the I/O board, at least for the prototype.

I’ll blog about these when I get round to them.

[1] 1-Wire is a really cute technology that allows you to control and power multiple devices over a single wire (+ ground).
[2] This is the demo code from nuelectronics, tidied up a bit and with some extra functionality added.
[3] If you don’t know what “appropriate” means, you should probably ask someone. It’s hard to give general advice.

Why Identity Is Still Just Login

Filed under: Identity Management,Privacy — Ben @ 15:14

It seems everyone now agrees that Internet identity is about a collection of assertions relating to a person (or thing, if you want to go there). Some of these assertions are assertions one makes about oneself, for example “I like brussels sprouts”, and assertions others make about you, for instance “Ben is a UK citizen, signed the UK Government”. These assertions are essentially invariant, or slowly varying, for the most part. So what makes an identity, we agree, is some collection of these assertions.

But we also agree that people need to assert different identities: there’s Ben at work, Ben as a member of the OpenSSL team, Ben at home and so on. Each of these identities, we like to think, corresponds to a different collection of assertions.

All we need to do, we think, to map these identities onto collections of electronic assertions and we’ll have solved The Internet Identity Problem. People will no longer be required to type in their credit card number five times a day, endlessly write down their address (and correct it when it changes) and so on. The ‘net will become one lovely, seamless experience of auto-communicated factoids about me that are just right for every circumstance and I’ll never fill in a form again.

You can probably see where I’m going. The more I think about it, the more I realise that every situation is different. My “identity” is contextual, and different for each context. We know this from endless studies of human behaviour.

So, what was the point of doing what every electronic identity system wants me to do, namely aggregating various assertions about me into various identities, and then choosing the right identity to reveal? To match this to what I do in the real world, I will need a different identity for each context.

So, what was the point of even talking about identities? Why not simply talk about assertions, and find better ways for me to quickly make the assertions I want to make. Cut out the middleman and do away with the notion of identity.

In practice, of course, this is exactly what has happened. The only vestige of this electronic identity that makes any sense is the ability to log in as some particular “person”. After that all my decisions are entirely contextual, and “identity” doesn’t help me at all. And so what we see is that “identity” has simply become “login”. And will always be so.

In a sense this is exactly what my Belay research project is all about – allowing me to decide exactly what I reveal in each individual context. In Belay, the ability to log in to a particular site will become the same kind of thing as any other assertion – a fine-grained permission I can grant or not grant.

Note: I am not against bundles of assertions – for example, I think lines one and two of my address clearly belong together (though for some purposes the first half of my postcode, or just my country, should suffice) or, less facetiously, when I use my credit card I almost always need to send a bunch of other stuff along with the credit card number. What I doubt is that the notion of a bundle that corresponds to an “identity” is a useful one. This implies that UIs where you pick “an identity” are doomed to failure – some other approach is needed.

16 Nov 2010

Apache vs. Oracle

Filed under: Open Source,Open Standards,Rants — Ben @ 11:49

As a founder of the Apache Software Foundation I have long been frustrated by the ASF’s reluctance to confront Sun and now Oracle head-on over their continued refusal to allow Apache Harmony to proceed as an open source Java implementation.

So I am very pleased to see the board finally draw a line in the sand, basically saying “honour the agreements or we block the next version of Java”. Oracle’s response is just ridiculous, including the blatant

Oracle provides TCK licenses under fair, reasonable, and non-discriminatory terms consistent with its obligations under the JSPA.

why even bother to say that in response to ASF’s charges? Do they think the ASF are suddenly going to say “oops, we see the light now, how wrong we were to expect a TCK licence under fair, reasonable and non-discriminatory terms consistent with your obligations under the JSPA, we see it all clearly now and humbly withdraw our unwarranted request”?

Well, whatever Oracle expected, the ASF’s response was short and sweet

Oracle statement regarding Java: “Now is the time for positive action (and) to move Java forward.”

The ball is in your court. Honor the agreement.

How this will play out is very uncertain, at least to me, but one thing is sure: delay and vacillation are over, at least from the ASF. Expect plenty of delay from Oracle, though.

13 Nov 2010

Chicken and Cashew

Filed under: Recipes — Ben @ 12:22

When I fancy a stirfry my thoughts often turn to this dish. I first learnt to cook this from Ken Hom’s excellent book, but it doesn’t bear much resemblance to his version any more. Quick and easy and delicious cold.

Chicken breast
Cashews
Ginger
Dark soy
Spring onions
Sesame oil

Chop the chicken. I believe the Chinese like things to all be roughly the same size, so in theory you should try and chop into cashew-nut-sized pieces. However, I typically do thin slices across the breast (by the way, if you want really thin slices then leaving frozen meat not quite defrosted is a great way to achieve it – no need to complete the defrosting after, it’ll happen in the wok). Marinade the chicken slices for 30 mins at least in diced ginger, dark soy and spring onion, finely chopped. Around here we like to use a lot of ginger but it is up to you.

While its marinading, stirfry the cashews in a little oil over a very gentle heat – burnt nut is very bitter, so keep the heat low and stir continuously – until lightly browned. Sometimes I use roasted and salted cashews, in which case there is no need to fry them, but you do need to rinse the salt off.

Then a little more oil (I use groundnut, by the way) on a high heat. Once it is smoking, throw in the chicken, which should’ve absorbed most of the marinade by now. Stirfry quickly and not for too long; the secret to really tender chicken is to stop as soon as all the meat is coloured – the pieces should be small enough that they’ll be cooked through by the time you’re done. Add the cashews and a little more dark soy and bring up to heat. Then take it off the heat, add yet more finely chopped spring onion and a generous dash of sesame oil give a final stir, and serve with plain boiled rice and a vegetable of your choice. Or a salad, even.

Nom nom. I think there might be some of this calling me from the fridge right now.

6 Nov 2010

Radical Copyright Thinking … at the European Commission!

Filed under: Civil Liberties,Digital Rights,Open Data — Ben @ 12:27

I criticise policy makers a lot. So it’s really nice when they say something sensible – or even inspirational. The summary does not do this speech justice. It’s quite short, I suggest you read it.

“We must ensure that copyright serves as a building block, not a stumbling block – we need action to promote a legal digital Single Market in Europe” European Commission Vice President for the Digital Agenda Neelie Kroes said today at the prestigious Forum D’Avignon, on the subject of how digital technology represents an opportunity rather than a threat to culture. Kroes underlined the need to modernise the copyright system so that it helps rather than hinders artists within the EU’s Single Market. “My goal, in promoting cultural diversity and content adapted to the digital age, is for European creativity to be even stronger”, Kroes said. “Today our fragmented copyright system is ill-adapted to the real essence of art, which has no frontiers. Instead that system has ended up giving a more prominent role to intermediaries than to artists. It irritates the public, who often cannot access what artists want to offer and leaves a vacuum which is served by illegal content, depriving artists of their well-deserved remuneration. It may suit some vested interests to avoid a debate, or to frame the debate in moralistic terms that merely demonise millions of citizens. But that is not a sustainable approach. Time alone will not solve the problems that have emerged.

Powered by WordPress