A model train set in a suitcase – a seemingly never ending project

Over the past two years I’ve been working on my largest and most complicated electronics project yet.  My work on the project has ebbed and flowed, but it’s mostly finished.  So I thought I’d start writing up some notes on it.

The initial inspiration was seeing Jeff Faust’s Arduino controlled z-scale train set. I’d been toying with the idea of getting a train set even since my first child was born, but space was very much a premium in the house. So z-scale appealed greatly. It didn’t take much of a leap to then consider putting the train set inside a suitcase, so it’d be easy to store. So after saving up for a little bit, I picked up a Marklin z-scale starter set. I also picked up a turnout, a decoupler and a bit more track, so there was a little bit more interest to the layout.

Seeing what the z-scale layout looks like in suitcase with scenery mostly done

Although, it’s not finished, I wanted to get some of this written up now. If I wait till it’s actually finished it may be a long time. Hopefully I’ll go into more detail on a few bits at a later date as well. From an electronics point of view there are quite a few “modules” that would justify individual blog posts. For now I’m just going to provide an overview of my progress to date.

Continue reading

A couple of ATtiny projects (ARC reactor + lighthouse)

Here are a couple of the other ATtiny projects I’ve worked on.  Only now just writing them up.  They are both pretty simple.

The first was an Iron Man style “ARC reactor” (the circle light in his chest) that I made to go with my son’s (shop bought) Iron Man costume.  It was just three blue LEDs covered in translucent Fimo, that light up in sequence, stay lit for a few seconds, then shut off in sequence.

Arc reactor on Iron Man costume

Continue reading

Re-configuring the HC-06 (cheap) bluetooth serial module

I picked up a cheap bluetooth serial (rs232) module from Amazon. As it didn’t cost too much, I thought I’d take a chance. The module arrived fine, though (unsurprisingly) without any documentation. Initially I’d tried following the documentation for configuring a HC-05 module, but after I while I realised it was actually a HC-06 module. The HC-06 is very similar to the HC-05, but (crucially) initially runs at a different baud rate (9600bps instead of 38400bps). Luckily I found some good instructions for configuring the HC-06 serial module elsewhere. I’m going to recap what I did to get the module working with my (OS X) laptop and a USB serial adapter. Initially I just connected the pins from the bluetooth module to the USB serial adapter directly. Although this meant that the power/ground pins lined up it also meant that the rx/tx (receive/transmit) pins also lined up – which we don’t actually want. We actually want the rx pin on the serial adapter to go to the tx pin on the bluetooth adapter (and vice-versa). This is because it’s not simply passing through the signals – instead we’re transmitting from the serial and receiving on the bluetooth adapter. This also means that we have to make sure the baud rates of both adapters match. You can see the pinouts of the bluetooth (top) and serial (bottom) adapters here: USB Bluetooth module (HC-06) and USB serial adapter I used a breadboard and some jumper wires so I could have rx and tx swapped over: Configuring HC-06 bluetooth module with USB serial adapter connected to laptop
Continue reading

LeChuck from Monkey Island cross-stitch with animated LEDs driven by an ATtiny

After acquiring some aida and a set of fairly cheap embroidery silks, I decided to try my hand at cross-stitch. As with a lot of craft related activities cross-stitch and embroidery are having a resurgence. The fact that cross-stitch is essentially the first form of pixel-art makes it perfect for rendering old-school 8bit/16bit graphics. Heading over to the Sprite Database I found the sprite for LeChuck from Monkey Island 2: LeChuck’s Revenge.

Nearly finished LeChuck cross-stitch + frame, button and electronics

Continue reading

Fimo dinosaurs

I’ve been having a little Fimo renaissance lately. Partly due to using some Fimo for the nightlights I’ve made, but also from seeing some of the other wonderful things people like Joo Joo have made.

I saw a little guide on making photo stands out of plastic toy dinosaurs and magnets and thought that I could do the same using Fimo. I ordered some tiny magnets online, that had a 300g pull – enough to be quite strong, but not so strong they’d cause any injuries! I also got hold of a few more varieties of Fimo and set to work:

