Clap Sensor part for Fritzing

I have no idea if this wiring would work, but it’s pretty …

For work, I blogged about Verbal MachinesHand Clap Sensor VM-CLAP1 (“Clap on 👏👏, Clap off 👏👏 – Elmwood Electronics”). I’ve made a preliminary part for Fritzing for the board: VM-CLAP1 Clap Sensor for

It should work in Breadboard and Schematic mode, but absolutely doesn’t work in PCB mode. This shouldn’t be a problem, as it’s only available as a standalone board. Fritzing doesn’t have any way to create new parts from scratch any more, so I had to base it on a somewhat similar-looking board, the SparkFun Electret Microphone Breakout.

I’m looking forward to see what I can do with gpiozero and the clap sensor.

more geometry to colour in

Click on image to download as PDF

based on the main repeating pattern from a Pierced Window Screen at The Metropolitan Museum of Art — particularly this image.

BlockTwo, a dreadful font


BlockTwo is a spectacularly ugly font mostly for playing about with 3D intersections in OpenSCAD. Not recommended for any but the most extreme display usage. Coverage is only A-Z caps, 0-9, heart and block.

Font Library link: BlockTwo
Local copy:

Futile Fonts

I make fonts sometimes. All of them have very permissive licensing.

  • mnicmp — you all wanted the DECwriter dot matrix font, but with the option of making the dots tiny stars? Of course you did …
  • ThreeFourTwoTwo — In the early 1980s, just before dot-matrix displays became a thing, companies produced more and more complex alphanumeric displays based on LED segments. One of the last of these was Litronix’s DL-3422, a huge DIP device holding four twenty two segment characters. These are now rare and stupidly expensive, so I made a font based on the matrix in the datasheet.
  • FifteenTwenty — A mono-spaced font family derived from character stroke coordinates from the Commodore 1520 plotter ROM. This has been documented here – – and here – The original font encoding is extremely compact, packing a move/plot/end instruction with coordinates in 8 bits. (github archive: scruss/FifteenTwenty)
  • AVHershey-OTF — a work-in-progress to convert the old Hershey fonts to usable OpenType fonts with as many of the symbols mapped to Unicode as possible. I’ve been working on this on and off for the last four years.

If you really must, there’s my fairly ancient and relatively terrible code for creating a TrueType font from your handwriting with your scanner, your printer, and FontForge.

nerrrdy Bourgoin mini-zine

All fired up by Natalie Draz‘s presentation about The Transmitting Library at Make Change Conference last Sunday, I made a tiny zine using Natalie’s template:

patterns_from_bourgoin-zine_smallJust fold it, cut across the broken line in the middle, then re-fold so the front and back cover are on the outside. Colour it in!

I’ve supplied it in a couple of formats:

  1. PDF: all vector, no jaggies — patterns_from_bourgoin-zine.pdf.
  2. PNG: if you’re still all about the pixels — patterns_from_bourgoin-zine.png.

all your centroids

As Side Door sign v3 seemed to have fallen off, I needed to make a new one. With access to a laser cutter, I can make really permanent things now, so I designed this:

side_door-cut-lcYes, that’s a pointy thing filled with pointy things (all without thumbs, you’ll notice) and labelled with Cooper Black. Irony, much? Fe!

In order to get the sign to hang correctly, I needed to work out the centroid of the pointy outline. thedatachef/inkscape-centroid: Centroids for Inkscape paths and shapes to the rescue! Well, kinda. First off, the installer had a bug that said a Ruby file was a dependency when the plugin was in Python. So I forked the repo, made the change, tested it, and issued a pull request. So yay, working centroid calculations in Inkscape!

Secondly, the plugin only works well for simple shapes, like these:

Screenshot from 2016-07-13 17-15-54But compound shapes? Not so well:

Screenshot from 2016-07-13 17-42-31I guess it doesn’t like the negative moments generated by the holes, and does its own thing. Oh well.

Scripting Inkscape – kinda

A couple of months back at the GTALUG Graphics session, someone asked if Inkscape – the 2D vector graphics workhorse that everyone seems to use – could be scripted. We pretty much said that it couldn’t. Recently, I found out that it does support a limited form of scripting, and wish to pass this on.

The key to it is understanding Inkscape’s command verbs. These can be listed using:

inkscape --verb-list

These verbs map to Inkscape commands, and often have names linked to the menu they live in (such as “FileQuit” doing what you’d expect).

I had a task I had to repeat on many files: convert all the stroked lines to filled paths. You’d need to do this if you are laser engraving a simple drawing, but there are other applications for this too. Here’s a command that would do this for all objects in a drawing, and overwrite the input file:

