Saturday, May 7, 2016

Announcing Octarine

Announcing Octarine — Electronic Component / Data Sheet Manager

Having acquired a sizable collection of parts by now, I often find myself wasting time browsing for data sheets over and over again, instead of having them ready when I need them. I decided to remedy the situation by writing an app, Octarine, to manage my components. Building on the REST API offered by, I tried to minimize the amount of information stored locally, and fetch everything else on the fly.

Octarine 1.5 is now available on github, running on OS X 10.10 (Yosemite) or later.

As usual with my hobby projects, this was an opportunity to try a few technologies I don't use much in my day job:

  • Swift.
  • NSURLRequest
  • PDFKit
  • NSSharingService
Component search in the Octopart database (right). Saved components (left)
Data sheet viewer

Saturday, August 15, 2015

Introducing AutoISP - In-Circuit Reprogramming Made Simple

This week, I was honored to see my AutoISP family of boards being put into actual commercial production by Boxtec.

AutoISP is designed to help those among us ATtiny programmers who don't write perfect software on the first iteration. Previously, our alternatives were:

  • Pull the microcontroller from the board, plug it into a programmer, reprogram it, pull it from the programmer, and plug it back into the board.
  • Make the programming pins accessible on the board (e.g. with IC hooks or by adding an ICSP header to the board). This may limit the use to which those pins can be put otherwise (and sparing 4 data pins on an ATtiny85 for programming is rarely an attractive proposition).
AutoISP solves this problem by placing the microcontroller itself on a slave board which is plugged into a socket on the circuit to be developed. The AutoISP master board then employs an STMAV340TTR 4PDT "video switch" to switch between two states:
  • If the RESET pin on its ICSP header is HIGH (or not connected), all pins on the microcontroller are connected to the development circuit, as if the microcontroller were plugged into the circuit directly.
  • If the RESET pin goes LOW, the MOSI, MISO, RESET, and SCK pins on the microcontroller get disconnected from the development circuit and connected to the ICSP header on the master board instead, which allows the microcontroller to be reprogrammed.
This makes it possible to use AutoISP transparently with most ISP programmers (e.g. the ArduinoISP sketch or ScratchMonkey), as long as those programmers leave VCC turned on while not programming. With the exception of the RESET pin, all other pins of the microcontroller are available for unrestricted use.

All electronic are placed on the master board, while the slave boards merely have sockets and pin headers. At the moment, slave boards are available for the ATtinyX5 (25/45/85), ATtinyX4 (24/44/84) and ATmegaX8 (88,168,328) series, although the approach is applicable to any ATtiny or ATmega processor.

Detailed circuits are available on Github and in the AutoISP manual.

Sunday, April 19, 2015

Introducing ChipHeadBang

There are a number of widely used methods to connect microcontroller projects to USB, all of which are not entirely satisfactory:

  • The commonly used FTDI chips are somewhat expensive, and their manufacturer has made some unpopular decisions with their driver support (although technically, the FTDI drivers work quite well).
  • Atmel also offers microcontrollers with built in USB, but those also tend to be a bit expensive.
  • Software USB stacks use a considerable proportion of the microcontroller's processing power, and as not always as reliable as hardware solutions.
When I therefore heard about a very cheap (40 cents a piece) USB to serial converter IC, the WinChipHead CH340G, I was eager to try it, and bought a few (I bought mine on AliExpress, but they are now also available at Boxtec). A prototype I built on a breadboard worked reasonably well, so I decided to try my hand at a custom PCB design:


To a large part, this follows a reference design from the vendor datasheet, using an Eagle part made by blogger [Ian]. I added a few customizations:

  • Boxtec's Christoph Schneeberger successfully convinced me to include a fuse. Though one might suspect a nefarious plot to sell more fuses, he'd probably make a bigger profit selling replacement parts for melted down unprotected boards (not to speak of potentially frying the USB port of a laptop).
  • I added LEDs on the RX and TX lines. Since serial lines are high when quiescent, I made them active low.
  • I put an ICSP header on the board so it could easily also be used as a bitbang programmer.
In many ways, the resulting design was a bit more complex than what I had done before: It's my first design involving an USB connector, and it uses more SMD parts (12) than any of my previous designs. I was therefore quite pleased when I managed to assemble my first copy of it with relatively little drama, and the functionality worked as designed (As usual, my application of solder paste for the CH340 was somewhat uneven, so I had to fix some shorts and one flaky pin connection). The serial connection seems to work even at high rates, and the bitbang programming works at the stately pace of about 1.2KB per minute.

