Archive for October 2016

A Note on Collaborations

This note is on collaborations where some overlap exists between technical development, artistic elements, and user requirements. The focus is on hardware collaborations, where no money changes hands. These notes reflect my personal experience, and observations of collaborations to date.

The first point, is that if you have a strong desire to complete the project rather than engage in open ended discussions it’s important to get explicit agreement from individuals engaged in the collaboration, and on any external deadlines.

Implicitly, it will be up to the individual who proposes the collaboration to manage the project. The ideal scenario is if a single individual can create the initial proof of concept (others offer advice, suggest easy to use parts).

Hardware collaborations generally in my experience take at least 3 revisions to get to a reasonable proof of concept.

In most cases you should budget at least a month per iteration, regardless of complexity. This is because unless you are funded you’ll be acquiring PCBs and other parts from China (this is x5 to x10 cheaper). Shipping these parts takes on average a month.

Specific Guidance

Early in a project, it’s useful to get answers to specific questions, these vary depending on the project, but where appropriate it’s useful to get answer to the following.

General Questions

  • Are there any deadlines involved (for grants etc)?
  • What environment will the project be in (indoors? Outdoors? Vacuum?)
  • What is the power source (battery, mains)?

Sensor projects

  • What are you measuring?
  • With what accuracy/resolution?
  • How long will the sensor be acquiring data unattended?
  • Where is data stored? Or how is it transmitted?
  • Data visualization requirements?

Motion projects

  • With what resolution/accuracy do you need to move the actuator? (nm,um,mm,cm?)
  • Over what distance do you need to move the actuator (um,mm,cm)?
  • Linear motion? Rotation?
  • If possible, provide a sketch of the system, with approximate dimensions.
  • If moving a static load, what weight does the actuator need to move?

Imaging projects

  • If optical imaging, what wavelengths are you interested in (visible light only?)?
  • Resolution,accuracy,noise levels, quantum efficiency requirements?
  • Will image stitching or computational intensive post-processing be required Do you have access to compute?
  • Do you have access to adequate image hosting facilities?

Fabricating oval through-hole pads

slot

A friend has been trying to make slot like through-hole pads. These are the kinds of pads you’d use for the strain-relief pads on a USB connector etc.

I don’t use these, but I should and probably will on my next board. My friend had ran into fabrication issues using the oval drill shape in Kicad. Investigating this I found that the oval drill don’t seem to get written to the excellon drill files by Kicad. So there’s likely no way that they’d get fabbed (my friend uses the OSHPark Kicad import, but I’m guessing this just generates the drill files using Kicad anyway).

From what I understand of the OSHPark documentation on the subject. These holes should be marked as internal routing. In Kicad this is specified in the Edge.Cuts layer. The image above show an example where I’ve marked the routing around the hole. I believe this /should/ be fabricated correctly, but need to try it out. The OSHPark docs contain the following image (which they say /should/ work and will result in a plated hole:

unsupported-slot-calloutHowever, they actually recommend in that document (linked above), that you replace these kinds of features with regular, larger, holes.

A Brief Computational Analysis of “Pen-Pineapple Apple-pen”

ppaap_debruijn

Pen-Pineapple Apple-pen is the latest earworm [1] out of Japan. It has deceptively simple lyrics [3]. Starting with the refrain:

I have a pen.
I have an apple.
Ungh
Apple-pen.

What makes the lyrics interesting, is the way he plays with word ordering [4]. First mentioning Pen, then Apple before switching it around to become Apple-pen. I think it’s this reordering which engages the brain and helps give the song its memetic qualities.

The lyrics continue, repeating the process with Pen-pineapple, finally generating the string:

Pen-pineapple Apple-pen.

Piko-Taro then compresses this into the 2 symbol alphabet: PPAP. However, as “pineapple” contains “apple” we could expand this to: PPAAP.

PPAAP is a rather interesting string. Let’s look at every 2 symbol substring:

PP
PA
AA
AP

There are 4 possible 2 symbol strings over this alphabet, and each one is represented exactly once in the string PPAAP. It’s interesting to note that this would not have happened if Piko-Taro had chosen a different ordering, for example APPPA (Apple-Pen Pen-Pineapple) would give us 2 repeats of the substring PP and no occurrence of AA [5].

Strings that contain every substring of a given length (n) over a given alphabet (size k) are called De-Bruijn sequences. In order to create DeBruijn sequences, we generally start with a graph [6]:

ppaap_debruijnThe graph [7] has a vertex labeled with each string of length n-1 (in this case 1). Edges then connect the vertex to the vertex labeled with the suffix (of length n-1) of the string that would be created by adding the symbol the edge is labeled with.

To generate debruijn sequences from this graph we need to find Eulerian cycles in the Debruijn graph. That is to say, we need to visit each edge once before returning to the starting point. The starting vertex label, followed by the edge labels forms the DeBruijn sequence.

The PPAAP graph is of course trivial, and we can easily spot the 2 valid Debruijn sequences: PPAAP and AAPPA.

Debruijn sequences however get steadily more complex, lets take a look at one example from the wikipedia page:

320px-de_bruijn_graph-for_binary_sequence_of_order_4-svg

Which is the Debruijn graph for n=4 k=2. From this we can generate the sequence 0000111101100101. Or in the PA alphabet: PPPPAAAAPAAPPAPA using the P=pen, PA=pineapple A=apple mapping:

Pen-pen-pen-Pineapple-apple-apple-apple-pineapple-apple-pen-pineapple-pineapple

Which I assume will form the basis of Piko-Taro’s next video.

If you like this kind of inane rambling. You should probably follow me on twitter or consider hiring me, where I will attempt to rambling consistently on the topic of your choice.

[1] Historically known as a maggot.

[2] Interesting, while the Japanese transliterated subtitled reflect what he actually says in the video. The english version of these is incorrect in some-places (or perhaps there is some deeper hidden stringological meaning).

[3]

PPAP
I have a pen. I have an apple. Ungh Apple-pen. I have a pen. I have pineapple.
Ungh
Pineapple-pen.
Apple-pen.
Pineapple-pen.
Pen-pineapple-apple-pen.
Pen-pineapple-apple-pen. [2]

[4] Something that English speakers at least have an intuitive feel for.

[5] Many years ago I wrote some tools for calculating repeat counts in string efficiently. The repeat structure of string is often, interesting, informative, and beautiful. However there’s no money in it, and I don’t do it anymore. 🙂

[6] Interestingly, over the past few users sparse DeBruijn graphs have found applications in the assembly of DNA reads into more complete genomic sequences.

[7] I used the excellent tkz-graph with Latex to create this graph.

esp32 USB Stick (esp32 + ch340g + buck conv + sd card)

esp32usb_r1

I’ve just finished the first revision of the esp32 version of the espusb stick and it’s now out to fab. I expect to have to do at least some rework and probably a couple more iterations before I’m happy with it. But if you want to hack around with it, the Kicad files and gerbers are below.

As before the board contains a ch340g usb interface, buck converter (to generate 3.3v efficiently) and an SD card slot as well as the esp32. I have exactly one esp32 IC at the moment… so it might take some time to get this board up an running.

This is also currently a 2 layer board, I think this should be fine, but it’s possible I’ll need to rework it as a 4 layer design at some point.

Once I have a revision I’m comfortable it’ll go in the shop. If you’d like to pre-order it, let me know. For a hand assembled board it’ll probably be 20USD. Plug: if you buy stuff from my shop it makes it more likely that I’ll be able to get a production run done and put out a cheaper version.

Kicad files and Gerbers: esp32_usb