Sunday, 24 January 2016

Some progress

Well, I've missed Christmas, obviously. Maybe it'll be done for Christmas 2016...

I did manage to spend a few hours on it last night. I'd been thinking for a while about fixing the LED to small pieces of PCB, but I didn't think standard 2.54mm pitch Veroboard would fit (four holes would be ~7.6mm, and the holes are only 6mm), I considered getting some 2mm pitch board, but it's remarkably difficult to find in small quantities. I also thought about getting PCBs made, but it just seemed too expensive.

In the end, I thought I'd at least try with some scrap 2.54mm pitch board I had lying around and, well it's not to bad. The board stands a little proud of the rear of the letter, but that's OK. I little work with a file to widen the hole at the appropriate place and it should be OK. The upside is that it is so much easier to solder solid-core to Verboard that it is to try and lay-on not just one but two pieces of wire on each individual leg. Plus the legs were getting dangerously close together for something fused at about 2A.

I had one mishap with an LED that went pop (I could have sworn it was in the right way around), and another that didn't solder correctly, but I got five done in the end and I was starting to get the hang of it. And the little shards of Verboard look like Shreddies.

Only another 39 or so to go.

Tuesday, 22 December 2015


I've now got a Python webserver up an running (on my Linux server, for now), which offers a list of modes for the user to select from. When a mode is selected, it uses jQuery to push this back to the webserver, which then tells the other thread to change which animation it should play.

It's on Github, obviously -

The letters have arrived too, and I had to re-jig the LED layout a bit. It was tricky to get something that lines up in nice neat rows, but I think I got there in the end. After a few goes on the computer using LibreOffice Draw, I decided to just use chads from a hole punch to get the layout right.

Sunday, 13 December 2015

Christmas with a Pi Zero

I picked up a couple of Raspberry Pi Zeroes (plus one with the Mag Pi magazine, which I'm not going to open) when they went on sale. It's Christmas, so what better than a Christmas Pi project?

While in the local garden centre, I saw a Christmas ornament I quite liked - the word XMAS in MDF lit up with LEDs. But they were just regular LEDs, and that's dull. An idea formed.

The project is underway, but here's where we are so far:

  • Four letters (X, M, A and S) ordered in MDF from I considered making the letters myself, but I don't yet have access to the scroll-saw at work and I figured I'd just make a mess doing it by hand. I'll put up some photos when they arrive. I've gone for a flat bottomed Arial Bold, as the serif fonts are generally asymmetric and that messes with the LED layout.

  • 40 off WS2811 5mm Neo-Pixel LEDs ordered from The standard LED format will be so much cleaner when mounted in the letters than the more common surface mount versions. A dab of glue should hold them in place. I bought some rainbow ribbon to use as hook-up wire as well.

  • Some WS2811 test code at They're known to have tight timing requirements, so I looked around for someone who's already done the work on a Pi. I found an existing Pi library which used sent data to the PWM engine using DMA , but I had to patch up support for inverted outputs (I'm using an inverting hex buffer I had lying around in a scraps box to bump the 3.3V output to 5V). If you don't fix it, you'll find the green channel on the first LED stuck at 100%, which is really confusing. I used a breadboard to wire up a couple of the LEDs, and it now all seems to work OK.

  • Python test code. The Zero will run a web interface in order to select the currently running routine. To test the animations in advance of the build, I've been rendering them to animated GIF. Here are the first three routines, and although I'm not convinced about the snow effect, I quite like the other two. The LEDs won't be strictly laid out like that, but I hope to keep the same sort of grid as it makes the effects easier.

Sunday, 14 June 2015

Back to our regular programming

A recent holiday gave me time to catch up on things. One of them was the electronics to control the automatic signalling for my model railway.

I found an interesting chip from ONsemi. The NCV7608 is a 8-way FET driver with SPI interface. The particularly useful feature is that it exposes both drain and source on each of the 8 output FETs, allowing it to be used for high-side and low-side applications.

A small PCB with an NCV7608 could operate 8 colour signalling aspects, regardless of whether they were wired common-anode or common-cathode and regardless of the voltage the resistors were set for. With an RDS(on) of 1.2 ohms, the chip can source (or sink) a fair amount of current before going pop, so you could also use it as a relay driver to operate points (although perhaps driving the points directly might be a bit ambitious).

I feel some Eagling coming on.

Thursday, 26 February 2015

New bike!

I decided to switch from taking the bus to work, to cycling. As it's about 14 miles each way, I thought the best starting point as an electric bike. Then, if it's a howling gale or horizontal rain, I'll still be able to make the journey without collapsing.

The bike I chose was the Kudos Tourer with Nexus 8-speed Hub. It's quite an interesting setup, and not very well documented, so I thought it was worth a few notes.

The battery pack slides on to a shelf on the rear pannier. It is a 36V nominal 10Ah pack, which charges up to 42 V open circuit. It has a key switch and the battery management and balancing must be internal. There is a four pin socket on the back, of which two pins are connected, and an RCA phono jack under the handle for charging. The charger is from Sans and its rated output is 42V 2A. My first battery wouldn't charge and my second had an intermittent cutout. Hopefully my third will be reliable!

The battery power comes into a hollow plastic box stuffed with wiring. Tidy it isn't!

The schematic is pretty simple. Battery voltage goes into the metal control box, via bullet connectors, and is also tapped off for the LED lights. You can see the red and black wires at the bottom of the picture above, with the blue/green bullet covers and the heatshrink where the lighting cables have been soldered on. and The lights operate via a latching switch on the handlebars made by Wuxing . The front light says it is a Spanninga Owl, but it's wired in rather than battery powered. I can't tell the make of the rear light but both seem OK. There is no interaction between the lighting circuit and the motor controller - they both just run directly off the battery voltage.

The controller drives a Bigstone C300 LCD via both a 4-pin and a 3-pin cable. I'm guessing one is LCD output and the other is the input from the four buttons. The interface is described on that page as "UART or CAN" so maybe I need to crack out the Picoscope and take a look. The control box also has has brake cutoff inputs from both brake levers (probably also from Wuxing), wheel speed input from a sensor on the rear wheel and an "axis input" which comes from a sensor on the crank. Motor output is via a yellow/blue/green 3 core cable labelled "Motor A", "Motor B" and "Motor C".  I've managed to find a copy of the user manual, which you can find here (Part1) and here (Part2). It explains how to switch from km/h to mph and what all the various icons mean.

The controller itself is labelled BST-TY11050036, and something visually very similar is sold in kit with the C300 on Alibaba, but I can't find out much more about it. I'd open it up, but warranties and all that...

Saturday, 6 December 2014

Second prize overall!

"Steve" won second place in the over £75 category. Not fast and not massive, but good at most of the challenges. Hurrah!

Sumo final

Beaten by a tricky wedge. Very chuffed to get in to the final though.