And a Mitochondrion video from Circillumina

The Mitochondrion M4.2.2, as spun by Ben.

Apparently, ironically hip people have noticed that psytrance* is neither ironic or hip – A Big Night Out at… a Psytrance Rave! It is, however, fun way to have a night out dancing. That article describes it as “total aesthetic non-conformity” but that implies that the psytrance community cares enough about normality to decide to reject it. I don’t think that’s the case at all (or at least, not very often). It’s more that self-expression can explore a range of directions. By the simple law of averages, most of those directions lead in a different direction to conformity. It’s not rejection, it’s just possibility.

My direction just happens to involve excessive use of computer-controlled LEDs. That’s not because I’m rejecting fluorescent lighting, it’s because I personally think excessive LEDs are a fun challenge. Also I eventually want to spin LEDs whilst having to wear a welding mask due to those LEDs kicking out all the photons.

* – Yes, I know it’s all psybreaks/tech-funk around these parts, not psytrance, and that the tune in that vid is old-school rave, but such distinctions don’t matter at the level of the ironically hip.

Mitochondrion mark 4 – First public spin

So I quietly set myself a deadline of having the the Mitochondrion mark 4 ready for this weekend’s dance party (after having missed the deadlines for Kiwiburn and the Juggling Festival, and having taken the mark 3 apart more than two years ago). As of last Monday, it finally all came together, so here’s the first public spin, at Saturday’s Circillumina dance party:

A decent number of people asked me what brand it was or where I bought it, which is the level I’m aiming for.

The list of things it doesn't do is still longer than the list of things it does

And the version number ticks ever upwards…

The Mitochondrion, Mark 4.1, reached the spinnable stage, but had some irritating flaws. Hence I’m taking that learning into the Mark 4.2, using almost the same hardware and design as the 4.1, but with a new main board. Here I’m testing out the design. You’re looking at an Arduino Nano, 128 kB external memory chip, a combined compass/gyro/accelerometer motion sensor board and the upright bit is a Bluetooth module, all mostly behaving themselves so far.

Oh, and a level shifter, coz one of the things I learnt from the Mark 4.1 was that the motion sensor runs 3.3 Volts internally and has a voltage regulator so you can power it from a 5 Volt supply. However, it also has pull-ups on the I2C communication lines, pulling those up to 3.3 V. If you’re running the rest of the I2C network at 5V, everything all gets very unhappy very quickly.

Progress so far: motion sensing and external memory working just fine and my phone can see the Bluetooth module. Yup, one of the aims for the Mark 4.2 is to control the Mitochondrion from my phone. And for it to act as a thermometer, and possibly portable clock, coz everyone at festivals needs to be reminded that they are up past their bed-time.

Next steps are either getting the audio circuit design tested in hardware, getting the Bluetooth to work from laptop and phone through the software-serial port, refactoring all the software from an OO perspective, or shifting all the floating point maths into fixed point for a dramatic speed up. Coz you know me, I want to make pretty lights turn on and off and clearly the way to do that is not to buy some pretty lights and an on/off switch, but instead to start by writing my own code to perform basic mathmatics, coz other people’s addition and subtractions functions just aren’t good enough.

Hmm… oh, and more skirting boards. Only another 27 metres to go, for which I will be starting with pieces of wood that look nothing like skirting boards.

In other news, I stood under Patrick Herd’s Light with no sense of proportion with Darryl from Firepixie, who is wearing Phoenix Rising pants and comes from the Bay area, hence the excessive interwebnicity:

And we risked the life of The Secret Ruler of the Internet.

Mitochondrion Mark 4.1 Build Log: Post Kiwiburn

Yup, the replacement power conversion chip arrived, I soldered it in and the whole lot now works:

From Mitocondrion Mark 4.1

You’ll note that it isn’t plugged in to a computer, that the batteries are powering both the LEDs and the microcontroller, and that it is electrically complete and ready to be mounted in the tube. There’s still a couple of pieces of hardware to test (audio analysis circuit, accelerometer, reset socket) and lots of code to write, but it’s ready for Kiwiburn.

In other news, I’m now back from Kiwiburn. I was alternately social and effectively productive. The large shade structure/dance floor roof didn’t blow away or tear itself apart, the portable shade structure worked fine. Other people have pics, I have a huge pile of washing and six bean bags left in the van.

Mitocondrion Mark 4.1 Build: Main PCB

I’m working away on the next version of the Mitocondrion. In an effort not to do everything myself, the next version uses assorted bits and bobs from others but everything comes together and gets wired up by the one main board. This holds the Arduino, the big DC-DC converter that powers the LED strips, the little DC-DC converter that powers everything else, the status indicators, the motion sensor board, the battery monitoring, the extra memory, and the audio analyser. It also joins together the two battery packs, the LED strips, the power, programming, and reset connectors, and the microphone. It’s busy.

So, here’s the board being made, from design, through masking, etching, building and testing the step-down power converter, and then once that was checked and working, populating the rest.

Great big pic under cut

Perlin noise, simplex noise, and interpolation