I should mention that the CH340 has its drawbacks: Documentation is hard to find, especially if you don't speak Chinese. Driver support is iffy: My understanding is that the Linux and BSD drivers are OK, but the Windows and Mac drivers are not properly signed, and the Mac drivers will actually cause kernel panics on the latest versions of OS X. I was quite satisfied with quality of the commercial third party OS X driver I ended up buying, and the price is very reasonable, but if building a cheap solution was the objective in the first place, even that reasonable price does of course spoil the economics (if not the hedonics) of the exercise.

UPDATE: Thanks to the codebender team, there is now a working free Mac driver for CH340 again, even a properly signed one.

Design files available on Github:

Saturday, April 4, 2015

Introducing Quarantatre

I might as well retitle my blog "The Art of the Blink Sketch", but this one has a bit of a twist:

The Quarantatre is a breakout board for the ATtiny43U microcontroller (basically just an implementation of the reference design shown in the AVR188 application note, though I did not follow the component layout recommendations all that closely).

In addition to the typical features found in other ATtiny models, the ATtiny43U has a built in boost converter allowing it to not only run off a single AA or AAA battery, but even to generate a regulated 3V voltage. While this only allows for a small current draw (apparently the limit is around 30mA), this could potentially be interesting for some applications.

The boost converter needs a few external components to work, and some of them, especially the Schottky diode, are not really available in breadboard friendly variants, so to truly test the boost converter, I had to make this custom PCB (available for ordering at OSH Park, design files on Github).

As usual, I've made an Arduino-style core available on Github at (migrating from Google Code, which is shutting down). The standard Arduino tool chain probably won't support it; as always, I recommend CrossPack-AVR for OS X.

Thursday, November 27, 2014

A Sophisticated Heat Beam Which We Called a "Laser."

Having recently acquired a stylish collection of potentiometers and knobs from Tayda2009, I wanted to mount them in a mechanically solid way. An excellent opportunity to learn how to use the Epilog laser cutter at FabLab Zürich

I started with a box design built at MakerCase, rearranged the pieces to fit an A4 sheet of poplar plywood, and added the other features (cutouts for the potentiometer shafts and wires, outline for the breadboard, etc) to the top surface.