inkscape --verb EditSelectAll --verb SelectionUnGroup \
        --verb EditSelectAll --verb SelectionUnGroup \
        --verb EditSelectAll --verb SelectionUnGroup \
        --verb EditSelectAll --verb ObjectToPath \
        --verb EditSelectAll --verb SelectionCombine \
        --verb EditSelectAll --verb StrokeToPath \
        --verb FileSave --verb FileClose \
        --verb FileQuit input.svg

What this does:

  1. Selects everything, and ungroups all objects (×3, to break up most nested groups);
  2. Selects everything, and converts all objects to paths (so text, circles, polygons, spirals become paths, the lowest-level SVG object);
  3. Selects everything, and combines everything into one path;
  4. Selects everything, and converts all strokes to filled paths (so a two node straight line 1 mm wide would become a four node filled rectangle 1 mm thick);
  5. Overwrite the input file, close it, and quit.

The process has some disadvantages:

  1. It opens a window every time. You can’t execute verbs without the GUI opening.
  2. You can’t have another copy of Inkscape open while you do this.
  3. Realistically, you can’t really do anything at your computer until this is done, as it’s popping up windows and shifting focus like crazy. (ssh types can say “heh!” in a smug manner now)
  4. You can’t set parameters to verbs.
  5. It will overwrite the input file.
  6. It clogs up your “File / Recent” menu with all of the files you scripted.

FifteenTwenty: Commodore 1520 plotter font

FifteenTwentyFor the impatient: download (or more options …)
Updated: now with all ASCII glyphs!

Update, September 2016: this font was officially squee‘d over by Josh “cortex” Millard on the Metafilter Podcast #120: Hard Out There For A Nerd. I had the great pleasure of meeting Josh at XOXO 2016, too.

The Commodore 1520 was a tiny pen plotter sold for the Commodore 64 home computer. It looked like this:

Commodore 1520 printer plotter (adjusted).jpg
Commodore 1520 printer plotter — by Oguenther (Dr.Guenther). – This file was derived from Cbm1520-2.jpg: , Public Domain,

I never owned one, but it seems it was more of a curiosity than a useful product.

From a nerdy point of view, however, this device was rather clever in that it packed a whole plotter command language, including a usable font, into 2048 bytes of ROM. Nothing is that small any more.

Thanks to the epic efforts of Jim Brain and others, this ROM is now archived on Project 64 Reloaded. Looking at the code, I was struck by the elegance of the encoding: it packs a full X-Y plot instruction in one byte.

Based on my work with the Hershey font collection, I thought it would be fun to extract the coordinates and make a real OpenType font from these data. I’m sure others would sense the urgency in this task, too.

Since Commodore computers used a subset of ASCII, there’s a barely-usable set of characters in this first release. Notable missing characters include:

U+0060    `    GRAVE ACCENT
U+007C    |    VERTICAL LINE
U+007E    ~    TILDE

I’ll get to those later, perhaps.

Huge thanks to all who helped get the data, and make the bits of software I used to make this outline font.

(Note: although the Project 64 Reloaded contains some extraction code to nominally produce an SVG font, it doesn’t work properly — and SVG fonts are pretty much dead anyway. I didn’t base any of my work on their Ruby code.)

Self-similar petals

Self-similar petals

Self-similar petals

Original drawn in hand-coded PostScript from a path worked out using InkScape. Translating from InkScape’s SVG paths to PostScript is slightly annoying: PS uses Cartesian conventions, while SVG inverts the Y-axis. At least the SVG path commands map well to PostScript: mmoveto, ccurveto, Zclosepath, Sstroke.

There’s no magic to this figure. Each row of petals is half the length of the row outside it. As there are 6 petals arranged in a circle, each petal is 60° of arc. To make the half-step between rows, the petals are rotated 30°, so the rows have to be scaled by sin 30°, or ½.

Instagram filter used: Normal

View in Instagram ⇒

midtown tram jali screen

midtown tram jali screen

midtown tram jali screen

This design lives on top of the Yonge & St Clair streetcar stop. The real one is made of rolled stainless steel strip.

Instagram filter used: Normal

Photo taken at: St. Clair

View in Instagram ⇒

Accidental autumnal pattern

Accidental autumnal pattern

The little kite shape


fell out of an arch design I was studying, and I thought it was too nice to throw away. Must’ve been something about the falling leaves that made me choose colours like these.

Here’s the SVG, if you care to:


View in Instagram ⇒

Fountain decoration excerpt

Excerpt of mosaic pattern from 16th C CE fountain from Eqypt in the Aga Khan Museum
Excerpt of mosaic pattern from 16th C CE fountain from Egypt in the Aga Khan Museum
Fountain — photo by Sameer Vasta from Flickr. CC BY-NC-SA, 2015.

Clipped repeat:


(Not sure if I got the mosaic quite right. There were some damaged and replaced tiles that look a little out of place.)

Inkscape: circles from a point and radius

Drawing a circle between a centre point and one on the circumference is a common requirement in working up geometric patterns. If you need lines parallel to a radial line, or indeed any line at a fixed distance from another point, you need to draw a circle as a construction guide. the figure below will never be destined for design greatness, but it shows how they could be used:

(source SVG is linked from image, unfortunately)
(source SVG is linked from image, unfortunately)

The turquoise circles define the green parallel lines, and also the smaller green hexagon inside the black one. Drawing circles from a centre is what compasses do, yet Inkscape doesn’t have a tool to do it easily.

There is a way around this, though, that I picked up from this forum post. The poster’s method isn’t very clear, but in very brief summary, you need to construct a 3 point or 2 line-segment polyline with its nodes equidistant from the centre point, then use Render → Draw from Triangle … → Circumcircle to construct the circle. Simple? Um …

Okay, dodgy animation and point by point explanation coming up. With cusp, intersection and centre snapping all enabled:

badly drawn circumcircle animation for Inkscape
badly drawn circumcircle animation for Inkscape
  1. Draw two points: one for the centre, one on the circumference
    (I usually draw a short diagonal line as the pointand snap to the cusp node, as they are unobtrusive but easy to pick up the rotation centre.)
  2. Click on the circumference point to select it
  3. Click on the circumference point again to select the rotation centre and handles
  4. Move the rotation centre of the point to the centre of your circle
  5. Duplicate the point (Ctrl+D)
  6. Rotate the point 90° (Object → Rotate 90° CW)
  7. Duplicate the new point (Ctrl+D)
  8. Rotate the new point 90° (Object → Rotate 90° CW)
    (You should now have three points arranged around a semicircle)
  9. Draw two straight line segments through the three points
  10. Select the line
  11. Render → Draw from Triangle … → Circumcircle — and there’s your circle.

There’s probably another way to do this by creating a point (Ctrl+click in Line mode) giving it a line width, setting rounded line ends, then doing Path→Stroke to Path to get a buffer around the point, but I can’t work out how to do this reliably.

Oh, and the patten I made from the construction? Well, it might look okay on a paper towel …


Simple tools and techniques for making patterns with Inkscape

You might have noticed that I’ve become a bit obsessed with Arabic/Islamic geometric designs lately. Clues include posts like this, this, also this, and maybe even this. When I refer to Islamic Geometric Design, I’m more talking about the frameworks, repeat units or grids that are the starting point for the intricate and hypnotic abstract designs that have traditionally been used in Islamic architecture for over a thousand years. Here’s an example of the larger patterns in context:

A close up of Tomb by Usman Ghani.jpg
A close up of [The Tomb of Bibi Jawindi, Uch, Pakistan] by Usman Ghani” by – Licensed under CC BY-SA 3.0 via Wikimedia Commons.

I’ve been following Eric Broug‘s methods of construction that use a ruler and compass exclusively. Not being that great with manual dexterity, I’ve found these much slower to draw than I could on a computer. Consequently, I looked around for a good, free tool that people could use to start making these drawings. Most of the operations (including drawing from one intersection to another, rotating objects around a point, buffering lines into polygons) can be done by CAD packages, but these often have a steep learning curve. CAD packages also don’t tend to have many artistic functions.

Thankfully, the free drawing packing Inkscape has almost all of the features I need. Just one of the features I use quite often (creating a circle from a centre point and a point on the circumference; in other words, emulating a compass) isn’t built in, but can be done with a simple sequence of operations. In this article, I hope to show you some techniques you can build on for making your own patterns.

Installing Inkscape

This is covered well on the Inkscape website, so I won’t repeat it here. It’s important to get the most recent stable version of Inkscape. Some Linux distributions provide a really old version, so make sure you’re using at least version 0.91.

Inkscape runs on Linux, Mac and Windows. On Mac, it’s a little slow and uses some non-(Mac-)standard keyboard shortcuts. You may also have to install XQuartz on your Mac for it to run. It works fine on Windows (I tested 8.1).

Snapping is your friend

Screenshot from 2015-08-23 22:29:52

You’re going to have to get to know and love the Snapping Toolbar, shown at right. When you enable snapping, the items you draw or modify are locked to the node, intersection, object centre or grid point nearest to your cursor. When snapping is active, you get a little hovering info box showing you what Inkscape thinks you want to snap to:


I’ve enlarged the screen grab so you can make the info box out more clearly.

Snapping allows you to place lines in geometrically precise locations if you work up a drawing from a template or construction lines. All of the templates I made have the most useful snapping modes enabled:

  • Snap to Intersection — prefer where lines cross
  • Snap to Cusp Node —prefer end points of lines, or local extrema of polygons
  • Snap to Object Centre —prefer the centre of objects.
Triangle from intersections
(source SVG is linked from image)

Here’s a simple example of a triangle drawn from construction lines. I couldn’t ever draw a perfect equilateral triangle freehand, but with snapping, it’s four clicks (three vertices, then a final click on the first vertex to close the figure), and it’s done perfectly.

Incidentally, most of the patterns I make use straight lines. In Inkscape, you’ll want to use the Pen tool (Screenshot from 2015-09-10 08:50:22) with straight lines enabled (Screenshot from 2015-09-10 08:50:41).

Moving the Centre of Rotation

When you double-click an object in Inkscape in Select & Transform mode (Screenshot from 2015-09-10 21:46:02), you get shown the rotation handles and the all-important Centre of Rotation. By default, the centre of rotation is in the centre of the bounding box of the object; that is, the centre of the smallest horizontal box that encloses the object. Here it’s marked by a small cross:

Screenshot from 2015-09-10 21:26:15

Let’s say we want to make a six-pointed star from this triangle. You might think that if you duplicated it (keyboard shortcut: Ctrl+D) and flipped it horizontally (keyboard shortcut: h), you’d get your star. Alas, no star for you:

Screenshot from 2015-09-10 21:26:46

What we wanted to do was to flip the triangle around the centre of rotation of the radial construction lines, and to do that we need to drag the triangle’s centre of rotation over to the centre of the construction lines:


You’ll know when you’ve got it in the right place, as Inkscape’s snapping info box should tell you:


Let’s try that duplication and flipping thing again:

Screenshot from 2015-09-10 21:30:56

Moving the centre of rotation makes all the difference.

Rotation & Duplication

Now that we can move the centre of rotation, we can use that to build up compound objects:


This interleaved set of strapwork pentagons is made from 10 segments:

Segment for interleaved pentagons(SVG is linked under this image)
Segment for interleaved pentagons
(source SVG is linked from image)

Since there are 10 segments, we have to rotate each segment 36° (= 360°/10) to fill up the whole circle. For this, we use the Transform tool’s Rotate tab:

Screenshot from 2015-09-10 23:09:03

If you’re wanting to avoid doing even division in your artwork, here’s a table for many common values:

Number of Segments Rotation / °
2 180
3 120
4 90
5 72
6 60
8 45
10 36
12 30
16 22.5
18 20
20 18
24 15
36 10

Applying nine duplicate-rotate steps, we get this result:


Stroke to Path

(work in progress …)

Simple fine lines (SVG source linked from image)
Simple fine lines
(SVG source linked from image)

Most geometric figures have lines with some thickness to them. Guide lines alone are pretty boring.

You can use Object → Fill & Stroke and set Stroke Style on a path to make it wider, but sometimes you might want to work with the intersections of the edges of these paths. Fortunately, Inkscape makes this relatively easy.

First, give your path the width you want, say 3-5 mm. Then, with the path selected, use Path → Stroke to Path. At first, nothing appears to have happen, but change the Fill to none (the ‘×’ icon) and the Stroke Paint to solid. Suddenly, the path will appear to get really thick, but reduce the Stroke Style: Width down to a fine line, and you’ll end up with the outline of your original path.

Stroke to path, and partially filled (SVG source linked from image)
Stroke to path, and partially filled
(SVG source linked from image)

I’ve jumped ahead a bit with the illustration, and started to fill in the strapwork. Inkscape will snap to the nodes on the edges of your figure, and you can decorate it any way you wish.

(The Stroke Style: Join and Stroke Style: Cap permanently affect the outline path. You’ll get quite good at using Undo until you get the effects you want. Really pointy shapes will need a custom Stroke Style: Mitre Limit, as graphics programs try to limit really acute intersections, as they can get awkwardly long and trail off the page.)

A gratuitously pointy star that needed a custom mitre limit
A gratuitously pointy star that needed a custom mitre limit
(SVG source linked from image)


Other useful techniques

  • Separating construction lines from drawing objects by using Layers is very helpful. Once you hide the construction lines, your patterns look much more impressive, as you can’t easily see how it was put together.
  • The Select Same command allows you to select objects with the same fill and/or stroke style. I find this useful for selecting objects for grouping, or moving to other layers.
  • Clipping objects to basic tile shapes can help to make seamless repeat units for tiling.
  • The Clone → Create Tiled Clones … command is immensely powerful for making patterns out of repeat units. It’s also rather hard to use. I hope to add some basic examples later, though it’s hard to get this exactly seamless. This tutorial helps for a limited number of cases.

Screen pattern, Aga Khan Museum

Rendering of Aga Khan Museum screen

I’m rather pleased with this, as it’s the first pattern I’ve worked out from a real example, a screen in the Aga Khan Museum:

Screen detail, Aga Khan Museum

Here’s the pattern as a full page PDF from Inkscape: akm-screen-tiled-strapwork.pdf. The pattern’s not much more than an 8-pointed star with a smaller 8-pointed star inside it, rotated 22½°. But it’s still kinda neat.