Wobbling, Coding, Wobbling, Testing

   

[MoPi is mobile, hot-swap and 24/7 power for the Raspberry Pi. How to order.]

Boxed batch

1. Waving, Drowning, or ...?

(With apologies to Stevie Smith.)

Ok, so it was raining solidly for the second straight day of our (working) holiday, but what the hell — I was tucked up in bed, and The Little Monster was still asleep at gone 9 local time. Life was fine. And then I tried to sit up, and the world started spinning. Hmmm. Not so fine.

Labyrinthitis is a murky syndrome involving the tiny hairs in your inner ear that allow us to balance. If there's a change in the liquid that activates them, then all sorts of wierd and wonderful things can happen — including vertigo. A frequent result, apparently, is projectile oral expulsion of whatever you've been scoffing recently — see for example Paul Carter's account1 — but lucky for me I didn't go through that stage.

I do feel somewhat wobbly, though, and testing new versions of the MoPi firmware from Lubo has been a bit tricky for the last few days...

All part of life's rich tapestry, no doubt. Onwards.

2. MoPi v3 and v4: Results So Far

The good news is that we're pretty convinced that the version 3 prototype is a solid basis for the first full production run (version 4, which we'll be delivering to our Kickstarter backers in May and June). We've ordered the PCBs and most of the components. (Below more details of the development and testing process.)

The bad news is that there's a world-wide shortage of the Silicon Labs microcontroller that we're using2 :-(

Falling Shipping
Containers3

— we've only managed to order around half of what we need for immediate delivery. The other half is on order for delivery in the first week of June. If the situation stays the same then this means we will be delivering to the first half of our backers in May and the second half in June. (We'll do this in first-come-first-served order.)

If anyone has 300 spare controllers we'd love to hear from you...

3. Packaging

Big thanks to Georgi Marinov from EngView systems for designing a beautiful packet for MoPi:

The Packaging 1

And you can also spot the new stackable headers version here (with a stabilising device at the top which we'll ship it with — the long pins are very easy to bend!).

Packaging 4

Thanks Joro! (And thanks Gen for the logo!)

4. Working with the New Board

Our present work has several objectives:

  • verify that the new MoPi board implements all (old and new) functions correctly
  • develop an API for I2C access to the board
  • convert SimBaMon to use the new API
  • add a configuration utility to allow users on the Pi to configure the board

We're doing this using external power supplies to make the development cycles faster. (Well, would you want to add "wait for the batteries to discharge" to every edit/compile/test loop?!) I'm writing this post next to a large humming monster:

Test Rig

The Pi is drawing 170 mA; MoPi is getting 11.9 volts from the PSU. The PSU connects up to one of MoPi's supply inputs using a couple of re-purposed panel pins:

Test Rig

Mission control (helicopter not strictly necessary):

Test Rig

We've also got a flash new PSU down at the workshop:

Test Rig

Test Rig

And here's Fred after I just showed him the bill:

Test Rig

While we're showing my snaps, here's one of my absolute favourite bits of kit ever:

Test Rig

This multimeter has been running reliably for 30 years! Ok, at some point I couldn't get the batteries any more, so I had to bodge up a container for a different size, but apart from that it has been pretty much perfect. I plugged it into our new PSU, dialed up 6.2 volts and hey presto! The meter and the PSU agreed 100%. Can I marry my multimeter?

We've got a new shiney one too, but the romance just isn't there:

Test Rig

Anyhow, after this work is finished, we will:

  • run a bunch of battery tests using the 2600 mAh AAs that we're going to ship to backers who chose rewards with batteries in
  • complete the user guide and developer documentation
  • scratch our heads and wonder what we've forgotten?

Here are the battery rigs waiting to go:

Battery Rig

Battery Rig

Do say: wow, you're really taking this seriously! Don't say: so, Professor Cunningham, you popped out to buy a battery about a year ago and you haven't actually finished yet?

5. Linux is Lovely

One of the great things about the Pi is that it runs a free and open source software stack. This makes development so much easier — and here's an example of why...

5.1. Enabling I2C and Debugging with I2C Tools

Now that MoPi uses I2C as its communication mechanism, we have to enable this in the SimBaMon package. Here's how we do it4:

  • if i2c-tools isn't already installed, install it:
    • sudo apt-get install i2c-tools
  • (you might as well do the same with python-smbus for testing purpose)
  • edit /etc/modules and add lines i2c-bcm2708 and i2c-dev
  • edit /etc/modprobe.d/raspi-blacklist (if it exists) and comment out the line blacklist i2c-bcm2708 (by adding a # at the start of the line)

The process of developing our interface involved hacking the i2c-tools package to play with the multi-byte read facility in the i2cdump command. On a closed-source operating system, of course, you would be stymied at this point. On Linux it is super easy :-)

Here's how to pull down the source code, rebuild and test:

  • edit /etc/apt/sources.lst and add this line:
  • then
    • sudo apt-get update
    • mkdir i2c-tools
    • cd i2c-tools
    • apt-get source i2c-tools
  • then make will recompile (the tools are in the directory tools)

Hey presto, I can hack away at the C code and get immediate feedback with commands like sudo tools/i2cdump -y 1 0x0b i (where 0x0b is MoPi's designated I2C address — the smart battery address)5.

Read the main article.

Footnotes

  1. He ended up in an ambulance being rushed to hospital, but then it must be tough being a macho Aussie :-).
  2. Quite why this little component has gone out of stock is a mystery. Perhaps a containerful fell off a ship somewhere? Or a huge client of the manufacturer ordered 10s of thousands? Or perhaps Apple has identified us as an important competitor and is seeking to slow down our meteoric rise? Answers on a postcard please...
  3. Image from http://setsail.com/submerged-shipping-containers/.
  4. The key steps are described in various places, including on Adafruit.
  5. For a revision 1 Pi — the very early boards — use 0 instead of 1.



comments powered by Disqus