Tag: Hardware

    Vivarium Automation: Requirements and Component Spec

    This is a post from my blog, which is (mostly) no longer available online. This page has been preserved because it was linked to from somewhere, or got regular search hits, and therefore may be useful to somebody.

    It’s a little over a month until we are getting our first pet – a crested gecko. Joseph has decided that if it’s female it will be called “Scarlet”, and Eric has decided that if it’s male it will be called “Rimbaud” after the surrealist poet, partially because it is also a homonym of “Rambo”. I almost hope we get a female as it will be easier to explain.

    In the mean time, we are getting our vivarium set up ready for our pet. We have just about everything we need, but managing the environment is a manual process — turning the lights on in the morning and off in the evening; maintaining heat and humidity.

    Vivarium

    Vivarium shown here with simulated occupant.

    This is crying out to be an electronics project, so I’m going to make it one! In this post I’ve laid out my initial requirements and listed some suggested components. I’ll probably do one or two more covering the actual hardware build and software when the components arrive.

    Requirements

    My requirements for the automated vivarium system are that it must:

    1. Automatically turn the 12V DC LED light panel on and off at a defined schedule
    2. Monitor temperature and humidity inside the vivarium
    3. Automatically control the 240V AC 10W heat mat to keep the temperature within defined bounds
    4. Send email alerts if temperature and humidity exceed the defined bounds
    5. Take regular photos of the inside of the vivarium
    6. Regularly post photo, temperature, humidity and status information to another computer for display on a website
    7. Fit in a 450x80mm space next to the vivarium (except components that must go inside)
    8. Be powered from a household 240V AC supply
    9. Not expose 240V AC to the probing fingers of children.

    Initial Design

    The requirements to operate the lights at specific times of day (requiring a proper clock), to send emails, to use a camera and to send files to a computer all push the design towards one including a “proper” small form factor computer rather than a basic microcontroller. Due to my familiarity with the hardware I have chosen a Raspberry Pi for this system. The Model A should be sufficient for the system’s limited requirements.

    The Raspberry Pi’s official camera modules are easy to use and have good performance due to dedicated processing on the Pi’s GPU. I have chosen the “NoIR” camera, which lacks the IR filter of the standard camera, to improve visibility of the gecko at night. No IR illuminator is proposed as this may interfere with the lizard’s sense of time or temperature regulation.

    The proposed AM2315 thermometer and hygrometer module is comparatively expensive, but comes inside a tough enclosure with a wall mount and uses the standard I2C protocol, compared to the proprietary bit-banging protocols of the cheap sensors.

    Relays will be used to switch the lights and heat mat power on and off. A breadboard will be mounted to a Raspberry Pi case to keep the hardware neat while allowing for easy extension in future.

    Component List

    Here’s my list of the components, along with links to buy them. All but one are available on Amazon in the UK; the thermometer/hygrometer seems to be an Adafruit special and will have to be imported from the US.

    Component Choice Price / GBP    Link
    Computer Raspberry Pi Model A+ 18.00 Amazon UK
    Wifi Dongle Ralink RT5370 4.71 Amazon UK
    GPIO Breakout Pi Cobbler 10.00 Amazon UK
    SD Card Kingston 8GB 4.00 Amazon UK
    Breadboard BB400 1.15 Amazon UK
    Jumpers Generic 1.07 Amazon UK
    Power Supply Generic 6.00 Amazon UK
    Case Model A Case 4.49 Amazon UK
    Temp/Humid Sensorr AM2315 19.97 Adafruit
    Camera Raspberry Pi NoIR 19.13 Amazon UK
    Suction cups Generic 3.57 Amazon UK
    Relay Board Facilla 2-channel 1.13 Amazon UK
    Enclosure for mains relay    Generic black ABS 150x80x50    5.90 Amazon UK
    Enclosure glands Generic M12x1.5 1.59 Amazon UK
      Total: 100.71  

    Stay tuned for build photos, schematics and source code once all the components arrive!

    Update: It turns out the heat mat was bought with its own dedicated thermostat. With this in mind I’ve decided to ditch the timed control of the lights and use a standard mains plug timer instead. This will be easier for people to override if necessary, rather than depending on whatever software interface I provide.

    Since the system is therefore not controlling anything I can ditch the relay board and the requirement to use a proper glanded enclosure to protect the 240V AC switching relay. It will still take photos, monitor temperature and humidity, display them on the web, and email on important events.

    Fun with Playbulb

    This is a post from my blog, which is (mostly) no longer available online. This page has been preserved because it was linked to from somewhere, or got regular search hits, and therefore may be useful to somebody.

    Playbulbs are colour LED lights sold by a company called Mipow. They come with an iOS and Android app that can set their colour and various patterns via Bluetooth. There’s no security on them whatsoever, so any nearby device can connect and change their colour. That seems pretty bad — especially when you consider that as well as the small “candle” style lights we have, they also sell room lighting versions that play music and can probably flash fast enough to trigger photosensitive epilepsy. Controlled by your neighbours!

    Playbulb Candle

    Despite the security problem, this does have one advantage: it’s easy to get any other device controlling the Playbulb, not just a phone with their official app. Anything with a Bluetooth 4.0 Low Energy transceiver can easily control the Playbulb using tools like those provided by BlueZ under Linux, and the protocol is somewhat understood. This means it’s pretty easy to control a Playbulb programatically using the language of your choice.

    Here’s a demonstration I knocked up this morning: mailcheck. This python script checks an IMAP mailbox at a defined interval, and will set the Playbulb colour to red if there are no unread messages, or green (with a brief flash) when you have unread mail. It was inspired by similar “ambient electronic devices” such as Nabaztag. Here it is in action:

    It’s BSD-licenced open source, so if you have a Playbulb you want to have some fun with, please take my code and use it for your own ends!

    All-Terrain Raspberry Pi!

    This is a post from my blog, which is (mostly) no longer available online. This page has been preserved because it was linked to from somewhere, or got regular search hits, and therefore may be useful to somebody.

    Another year, another childrens’ toy with a Raspberry Pi needlessly attached to it.

    Over the past few weeks, I’ve been taking one of my son’s old broken RC toys and turning it into something a bit more fun — by strapping a computer to it, naturally.

    The result is the “All-Terrain Pi”, a robot which can be controlled by smartphone as if it were a racing game, or by using the kid-friendly Scratch programming language.

    Here’s a video of the smartphone interface. It all runs in the web browser, with no need to install an app on the phone. Full-screen (ish) video streams from the robot’s on-board camera, while speed and turning are controlled using touch and tilt controls implemented in Javascript.

    Programming in Scratch is possible too, recreating the 80s/90s Logo “Turtle” experience for a new generation. As with the smartphone interface there’s a Python program behind the scenes controlling the motor driver board, but this time it receives commands via Scratch’s “Remote Sensors Protocol”.

    It didn’t take long for my son to get into controlling the robot, both with the game-like smartphone interface and using Scratch, which he has some experience with from school. (They start programming young now!) We took it to last weekend’s Constructorium hackerspace event at the library, where it was a big hit — by the end of the afternoon, he was teaching the grown-ups!

    Programming the All-Terrain Pi in Scratch

    “Proud” is an understatement.

    I’ve finished all the things I set out to achieve with this robot, in a total of only 20 hours or so. Thanks to a pre-made motor driver board and a Raspberry Pi camera fork of mjpg-streamer, some of the hardest bits of the project turned out to be very easy, so I’m very grateful to everyone whose work I’ve built upon to create this robot.

    I’m hoping we might be allowed to take the robot into school and maybe hold a competition for the kids to write a program to steer it around an obstacle course; or something similar — to make programming more exciting by taking it off the computer screen and into the real world. If the teachers don’t let us do that, we might hook it up to the internet and have it controlled using redstone circuits on my son’s Minecraft server.

    You can find a step-by-step guide to how I built the robot on the All-Terrain Pi page and all the code is open source!

    Raspberry Jammin’

    This is a post from my blog, which is (mostly) no longer available online. This page has been preserved because it was linked to from somewhere, or got regular search hits, and therefore may be useful to somebody.

    Last Saturday was the Linux User & Developer Raspberry Jam event at Poole RNLI college. I took the tank, of course, and Joseph too — worrying all the while that he’d be the youngest kid there by about ten years, and he’d get bored within half an hour.

    How wrong I was.

    We eventually escaped almost an hour after the scheduled end of the event, once Joseph and the other kids — many his age — had had their fill of Minecraft and the Raspberry Tank.

    Along the way we’d met the awesome people from PiBorg with their much more impressive RPi tank, along with robot arm-wielding BigTraks and 3D LED matrices. We’d done a show-and-tell session, drunk a lot of coffee, and most importantly been part of a room of 20+ kids all learning to code for the first time using Python and Minecraft.

    It was really an amazing thing to see and be part of, and my heartfelt thanks go out to the organisers from Linux User for hosting a fantastic day!

    Here’s the kids playing with our tank:

    Whatever Happened to the Generic PC?

    This is a post from my blog, which is (mostly) no longer available online. This page has been preserved because it was linked to from somewhere, or got regular search hits, and therefore may be useful to somebody.

    It doesn’t seem that long ago, perhaps only five or ten years, that you could buy or build your own computer and do whatever you liked with it. If you bought it, it would probably come with an operating system, but if you didn’t like it you could download another one and use that instead.

    Nowadays… not so much.

    My main computer is a Late 2007, 13-inch Macbook. You can install another operating system on it—so long as you keep the original OS to apply firmware updates. And you repartition the hard disk using Apple’s tools. And you install a custom boot loader. Oh, and even the custom boot loader can’t boot from USB.

    My other computer is a Samsung Series 3 Chromebook. You can install another operating system on it—in a chroot, because you have to use Google’s kernel to get proper hardware support. You can try your luck with a proper dedicated install of another OS, but your hardware will be badly supported. Your choice of other OS is a two-year-old version of Ubuntu, or a current version of Arch Linux for which no-one knows how to build Firefox. It boots from USB when it feels like it. The rest of the time, it beeps and restarts with no error messages.

    Linux on a Chromebook (image from muycomputer.com)

    And these days our phones are computers too. The more capable they become, the more like a real computer, the more we resent their limitations.

    I have a Droid Razr Maxx. You can install another operating system on it—so long as it’s pretty similar to the one it started with. And it’s compatible with the built-in kernel, which you can’t replace because it has to be signed. So you have to kexec your own kernel on top.

    All I really want from a computer is a bunch of POSIX utilities, a tiling window manager, a copy of Firefox and a package manager, preferably APT-based. Ten years ago that didn’t seem too tall an order. But with the computers we have today, I can and have struggled for days to achieve that—before giving up.

    Whatever happened to the generic PCs of years gone by? Computers were always supposed to get smaller and cheaper, but why did they also get less useful; less free?

    Fun with Quadcopters

    This is a post from my blog, which is (mostly) no longer available online. This page has been preserved because it was linked to from somewhere, or got regular search hits, and therefore may be useful to somebody.

    Over the weekend, my friend Alex visited us and brought his quadcopter in tow. I’ve bee trying my best to dump ideas on the internet and avoid buying my own extremely expensive remote control toys, but I can see the day I give in getting closer.

    Here’s my flight over Bournemouth beach, flown as cautiously as you might expect given that I had £500 of someone else’s money in the air!

    The Need for Mobile General Computation (aka, why I’m stuck with Android)

    This is a post from my blog, which is (mostly) no longer available online. This page has been preserved because it was linked to from somewhere, or got regular search hits, and therefore may be useful to somebody.

    My mobile phone contract has well and truly hit the “18-month itch” stage – although I still have six months until an upgrade is due, I can’t help but look at adverts and scan gadget blogs and think “ooh, I want one of those”.

    I could go for an iPhone, and have a vast library of apps to choose from – far more than Android has ever offered.  I could go for a Windows Phone device and enjoy a user interface that is genuinely refreshing compared to the rest of the mobile OS options.

    But much as it annoys me with its weird bugs, poor battery life, fragmentation, weird manufacturer-specific skins and inconsistent interface, there’s one important advantage to Android that sways my decision back to it every time I consider the alternatives. It is simply this:

    I want to be in charge of my device.

    The seeds of the war on general-purpose computation are already taking root in the mobile OS space. Phones and tablets are quickly gaining ground as the primary means of getting things done in our online worlds, and implicit in that is that users of these devices are putting the manufacturers and the mobile networks in charge of what they can and cannot do with them.

    I reject this trend. I want root.

    I want to be able to uninstall the apps HTC and Vodafone think I should use. I want to firewall apps off from “phoning home”. I want to back up a complete partition image of my phone. I want to run any script I can think of. I want to tunnel my network access over SSH.

    By and large, mobile software and hardware manufacturers are hostile to this kind of activity. It’s impossible on a Windows Phone device. iPhones can be jailbroken but OS updates – including important security updates – undo the jailbreaking until some enterprising hacker can find another exploit.  Of the current crowd of mobile operating systems, only Android, with its open-source releases of the core OS, allows said enterprising hackers to create their own distributions of the operating system and maintain “root” whilst applying Google’s own OS updates.

    So although I am bored of Android, though I crave a new and interesting user interface to play with, I crave freedom more. If I can’t make a device mine; if I can’t choose to be master of all that goes into it, out of it and through it, it’s not a general purpose computer – and I refuse to base a good proportion of my future computing needs on it.

    So Farewell, Psion 3a

    This is a post from my blog, which is (mostly) no longer available online. This page has been preserved because it was linked to from somewhere, or got regular search hits, and therefore may be useful to somebody.

    No idea why the hell I bought a Psion 3a a lottery ticket? Check out my previous blog post, “Coming of Age”.

    Pictured: Progress.

    It wasn’t a good sign, I suppose, when I switched the old Psion on this evening and discovered naught but vertical black bands on the display. It took a good few power cycles, lid closes and a strenuous massage of its hinges before it finally spluttered back into 16-bit (Multi Tasking!) life. But it made it in the end, just in time to discover what fate had in store for it.

    Now, there are a few ways of finding out what the night’s lottery numbers were. First, one can tune into the live draw on television. However, the TV guide indicated that the show was presented by Scott Mills, so that option was immediately discounted. No blog stunt is worth 10 minutes’ exposure to Scott Mills. The next method is going to the lottery website, but this was discounted just as quickly – I didn’t want to shock the poor old girl by showing her what BBSes had become.

    Keepin' it Old Skool.

    Ah, but there is of course a third option more befitting of the Psion’s age. I speak, of course… of Teletext. Trust me, I am as shocked as you that this thing still exists. Hell, I was pretty surprised that my TV still had an analogue receiver. So, to page 555 on BBC CEEFAX we went, the Psion checked her numbers, and… Yeah, we didn’t win. A paltry single number, in fact, only a third of the way to the £10 lowest prize.

    And that, I suppose, is the end of the road for the old Psion 3a.

    ':(', yeah, that's the kind of emoticon we rolled with back in '93.

    I remember virtually idolising these things when I was a kid – I’d been though innumerable personal organisers and proto-PDAs, but to have a Psion 3, with their high-resolution screens and the little touch-sensitive app buttons, the voice recorder, the programming environment… This thing was an object of desire as far as I was concerned. And it was certainly an improvement over its predecessor, the Psion 2, which I somehow also had despite it being nearly as old as I was.

    Yet now the 3a headed for the great landfill in the sky, an anachronism in today’s world. It takes expansion cards that nobody sells, communicates with a PC through a cable that nobody has and software that no-one can run. My cellphone has a processor 70 times faster, with 200 times more RAM. In my pocket I carry 10,000 times more storage than this thing has. In a world soon to be rolling its way into the year 2010, it is less than useless.

    And yet, despite that, I will be sorry to see it go.

    Coming of Age

    This is a post from my blog, which is (mostly) no longer available online. This page has been preserved because it was linked to from somewhere, or got regular search hits, and therefore may be useful to somebody.

    Yes, she's legal.

    The other day, while excavating the depths of our airing cupboard-turned-junk pile, I discovered possibly the oldest gadget I own: a Psion Series 3a… thingy. Time has obscured from my memory what we actually called these things when they were new. It certainly wasn’t ‘netbook’ – was it ‘palmtop’? After some new batteries and a non-trivial number of blunt impacts against the table to reseat the display connector, it spluttered into life. The back of the unit declares it to have been made in 1993, so this thing is sixteen years old.

    Now where I am, at sixteen, one can do the following:

    • Drive a scooter

    • Have heterosexual sex

    • Marry (heterosexually) with your parents’ consent

    • Enter full-time employment

    • Play the lottery.

    The Psion 3a, having the decency to look embarrassed next to my cellphone.

    There are a few issues with most of these. Driving a scooter is clearly beyond the poor thing’s capabilities. It appears to have expansion slots, so I’m going to go ahead and consider it female. Now that by default makes all other Psion 3as female, so marriage (within its own species at least) is presumably out. I have no expansion cards to put in it, and now I’ve mentally pidgeonholed that as “having sex” I’m not sure I even want to. Full-time employment is out as I’m not sure it does anything that peoples’ cellphones don’t these days. And that just leaves playing the lottery. Well, then.

    These things can be programmed in a language called OPL, which appears to be so antiquated that even the internet has largely forgotten it. I’m immensely grateful to Gareth and Jane Saunders, who seem to be the only people left with an OPL-related webpage that hosts the programmers’ manual.

    In the UK, one picks six numbers between 1 and 49 for each draw. Six numbers and a bonus are chosen by the lottery machine, and matching all of the main six is a jackpot (odds about 14 million to one). Matching three is the lowest prize, £10 at odds of about 56 to one. So, not really confident we’ll be winning anything here. Still, onwards!

    Making sure all six numbers it picks are different would take more than the three minutes I’m prepared to spend in contact with OPL – damn thing doesn’t even have FOR loops. I’ll just run the program again if it picks two the same. So here’s possibly the shortest program I’ve ever written:

    Eat your heart out, Visual Studio 2008.

    PROC lottery:
      LOCAL count%, n%
      RANDOMIZE(MINUTE+SECOND)
      PRINT "Lottery Numbers:  ";
      DO
        n% = (RND*48+1)
        PRINT n%;
        PRINT "  ";
        count% = count% + 1
      UNTIL (count% = 6)
      GET
    ENDP
    

    The Die is Cast.

    And when translated (translated? really?) and run, it does indeed produce lottery numbers. So – to the newsagents! And back, lottery ticket – and granulated sugar – in hand.

    Having foolishly switched the thing off in the meantime, it took a few seconds of mashing the On button and opening and closing the lid to coax it back into life. But back to life it came, long enough to pick its six numbers. And now, we wait to see what fate befalls this aged device.

    Will it quietly be replaced by gadgets a decade and a half its junior? Or become a palmtop millionaire, and, er… and I’ll have to work out what the heck a Psion 3a would do with a million quid. Tune in on Saturday night to find out!

    The lottery results are in! You can find out what happened in my next blog post, here. Spoilers: I am still not a millionaire.