Most programming these days seems to consist of banging other people’s code together until it all behaves. This wasn’t much different.

I’ve been playing around with some algorithms for the Mitochondrion, Mark 4.1. For one mode, I want smoothly flowing and random patterns. There’s a kind of noise that suits called Perlin noise, invented by Ken Perlin and used to generate natural patterns like clouds in possibly every movie ever.

So, I found an implementation for Arduinos by some guy on a forum, tried it, horribly slow. Like a couple of hundred times too slow to give me a smoothly changing pattern on the hardware I’m using. There’s another kind of noise called simplex noise, also by Ken Perlin and faster. Found someone’s implementation in Java, ported it, tried it, faster, but still not fast enough. Scratched my head for a while, slept on it, had a shower and in the shower came up with the only original idea here, which is to just run the simplex noise for a few of the LEDs spaced out along the LED strip and just interpolate to fill in the gaps. Tried it, total speed up of around three hundred and now I’ve a hundred LEDs all doing what I want.

So cubic interpolation makes me happy, although to be honest, I wouldn’t have thought of doing it like this if I hadn’t asked Ranty Dave an entirely different answer a few months back and received the answer that “Catmull–Rom splines, mate, see you right”. And it’s not exactly a new idea to say “slow algorithm is slow, so only do slow algorithm occasionally and use fast algorithm to fill in the gaps”.

Anyway, here’s a vid of the Perlin, simplex, and interpolated modes. (On anything less than 720p it’s a little jerky, but that’s Youtube’s compression, not my code.)
http://www.youtube.com/watch?v=vtO0A0CRxo8

Question for people who actually know about this stuff: Perlin and simplex noise produce noise with a (roughly) normal distribution, i.e. across the interval from -1 to 1, but mostly clustered about zero. What if I want smooth noise with a flat distribution, i.e. with equal probability of occuring in the interval from 0 to 1? I ask as I’m changing the above code from RGB to HSV so that I can control the saturation (coz max saturation FTW) and I’d like to pick hues with an equal chance of getting any hue.

Is there an algorithm that does smooth noise with a flat probability? I haven’t found one, but I don’t know where to look. Right now I’m just expanding, scaling, and clipping the simplex noise, which isn’t really very flat at all.

The Mitochondrion 3.5 – An Excessive Glowstaff (5 of 8)

Sensors:


Pic by Marla at Kiwiburn 2009

I don’t like dumb objects. I don’t like noticeable user interfaces. I want shiny things that just do what I want, without me telling them what I want. And anyway, given that any physical connections to the outside world will have to come out through the tiny, busy ends, then it’s not like I can cover this staff with buttons unless I want to drill holes in the polycarbonate tube, making horrible stress concentrators and greatly reducing the toughness of the tube. Hence I wanted to squeeze a whole bunch of sensors into the Mark 3.5.

None of this worked

The Mitochondrion 3.5 – An Excessive Glowstaff (4 of 8)

Power and output:


Photo by Loki Gash for Filament Magazine

LEDs

For the purposes of shiny toys, LEDs come in two kinds: bright ones and painfully bright ones. The painful ones draw 350 mAmps or more, need fancy constant-current power supplies for each LED and will melt without proper heatsinking. I went for the bright ones that draw 20 mAmps each and only need a resistor to protect them.

I chose the Piranha-style square LEDs, for the brightness and broad spread of the beams (like these ones from Sparkfun. I thought about going for smaller, surface-mountable ones, but chose the through-hole LEDs for shock resistance.

Never again.

Dry ice, address space mangling, and the persistent headache of batteries

The Mitochondrion 3.5 – An Excessive Glowstaff (3 of 8)

Picaxe Microcontroller:


Photo by Loki Gash for Filament Magazine

Knowing nothing about microcontrollers, I chose something easy to start, the Picaxe family. The learning curve is easy, it’s designed for schools. Of course, something this simple is going to have limitations and by the end of two years of development, I’ve bumped up against most of them, but I wouldn’t have done this differently.

Even though it runs interpreted BASIC

The Mitochondrion 3.5 – An Excessive Glowstaff (1 of 8)


Vidcap by Craig Bellhouse

Firespinning is fun, but I thought to myself:
1) It’s been done
2) This is the Twenty-First Century and we have semiconductors
3) This is the Twenty-First Century and burning fossil fuels for gratuitous reasons is just so Twentieth

So a plan formed in my head to make a glow staff. Now, coz I’m stupid an overachiever, I decided to make one with bells on. A glow staff that pushed the boundaries, a glow staff like no other. The only limits are technology, time and money. The technology I can handle, and I don’t have kids or a TV, so time and money are no problem.

There was a slight drawback, in that I hadn’t done any electronics since school and wasn’t entirely sure what a microcontroller was or where to get one. I’d never designed a digital circuit or etched a circuit board, but hey, it can’t be that hard, right?

Several years later, the Mark 3.5 is quite shiny. Forty RGB LEDs, all individually addressable, over a hundred patterns, and bright enough to hurt*. So at long last and before I get too carried away with the Mark 4, it’s time to write down and share what I’ve learnt, both about glowstaffs and electronics. This writeup is an attempt to help other people avoid making the same mistakes as me. And there were a lot of mistakes.