The complete set of fimo magnet dinosaurs

Continue reading

Configuring an Edimax EW-7811UN on a Raspberry Pi for WiFi

I was given a Raspberry Pi last year. I quickly got hold of an SD card, keyboard, mouse and a ten metre ethernet cable (to connect it to the router on the other side of the room). I installed the version of Raspbian released in July and set to work updating and installing software using apt-get. However whilst the Raspberry Pi seemed to be working fine, it appeared the the ten metre ethernet cable and/or my wireless router’s ethernet port weren’t so happy. Running sudo apt-get update took a long time. Running sudo apt-get upgrade to get to the latest version of the Raspbian kept timing out. Downloads speeds started fairly modestly (30-40Kb/s, quickly dropped to less than 1Kb/s and then gave out all together.

This was obviously somewhat frustrating. A big part of the appeal of the Raspberry Pi is that it connects to the internet. An ethernet should connection should work easily, but it appears that my router didn’t agree with that. Given that everything else in the house connects over WiFi it seemed like that was the route to take. It also meant I could lose the monster ethernet cable draped around the house.

So when I had a bit of free time again I got hold of an Edimax EW-7811UN Wireless Nano USB Adaptor and set about getting it working. It’s a really tiny little adapter, just barely larger the the USB plug itself. Which means that the Raspberry Pi can keep it’s diminutive form factor.

Of course though to get the adapter working I needed to upgrade to the latest version of Raspbian (which includes the WiFi drivers) – which in turn required a connection to the internet.

So to get a temporary network connection I connected the ethernet port on the Raspberry Pi to the ethernet port of of MacBook and turned on internet sharing to share the WiFi connection. This was great and I wish I’d thought of it sooner as it gave me a full speed connection (500Kb/s at least). Of course at this point I made sure the WiFi adapter was not plugged in.

So first job was upgrading everything using apt-get:

    sudo apt-get update
    sudo apt-get upgrade

That probably took about 20-30 minutes and included the drivers for the Edimax WiFi adapter.

I then rebooted the Raspberry Pi and plugged in the WiFi adapter. To see if the drivers were working I ran:

    sudo iwlist wlan0 scanning

Which listed all of the WiFi access points that could be seen by the adapter – which indicated that the adapter was working properly. The blue LED on the adapter also started flashing at this point.

The next job was to configure the adapter to connect using my WiFi network. I edited /etc/network/interfaces:

    sudo nano /etc/network/interfaces

And added the following to the end of the file (be careful here as you don’t want to mess up your network settings):

    auto wlan0
    iface wlan0 inet dhcp
    wpa-conf /etc/wpa.conf

That configures the wlan0 network interface to run and to use DHCP to automatically get a network address.

Next I had to add in the key and access point name (SSID) for the network:

    echo $(wpa_passphrase <ssid> <network password>) | sudo tee /etc/wpa.conf

The wpa_passphrase command is a handy way of generating the hexadecimal key that the configuration file wants (rather than the human readable password). I used sudo tee /etc/wpa.conf as simply redirecting the output directly to /etc/wpa.conf would not have enough permission otherwise.

This writes the settings on one line like this:

    network={ ssid="<ssid>" #psk="<network password>" psk=<long hex string> }

Which needs editing to break into more than one line (otherwise the # character will mess things up):

    sudo nano /etc/wpa.conf

The edited wpa.conf file ended up looking like:

    #psk="<network password>"
    psk=<long hex string>

At this point that was all of the configuration done and it was time to fire up the wlan0 network interface (aka the WiFi adapter):

    sudo ifup wlan0

This thought about things for a bit (whilst it got a network address via DHCP) and then blue LED on the adapter lit up fully and I had a working WiFi connection!

Making a musical Robot Santa ornament using an ATtiny 85

William tests robot santa

In what is threatening to become a tradition, I made a Christmas ornament again this year. Last year I just made simple tree ornaments using sculpey and fimo.

This year things got a bit more involved, as I decided to make a musical model of the Robot Santa from Futurama. It was a good thing I started working on it in November, as it took quite a few evenings to get it all finished.

Continue reading