After struggling unsuccessfully with Inkscape (which was not overly fond of the 0.01mm thickness of lines signaling to the laser cutter to cut instead of rasterizing, and created PDFs that omitted all circles with that thickness), I spent a well invested dollar on EazyDraw 3 (there appears to be a separate app for every version from 3 to 7, with prices neatly staggered, which I didn't know when I bought the oldest one, but it was perfectly suitable for my purposes) and redid the SVG, creating a PDF that opened just fine.

15 minutes' or so worth of cutting and rasterizing got me this: 

The design has a number of flaws (a.k.a teaching moments for next time):

  • I left off the bottom surface, because it would have been useless, but I forgot to adjust side surfaces to remove the fingers for the bottom. Oh well, I'll pretend these were meant for ventilation.
  • The box is considerably deeper than it needs to be. 2cm would have been ample, I made it twice as deep.
  • The potentiometers I bought have a little pin at the edge, which I had not noticed. In order to be able to mount them flush, I had to cut small notches for those pins, which luckily was no problem with the plywood.
  • The hole for the wires are a bit close to the potentiometer shaft hole, as the pins of the potentiometer are fairly long. On the other hand, there's no reason why the pins of the potentiometer have to point in any particular direction (the knob will mount in any orientation),   so I might just cut the pin notches so the potentiometers are facing at a 45 degree angle to the wire hole next time.
Overall, though, I'm pleased with the result, shown here demonstrating three simple audio circuits (On the left, a VCO and a Metronome, using the two timers of a 556. On the right, a non-functional attempt to build an OpAmp based circuit driving a piezo element).

Thursday, July 31, 2014

Lötet, freie Schweizer, lötet!

The recent introduction of chasing electroluminescent (EL) wire inspired me to give this a try in a seasonal installation:

admittedly, the sound on the video is not recorded off the installation—I overdubbed the same MP3 file the installation plays on top of the video, so the fairly soft rendition of the audio through the simple speaker I used did not detract from the majesty of the visuals and the occasion.

I noticed that so far I had never written up an EL wire project, mainly because the software generally has all the sophistication of an LED blink sketch, the hardware is 95% off the shelf (I'd rather not tinker too much with the high voltage AC current involved in an EL wire project), and my craftsmanship with the wire shaping is undistinguished. Nevertheless, I thought it was time to show how a project like this can be done.

Bill of Materials

  • EL Wire — I mostly use Sparkfun's brand of EL Wire, bought mostly through Boxtec. Make sure whatever wire you buy has the right plugs. I bought some of my EL wire from Seeedstudio, and spent some rather instructive time and effort refitting it with the plugs I needed (some adhesive copper tape and a bit of heat shrink tube ended up working quite nicely). The wire I use is 2.3mm thick (the thinner, the more tightly the wire can be bent).
  • Adapter cable for the chasing EL wire
  • An EL Sequencer — my Sparkfun EL Sequencer still works, despite the nasty accident it suffered when I first powered it up.
  • An EL Inverter to generate the high voltage high frequency power to drive the EL wire.
  • Electrical tape to mask off the sections of EL wire that I don't want to be seen.
  • Garden mesh to mount the wire. I bought a roll of 3x3.5mm garden mesh and cut it to size as needed.
  • An Arduino Uno with a MP3 Player Shield to play the music.
  • speaker for the audio output. With some additional circuitry, the MP3 shield is also capable of sending a fairly reasonable quality output signal to an external amplifier (e.g. your stereo system).

Arranging the EL Wire

There are numerous ways of getting EL wire to keep whatever shape you want to form it. The technique I'm using (which I may have invented; I don't recall having seen it anywhere else) is to use a tight garden mesh with holes a bit bigger than the diameter of the EL wire, and weave the wire through it:

it turns out that it does not matter whether the EL wire runs on the front or the back side of the mesh: it is bright enough that it will be equally visible on both sides. EL wire can bend quite a bit, but if abused too much, it will eventually break, so my wiring tends not to be all that tight.

The EL wire I buy generally comes with a plastic cap at the end, and the mesh is tight enough that I need to remove the cap or cut off the end of the wire. I've generally not had problems with this practice, but in the new chasing EL wire, doing this seems to have created some sort of shortcut between the individual strands of wire, so I had to separate them a bit and put some electric tape around the end to fix the problem.

Code for EL Wire

Basically a glorified blink sketch, as I said. Rather than synchronize line by line, or note by note, I just synchronize with the start of the song, which happens to be recorded at a fairly steady 60bpm (except for a ritardando at the end which I'm ignoring). For the chasing wire, I'm using an adapter cable using 3 channels; I do the chasing with 2 channels on, 1 off at a time, although the other way around also works, of course.

Playing the MP3 File

For playing the MP3 file, I used Bill Porter's very convenient MP3 shield library, so the actual code to play the file was trivial: 

The synchronization is simply done by connecting the TX pin of the Arduino to the RX pin of the EL sequencer, and then sending some data when ready. It certainly could have been made more precise, but for my purposes, I thought it close enough.

Monday, March 31, 2014

Introducing Muggeseggluino

One of the ideas that fascinate me in my electronics projects is minimalism in form factors. Having started out on an Arduino Uno, I started building ATtiny84 (14 pin DIP) based projects after a while, then ATtiny85 (8 pin DIP) based projects.

That's where things remained for a while, but eventually, I could not resist the temptation of tinkering with the most minimalist of the ATtiny series: The ATtiny4/5/9/10, coming in a 6 pin SOT-23 package. Despite the modest specs of the series (The ATtiny10, as the luxury high end model, features 32 bytes of RAM and 1K of flash), there is decent compiler support (don't expect to run an Arduino core, of course), but programming the MCUs is a bit tricky. Pulling out the MCU from the circuit and reinserting it for every programming cycle would require rather massive amounts of soldering, and putting it onto a breakout board sort of defeats the purpose of having such a small form factor in the first place.

I decided to try a different approach: 

Every pin of the MCU (Except for GND) is broken out to a pin in the right row of headers. The left row is connected to the rightmost row in the prototype area. That way, the two rows of headers can be connected to operate the circuit, and separated when reprogramming the MCU. After the software is final, the headers can be removed and the two rows of pins bridged (The astute reader will notice that the space savings over a DIP breakout board, if any, are minimal, but I still like the design).

The name of the board, "Muggleseggluino", derives from the Alemannic word for a small but distinctive amount. It seemed an appropriate name for situations where just a tiny bit of microcontroller was needed as an ingredient.

Right now, I'm still playing with software options. The easiest solution out of the box is Wayne Holder's ATtiny10 IDE. The high voltage circuit is only needed when using pin 3 as an I/O pin, otherwise, SHDN can be used on the RESET pin directly. If you already have a 12V power supply, the single transistor circuit used by ScratchMonkey should also work.