The writeup is going to look like this, one per weekday, until we’re done:

  • Physical structure and layout
  • Picaxe microcontroller
  • LEDs and drivers and power and batteries
  • Sensors – this really didn’t work
  • Making PCBs
  • Debugging & Reliability
  • Doing it better next time

* – Mostly the Mitochondrion hurts other people, coz when I’m spinning it, I can’t see anyone or anything else.

And some vids, to summarise what I’ve been up to for a while

I’ve been working away at some prototypes. The glow fans are motion responsive, with a 3-axis accelerometer controlling the colour and brightness based off how they are moved. 10 LEDs, so decently bright too.

I’m working away at making these good enough to be sellable. Right now, the cost for each would be silly and the reliability… well, let’s just say the testing by tatjna & tieke revealed a few issues, but that’s what prototypes are for:

Vids of the glow fans and the Mitochondrion

Mitochondrion blathering – v3.6 or v4.0?

Listing my projects on tatjna’s blog reminded me that I have a Project 0 – keeping the Mitochondrion working. Currently, the reset port needs replacing. It’s a two quid part, but an hour job to tear down the end and replace the old one.

This is forcing me into choosing between fixing the latest problem with the v3.5.4 and making a newer, shinier one. The current one has been banged around enough that I’ve fixed most of the fixable flaws, and it’s reliable enough to work through Kiwiburn and then Foocamp without surgery, and that’s not bad, considering what it does.

Still, there’s some fundamental limits and problems with the current one:

  • Unreliable hardware.
  • Unreliable software. Naked pointers in BASIC and only 26 bytes of variables?
  • Last generation driver chips. Slow PWM means no smooth colour fades, limited colour choice per LED, and no good way of resetting driver crashes.
  • Slow microcontroller, to the point where generating patterns based off sound isn’t going to happen. Hell, displaying any patterns that aren’t preo-processed isn’t going to happen. It’s running interpreted BASIC, ffs.

Thus there’s going to be a new one (after I’ve finished the house, Fannies, My Dick, and possibly a few other things). The question is, should I go for the v3.6 or the v4.0. V3.6 would just be an incremental improvement on the existing model. The new LED driver chips (PCA9635‘s) are much the same, just with faster PWM, better colour control on each LED, and an external reset line. Light board designs won’t have to change much. I could use the new model of Picaxe (Picaxe 40X2, the microcontroller than runs it all), twice the speed and more memory, same development environment and will drop in to the existing board designs. New ends and circuit boards can be made by others (Ponoko & Olimex), using stronger materials and better precision than I can manage in my kitchen, which will help the reliability. And that would be nice.

But there’s a nagging in my brain. The LED spacing is set by the need to fit the driver chips in between them, and the new chips are only 10 mm long, so the LED spacing can come down and I could squeeze a over hundred LEDs in there, not forty. Enough of the new drivers can fit on the internal network (I2C) that the microcontroller could control all those LEDs. But then, the Picaxe would need to feed out fifty times as much info when it’s only twice the speed of the old one. So I really should put an Arduino in there, which means new development environment, new language, all new code. And if I’m going to do that, then I might as well implement the better status display and better battery management too.

So it all leads naturally to the version 4.0, which will be a major step up, and not the minimal evolution that I wanted to build. Ah well, I can only console myself that it’s not the version 5, which may require metal-cored circuit boards for heat-sinking, active cooling, and possibly a welding visor for the user.

In the meantime, can anyone tell me why no-one sells a red-green-blue-amber LED that’s not phuge*? I just want a 20 milliAmp LED. RGB is nice, but RGBA just looks so much better.

* – Yes, there’s this monster 40 Watt RGBA in a 9×9 mm package. That one LED kicks out more light than the whole of the current Mitochondrion. It also requires major heatsinking to stop it melting and four constant current drivers per LED to feed it exactly the right kind of electricity. Thus lots of hassle. I’ll save that for version 5.

Lots of pics of house and projects

Big news is that one roof beam has been raised. That’s it hiding away behind all the scaff. There’ll be four, holding that part of the roof in a curved vault.

There is lots of scaff. This is the base of the trapeze space:

The house now has insides! Sort of. The upper storey floor is being laid, so the office has a ceiling. This is us nailing more joist hangers in the rain. And yet, thanks to the magic of ceilings, the rain was not falling on us. Hurrah for ceilings!

Cutting the Eye progresses. After spending this long with a jigsaw, I can only say that I want a plasma cutter.

The Fannies stack. The three boards are, from top, a four Watt step-up power supply, a three axis accelerometer, and a Picaxe and output stage. It fits into the space of one AA battery, leaving room in the box for two batteries to power the thing. Now I just need to solder, with occasional drilling of other bits.

And new batteries in the Mitochondrion seem to have solved the “only works for ten minutes” problem. However, they haven’t solved the “resets randomly if not connected to the programming cable” problem, nor has removing the serial out command. Am baffled, but it’ll do for now.