Author Archive for Andy Murkin

01
May
20

Musical Box

I’ve always wanted a pianola/player piano, but have never been able to afford one.  Conlon Nancarrow was the original and most famous composer who used a player piano to compose works which were impossible for humans to play – too many notes, too widely spread across the keyboard, and too fast.

I wasn’t quite thinking of emulating that, but I thought it would be interesting to compose by making holes in a strip of card, which is what you have to do with the types of musical boxes which are available.

A quick look at eBay shows there are several variations.  Aside from this type, which plays a fixed tune, either manual:

or wind-up:

there are several types which are, as it were, ‘programmable’, meaning you can create your own tunes to play on them.  The usual ones are 15-note (top of the picture) or 30 note (bottom of the picture):

The 30 note type shows how the thin card strip feeds through the mechanism.  The top roller is the guide and the bottom roller with the ‘spikes’ is the one that plays the notes.

I was rather attracted by a 30 note type which was already installed inside an attractive wooden box:

You can see the slot on the front of the box where the card is fed into the mechanism.  It emerges through a similar slot on the other side. The mechanism itself can be accessed by opening the lid of the box:

It was rather more expensive than the mechanism just by itself, but I thought, well, it looks so much nicer, and the box will act as a sounding board, to improve the sound of the instrument as it plays.

The cost for this one was £29.99, including postage from China, but you can get the mechanism without the box for £22.  They usually come with a few card strips and a special hole-punch, but you’ll need extra strips, which cost around £5 for 10 strips of 75cm – there’s a limit to how fast you can wind the musical box, so I’d estimate you wouldn’t get much more than 30 seconds of music from a strip of that length.

This is what the strips look like:

but to save you having to join strips together – although this isn’t difficult, as I describe below – you can also get a continuous 10m strip like this:

*

The king of the musical box is undoubtedly Martin Molin of the Swedish group Wintergatan.  Perhaps better known as the inventor of the wonderful Marble Machine, Martin has also posted a number of videos on YouTube about his work with a 30-note musical box, including details of its construction and making the punched-hole card strips which play the tunes.  Here’s an example which begins with a great view of the musical box live on stage.

I watched all the videos carefully, and was concerned by Martin’s comments on the problems he had with reliability, which he put down to the plastic cogs in the mechanism.  You can see those in the picture above.

As a result of that, I decided to bite the bullet and buy a set of metal replacement cogs.  These came from the UK, but were still £13.33 including postage, so this was becoming rather an expensive project.  However, the one 30-note mechanism I saw which already had metal cogs was £55, so I suppose buying my own had saved a bit of money . . .

The advert said they were made of copper, although they were surely brass, which would be the normal materal for such things.  When they arrived, they were clearly precisely the correct set for this mechanism, matching the dimensions of the plastic ones exactly, and even included replacement screws and washers, which wouldn’t be needed if the originals were retained during dismantling.

The instructions for replacement were included in the eBay listing, a series of very clear pictorial illustrations of the procedure.  I was a bit concerned before I started, as I wasn’t sure if it would be as easy as it looked in the pictures – but it was!

The mechanism was attached to the box by 4 screws on the underside.

To take it out, these 4 screws needed removing, plus two screws on the inside, which attached the handle to the main part of the mechanism.

Removal of the plastic cogs was easy, requiring a little work with fine-nosed pliars  – I also need them to pull off the ones which are shown here being removed by hand: they were on a little too tightly to do that.

Likewise, putting the new cogs in.  In a couple of cases, this was just a matter of putting them in place, bending the retaining arm back into position in one case, and replacing a small clip in another.

Even the ones on the rollers, which had to be gently hammered into position, were easily done in exactly the way shown in the instructions.  Resting the assembly on a nut, it was possible to move the new cog slowly into place by tapping on the top.

I gave the new cogs a light spray with WD40 before reassembling the mechanism in the box.

Everything fitted precisely, and the only give in the system turned out to be the base of the box, which was loose and moved slightly while the mechanism was being wound.  This was soon cured with a couple of spots of superglue.

I tried the new arrangement out, and it worked perfectly.  With luck, this should now be sufficiently robust for me not to have to worry about slipping or jamming when I’m trying to play music.

*

Next, then, I needed to work on some punched-hole strips to play some music.  It seemed to me that there were 3 things I could do: firstly, transcribe some music I had already written; secondly, write some new pieces especially for the musical box; and thirdly, create some music unique to the instrument by punching random holes, or holes in patterns where part of the pleasure would come from not knowing what it would sound like until fed into the machine!

*

The beginning of the strip was printed with the 30 notes, and a helpful indication of which direction the strip should travel:

The first thing which is apparent is that the 30 notes are not a continuous two and a half octave scale.  Looking carefully, you can see nearly two octaves of continuous notes from E1 to C3; below E1 there are 7 ‘bass’ notes, extending just over an octave below; above C3 there are just 2 higher notes; so there is a range of just over 3 octaves, but with some notes missing – principally sharps or flats – meaning that some keys will more easily able to use the full range of notes than others.

The format of the card strip is simple enough: each of the 30 notes is represented by one of the 30 lines that runs the length of the strip.  Make a hole at a certain point on that line and the corresponding note will sound.

A special hole-punch which was suitable for this job was included with the kit:

There are lots of nice punches out there that can make 2mm holes, like these:

but they’re all useless, as the card strips are 70mm (7cm/2¾”) wide, so the punch needs jaws of at least 35mm depth, and preferably more: the hole-punching part of the exercise is very tedious, and the deeper the jaws of the punch, the easier this job is going to be.  The supplied punch allows you to reach about 50mm across the strip, which is most of the way, if not all the way, and was, in fact, far enough for most of what I did, without having to turn the strip around and finish off punching from the other side.

*

To start with the transcription of pieces I had already written, I turned to the application Logic, where they had for the most part been written.  One of the views you can have of a piece in Logic is called the ‘piano roll’.  This looks exactly like the strip above, with the lowest note at the bottom, the highest note at the top, and a dot (for a short note) or a line (for a long note) in exactly the place where it needs to sound.

I found some suitable pieces which were written wholly or mainly for a single instrument and turned to the piano roll view.  Typically, it might look like this screenshot, with short notes represented by a short line, longer notes represented by a longer line; the piano keyboard on the left-hand side indicated which note was which:

There were two things I had to do with this representation of the piece for it to be of use to me in preparing the card strips.

First of all, I had to remove or reposition notes so there were none outside the range of the musical box – the piece above, while perfectly OK on the piano, has notes which are both too high and too low for the musical box.

This is an example of a section where all the notes have been adjusted to fall within the musical box’s range:

Secondly, as the musical box doesn’t distinguish between short notes and long notes, I needed to reduce the length of the lines so they were all very short, like the holes that I would be making in the strips.

This is what the piece looked like when I had done that:

In this way I had reasonably quickly come up with a template which I could copy onto a strip, and hopefully reproduce – albeit slightly simplified – a piece I had already written.

I printed out the screenshots:

and started copying the dots in the screenshots onto the card strip.

Soon after I started marking dots on the card strip, I found this to be a useful tool (the one on the right if you’re left-handed):

This is the guide to the notes cut off the left-hand end of a strip; the one on the right is from the right-hand end.

The problem is that while you’re near the beginning of the strip, it’s easy to see which line corresponds to which note; but the further away you get from the end, the harder it is to see which note is which.  The first piece I finished used several strips joined together, and was about 2 metres long.  It would be pretty well impossible to keep looking back to the end to work out where to place a mark or punch a hole, so using this indicator in one hand, while I marked the dots with the other was very helpful for making sure I chose the right note.

The further I got from the left-hand end, the more useful this tool became; and eventually, as I implied above, I had to extend the strip by joining another one onto it.

I decided the best way to do this was somewhat like splicing audio or video tape, which we don’t do now, but used to have to do years ago.  So, my recommended method is to cut off the end of the new strip – the part with the notes on it can be put aside for a new tool when marking dots in future, and the remaining part trimmed along a easily identifiable line:

This strip can then be stuck over the strip you’re coming to the end of.  The edge should be matched precisely with the existing strip, and the two strips should overlap so that a diagonal line can be drawn at about 45° across the part where the two strips overlap.

The picture shows the strips temporarily stuck together with masking tape.  I used masking tape for this job because it’s not too sticky – especially for this first join, which is temporary; it’s see-through, so it won’t  stop you adding new dots when you continue work later; and it’s quite thin, so it won’t cause the strip to get jammed in the musical box mechanism.  The arrows indicate the area where the two strips overlap, and the diagonal line is shown in between them.

To finish off, cut along the diagonal line with craft knife or scissors, undo the temporary join and fix the two strips together, end-to-end, with no overlap.  I only used masking tape on one side for this as putting tape on both sides of made the card rather thick and it wasn’t going through the musical box mechanism very easily.

I decided to stop after every page of screenshots, having marked in the dots, and punch the holes, so I didn’t have a huge amount of hole-punching to do at the end.

One piece of advice I would have at this stage – and I only realised this after starting and having to clear up the mess on my carpet! – is to use a tray or something like that to catch the tiny dots of card removed by the hole punch.  This is the result of just part of the hole punching for this first piece:

However, after joining a couple of new strips to my original one I had marked all the dots for the complete piece, and finished punching the holes.

This was the moment of truth – I fed the strip into the musical box and wound the handle . . . and, sure enough, the sound that came out definitely resembled the piece I had written!

*

The first experimental piece was pretty straightforward – I punched out my name on a card strip:

Letters of the alphabet are not ideal for this purpose, because they contain a lot of vertical lines (many notes played at once), horizontal lines (the same note repeated many times) and diagonal lines (scales up or down), and not much in the way of tunes; however, this was a reasonable start!

To record the musical box, I used double-sided sticky tape and some piezo contact mics I had made some time ago (as described here).

Here are the two pieces, first the ‘ANDYM’ piece, then the previously composed one (which is called ‘Theme From an Imaginary Spy Film’).

*

Finally, to keep everything together, I used one of the wooden boxes I originally bought at the time I was making the Inductor instrument.  This time, as well as adding the same type of carying handle, I stained it a dark colour and varnished it.  It was a very cheap and rather poor-quality varnish, but didn’t look too bad after a quick polish:

and the musical box, the card strips and everything fitted nicely inside:

18
Mar
20

Parabolic Reflector Microphone 2

After creating my first parabolic microphone system (described in this post), I came across a small commercial device which I thought might be worth trying.  It was hard to say if it was really just a toy, but it looked a bit above that, and had some features that made me think it could be of practical use.

This is the box it came in:

and these are the contents of the box.  Clockwise, we see the approximately 20cm parabolic dish, a pair of decent over-ear headphones, the body of the device, and the quite thorough Instruction Manual:

And, when put together, this is what it looks like.  You can see the revolver-style handle; the ‘trigger’ which turns the microphone on; and the two buttons which record and play back the sound picked up by the microphone, which is in the end of the enclosure on the right,  pointing back into the dish.  Along the top is a x8 magnifier, designed, according to the instruction manual, to allow you to see more clearly what is being recorded.  In the base of the handle is a space for a 9v PP3 battery:

It’s not necessary – or, from my point of view, useful – to use the device’s own recording ability, which is only a 12 second burst.  However, you can also see a 3.5mm output socket in the bottom centre of the device.  This can be used with the headphones supplied, to monitor recordings as they’re being made, or to transfer a recording to a computer or external recorder.  More importantly, it can be connected to an external recorder, while the device is activated, allowing recordings of any length to be made.  Monitoring can be done via the external recorder’s system.

I decided to take the device apart and make a few small changes.  There were three reasons for this.  First of all, I wanted to add an option to replace the internal battery with an external socket, as with the other preamps I use while recording; secondly, I wanted to replace the momentary ‘trigger’ switch with a slide switch, which wouldn’t need to be held down all the time I was recording; and thirdly, I needed to replace the knob on the ‘Frequency Controller’ potentiometer – some kind of filter, I presumed, which was designed, according to the instruction manual, to remove unwanted background noises.  This knob was very stiff and well-nigh impossible to turn, not because of the potentiometer itself, but the design of the knob.

So, I decided to open up the device and look inside.  This involved removing half a dozen screws on the opposite side from that pictured above.  The device seemed solidly contructed, and the plastic had a nice feel to it, like a high quality game controller.  This picture shows what was inside.

1 = The small electret microphone element; 2 = the main circuit board with the large record/playback i.c. and the Frequency Controller potentiometer; 3 the switch board with contacts operated by the trigger mechanism; and 4 = the PP3 battery compartment and clip.

The only place which was still firmly connected was the microphone enclosure.  To get the two halves of the body apart I had to saw carefully through the enclosure at the point shown by the arrow.

Fully opened up, this is what the device looked like:

A closer view of the circuit board shows, in the bottom right-hand corner, the two connections, ‘SWITCH’ and ‘GND’ (Ground, or 0v), which I needed to get at.

This view of the other side of the board shows, in the top right-hand corner, where I made connections.  1 = The two switch wires, which went to a new slide switch attached to the upper part of the handle, within easy reach of my thumb; 2 = The ground connection, which went to a new 3.5mm power input socket further up the body of the device, via an LED, which I added to indicate when the device was activated.

In the bottom left-hand corner you can see the ‘Record’ and ‘Play’ buttons, and the LED which indicates when the device is recording to its internal recorder.

I cut the +9v lead from the battery clip to the circuit board and connected both ends to the LED and a new 3.5mm power in socket.  This was a switched type, so that the device would use an internal PP3 battery, unless a plug was inserted in the socket, in which case the internal battery would be disconnected and power would be taken from an external source.  I attached a small square of black velcro to the outside of the device, close to the socket, for this purpose, as I had done on my other recording preamps.

This picture shows the 3 changes I made to the device.  From front to back you can see: the ‘Record’ switch (recording to my external machine, that is, not the device’s internal chip) and indicator LED; the new, easier-to-use Frequency Controller knob; and the 9v external power socket.

As seen in the previous picture, one of my PP3 battery assemblies with integral 3.5mm plug is fixed to the velcro on the side of the device:

These changes should make the device more practical for me to use.  At some time, when circumstances are more favourable, I’ll try it out in the field.

Edit: I recently had a chance to do that, and it turned out well!  The recordings were reasonably noise-free and you hear, as I move through 360 degrees, a certain amount of directionality as the recorded sound changes.

09
Feb
20

Inductor Pickups 3 – a new instrument

In the first post in this series, I described experiments with different types of inductor pickups.  At the end of this, I had 3 types of pickup which I thought would be of further use: a mono guitar pickup; a stereo pickup using the insides of two Telephone Pickup Coils; and a stereo pickup using two 100mH inductors:

Later I added a similar pickup with two 200mH inductors I had been able to get hold of.

As can be heard in that earlier post, I had used my Macbook as the sound source, but I thought a better one would be a hard drive.

Some time ago I had bought a job lot of broken hard drives from eBay at a cost of about 50p each.  My original idea for these was to scavenge parts from them – magnets, discs, etc. – and to use the arms for a purpose which I may yet get the chance to write about.  (See this post for a description of how to dismantle them).

In this instance, however, I was looking for drives which would power up – many of them didn’t – and might emit interesting noises.  Not noises you could hear directly, but noises that could be picked up by an inductor.

I went through most of the drives – of which the above picture shows just one boxful – and tested them with the 3 inductors I had used in my last test on my laptop: the standard guitar pickup; the two Telephone Pickup Coils; and the two 100mH inductors.  The playing technique was simply a matter of powering up the drive and then passing the pickup slowly over the surface.

Surprisingly, the three different systems didn’t pick up exactly the same noises, and the range of sounds detected seemed sufficiently varied to make an instrument based on this approach worthwhile.  This recording is of the drive pictured, using the three pickups described above, in the order in which they are mentioned, the guitar pickup, Telephone Pickup Coils, and 100mH inductors:

*

It would have been perfectly possible just to use the hard drives spread out on the table, but I decided it would be much neater to make a proper instrument in a box, with its own power supply and preamp.  I was lucky enough to come across a supply of cheap wooden boxes which would be ideal for this project and, hopefully, some future ones.

There would be plenty of room inside for the power supply, circuitry and hard drives.

The first thing I added was an inexpensive handle to the outside (secured with nuts, bolts and washers, rather than screws, to ensure it won’t come off):

The second thing was to install a power source for the hard drives and circuitry.  The obvious thing to do was to use a typical hard drive power source, which would typically provide 12v and 5v DC – the 3.5″ drives would need 12v to spin the discs; 5v would be a suitable voltage for 2.5″ drives and for the electronic circuitry.  These were the main items I bought:

The 240v adaptor fitted into the corner of the box like this:

and an on/off switch was included inside the box lid:

Unfortunately, the mains power supply was too noisy to be used for the electronic circuits, so I used the mains adaptor for powering the hard drives and a PP3 battery for the electronics.

I used a box-type battery holder as it had an integral on/off switch and I was able to glue it securely to the inside of the instrument’s wooden case.

*

So far, so good; but for some reason the hard drives weren’t performing the way they were doing when I had been experimenting with them, and sometimes didn’t even appear to be powering up.  Only when the power supply exploded one day with a loud crack and the lights went off did the penny finally drop! . . .

. . . I went away and researched the amount of power required by a hard drive – and it’s much, much more than I imagined.  The ratings are normally found on the drive itself: the ones I had been using, when I finally read the labels, were rated up to 720mA @ 5v and up to 900mA @ 12v, although often somewhat less, but averaging out at about an amp/amp and a half.  Here’s a couple of examples of where you can find this information on a typical drive:

As you can see, there are big differences between the ratings for these two drives – and even the 5v consumption can be surprisingly high.   And that’s in normal use: when powering up, they can easily consume over 2A each during the first 2 or 3 seconds – no wonder my poor power supply couldn’t cope!  You can see from the label that it’s only rated at 2A at a time for each voltage, so is really only suitable for a single drive.

So, my first step was to buy two new power supplies, 5v and 12v, each rated at 8A – a bit of an expense I wasn’t expecting (about £8 – £9 per device)!   These were no longer to be incorporated into the box; they would be external, connected via two typical centre-positive power sockets on the rear of the box.

I was aiming to incorporate 5-6 hard drives in the box, so the two supplies would provide sufficient power for normal operaration – especially given that there would be no data input or output from the drives – but I had to arrange the power switches so that no more than 2 or 3 of the drives would come on at once.

I could have done this with just a row of power switches, of course; but a more interesting method was to purchase 4 of these ‘delay relays’ at only just over £1 each:

The large blue component is the relay.  It’s not completely in focus in this image, but you can just about see that it can handle 10A (10A of mains voltage, in fact), so was well up to the job in hand.

Item 1 in the above picture is a multi-turn preset, which allowed me to set the delay so the relay wouldn’t come on for at least 2 or 3 seconds – the length of time a high-amperage spike might be caused by a hard drive powering up.  This particular device could be adjusted for a delay of up to 10 seconds, so I set the 4 devices to work as follows:

When the on switch is operated, 12v and 5v power is immediately passed to the first one or two hard drives; after 3 or 4 seconds, power is passed to one or two more drives; and after 6-8 seconds to the one or two final drives.  In this way, overlapping spikes are avoided, and sufficient power is available for the drives to work properly after they are fully powered up.

A series of 6 LEDs, 3 for 12v, 3 for 5v, showed when the power connections were made.

Item 2 in the above picture is where the power lines are connected.  The centre connection is the ‘in’ or ‘common’ connection; either side of this are ‘normally open’ (normally disconnected) or ‘normally closed’ (normally connected) connections, which are then reversed by the operation of the relay.  I needed the normally open connections, so in two devices the centre connection was a 12v line, and in two the centre connection was a 5v line; the normally open connections were connected to the LEDs and the hard drives’ power connectors.

The 4-pin Molex connectors taking power to the drives are wired like this:

Pin 1 (yellow) = 12v;  Pin 2 (black) = Ground; Pin 3 (black) = Ground; Pin 4 (red) = 5v

So, the power section now looked like this (note: the on/off switch wasn’t quite in place when I took this picture):

For a short clip of the startup procedure, click here.

In this test I only used one hard drive connected to each of the three sections – the third one being unusually noisy!  They are, of course, all broken in some way, but you can hear that the first two, as they start up one by one, are not at all as rattly; but these are not the sounds the instrument is designed to create: as we will hear later, each drive creates its own interesting sounds when probed by the instrument’s inductors.

*

So much for the power connections.  Next, the electronics.

The first part of the circuitry was a preamp for the inductors.  For this I used the same transistor-based preamp I had used before for electrets and inductors, with the inductor connected on the left where the microphone is shown:

As this was a stereo instrument, with two inductors fitted side-by-side, as shown above, I used two of these preamps.

*

I tested this, and it worked fine with the mains adaptors for the hard drives and the battery for the preamp, so I turned next to adding a tone control.  I thought, as the instrument was based on inductors, that an inductor-based tone control would be the ideal thing, similar to the design that I had made before in the Bits & Pieces series, the ‘Active’ Tone Control  – which, in reality, is a passive tone control with a x10 amplifier in front of it to counteract the drastic loss of signal strength.

This is my design for the two-channel version:

In this case I used a TL072 instead of the 741 in the original: it was more up-to-date, less noisy, and neater, having two op-amps in one single 8-pin package; I also altered the resistors between the inputs and outputs (pins 2 and 1, and pins 6 and 7) from 100k to 1M to further increase the amplification.

The only thing I found is that I sourced the parts for the original about 20 or 30 years ago, when it was evidently much easier to obtain a 1H inductor – this is a very large value, rarely seen nowadays, and I couldn’t find one.

However, inductors are like resistors, you can put them in series to obtain larger values, so I bought 10 @ 200mH, which only cost about £1, enabling me to create two inductors of 1H.  I spaced them out on the circuit board, hoping to minimise interaction between them, and connected the outputs of the preamps directly, without a switch.  This tone control varies the sound quite a bit over its full range, and I was fairly sure there would be one position which would be very similar to the unaltered sound of the inductors picking up the sounds of the hard drive in action.

(In the event, I had a problem with the circuit around the TL072, so the amplifier and the tone control parts of the circuit ended up on separate boards, as can be seen in later pictures).

The 8-way phono socket panel in the bottom left is where the pairs of inductors plug in, and allows 4 separate pairs to be connected at the same time.  Multiple Molex power connectors like the ones illustrated above allow a number of different drives to be running at the same time, giving the possibility of more complex, multi-layered sounds.

*

The following picture shows the electronics in a more or less finished state in the lid of the box:

On the left, from top to bottom are Panel 1: 9v Battery Power on indicator light, 3.5mm stereo audio out socket, Tone and Volume controls;

Panel 2: 4 x Stereo Inductor inputs;

Panel 3: An LED on the left for 12v power on, and an LED on the right for 5v power on – the third hard drive or pair of drives.

On the right, from top to bottom, are the circuit boards for the tone control, the transistor-based buffer/pre-amp, and the op-amp-based pre-amp; and at the bottom, the 9v battery box with integral on/off switch.

*

To finish the instrument off, I just needed to arrange for the hard drives to be secured in the main part of the box.

I began by putting in a layer of foam rubber, mainly with a view to deadining the sound of the spinning drives.  Some time ago I had purchased a roll of foam, advertised as a yoga mat or sleeping mat.  It only cost about £4.50 and was quite big – about 2 metres by half a metre (perhaps rather narrow for sleeping!), and seemed the ideal thing for this purpose.  I lined the box with the foam, sticking it down with hot glue.  (Again, this is before I replaced the power supply).

To keep the hard drives in place, I used blocks of polystyrene, and cut more squares of foam to insulate drives which would have to sit on top of others.

Cutting polystyrene is messy and rarely successful, so I used an electric polystyrene cutting kit with a heated blade, like the one shown below.  This cost under £10 and proved considerably easier and neater in this and other projects – and elsewhere in the house.

Taking care not to set light to anything, or breathe in fumes from burning polystyrene, I trimmed the pieces without causing any mess.

Turning to the case, I decided a companion box was needed to transport the leads, power supplies and spare hard drives; so I fixed another of the carrying handles to the new box, and stuck on two small engraved plates to indicate which one was the instrument and which one carried the parts.

Using the two boxes, the instrument and accessories could easily be transported together.

A small length of yellow plastic from a cable tie was fixed to the right-hand side of the lid of the instrument box to ensure that it stayed open at the best angle.

I recorded the instrument using Audacity on one of my old MacBooks.  The pair of 100mH inductors were very noisy.  I didn’t have time to find out why, so I unplugged them; but I found that the most productive technique was to use two sets of inductors – the 200mH and the telephone coils – one in each hand.  This enabled me to search for interesting sounds in two places at once, to balance these sounds, and also on occasion to create interactions between them.

It was also possible to lay one set carefully on a drive, to continue picking up sounds, and leaving one hand free to operate the tone crontrol.

The following sound file illustrates some of the typical electrical/mechanical/drone sounds I was able to get from the drives:

20
Jan
20

Electret microphones and a parabolic reflector

One final – well, maybe not final, we’ll see how it goes! – type of microphone I wanted to try while out field recording was a parabolic dish or reflector.  I planned to use electret microphones in the way described in the series of articles beginning here.

Strictly speaking, the three-dimensional shape of the parabolic reflector is called a paraboloid, and the adjective is paraboloidal. A parabola is the two-dimensional shape and the distinction between this and a parabaloid is like that between a sphere and a circle, according to the Wikipedia.  However, in informal language, the word parabola and its associated adjective parabolic are usually used in place of paraboloid and paraboloidal.

So, this is the shape of the dish.  Note that there is a point marked ‘focus’.

Diagram by Melikamp – Own work, CC BY-SA 3.0,
https://commons.wikimedia.org/w/index.php?curid=28181019

So, now we know exactly what we’re talking about!

*

As with some of my other recent experiments, it’s not so much the microphone itself as the way it’s mounted that’s significant; and the significance of the particular shape of the parabolic dish is that all the sound captured within it is reflected back and focused on a single point a few centimetres from the centre of the dish. The effect of this is to naturally amplify the sound captured – and amplify it by quite a lot.

This diagram illustrated how the sounds coming into the dish are all focused on the same spot – the spot where the microphone is placed, facing back into the dish.

Own work assumed (based on copyright claims)., Public Domain,
https://commons.wikimedia.org/w/index.php?curid=3222214

In addition to this, the captured sound is from a restricted area, directly in front of the dish, so what it allows you to do is pick out an individual sound source – a person, bird or animal, machine or natural feature – some distance away and record it without having to get too close, which may cause disturbance, or resort to extreme amplification, which may cause noise or instability.

This is basically the audio equivalent of using a telescope – and, indeed, astronomical telescopes – not just optical, but also radio – use parabolic reflectors to focus light or electromagnetic waves, as do satellite TV dishes.

This photograph from the Wikipedia, showing the receiver from the MERLIN array at the Mullard Radio Astronomy Observatory, Cambridgeshire, is essentially a giant version of the parabolic reflector microphone, and illustrates the reflector’s features: the shape of the dish and the focus point – usually in the centre (although typically on the edge of a TV satellite dish).

Photograph y Cmglee – Own work, CC BY-SA 3.0,
https://commons.wikimedia.org/w/index.php?curid=33433585

The idea of using a parabolic reflector to gather sound from a distance has been going for a long time – since classical antiquity, in fact, as the Wikipedia points out, when the mathematician Diocles described them in his book On Burning Mirrors, and it has been claimed (although probably wrongly) that Archimedes used parabolic reflectors to set the Roman fleet alight during the Siege of Syracuse in 213–212 BCE.

In the UK, as far back as the First World War, giant concrete ‘sound mirrors’ were erected on the south and east coasts. Before the invention of radar, using these structures to listen for the sound of their engines was the most effective way of detecting the approach of enemy aircraft.

The caption to the above photograph – also from the Wikipedia – says: ‘On the pipe in front of the acoustic mirror was a trumpet-shaped ‘collector head’, a microphone which could pick up the reflected engine sound of Zeppelins approaching from the sea. Wires passed down the pipe to a listener seated in a trench nearby with a stethoscope headset, who would try to determine the distance and bearing of any enemy airships.’

[Photograph by Paul Glazzard, CC BY-SA 2.0, https://commons.wikimedia.org/w/index.php?curid=1667862 – ‘WW1 Acoustic Mirror, Kilnsea, East Riding of Yorkshire, England. Rare 4.5 metre high concrete structure near Kilnsea Grange, northwest of Godwin Battery, a relic of the First World War.’]

This photograph from the same source shows 3 ‘Listening Ears’ together, near Greatstone-on-Sea, Kent.

[RAF Denge photograph by Paul Russon, CC BY-SA 2.0,
https://commons.wikimedia.org/w/index.php?curid=1511357]

A great collection of photographs of a whole range of these sound mirrors from Selsey to Sunderland by Joe Pettet-Smith is featured on this page from the BBC website.

Concrete Blocks

*

Normally, commercial parabolic microphones are extremely expensive, although excellent ones are available from companies such as Telinga and Wildtronics.

As usual, I tried to do things on a budget, but finding a suitable parabolic dish proved difficult – bearing in mind that the parabolic shape itself is the important thing, as explained above, and a plastic bowl of some other type wouldn’t work as well.

Other factors included size and weight. The reason for the large size of the coastal ‘sound mirrors’ was not just the aim of collecting sound over a large distance; the size of the dish also determines how easy it is to detect low-frequency sounds. In the case of the sound mirrors, the low frequencies of aircraft and airship engines were a priority. This also has to be borne in mind with the portable reflector, which will inevitably be more suited to higher frequency sounds.  This partly explains its popularity amongst those who go out to record birdsong.

As far as weight is concerned, you have to take into account that the dish might have to be carried for quite a while in the field. Wildtronics, in particular, make a point of stating the weights of their dishes, to the extent of naming their thinnest variety Feather Light, and emphasising that it can be folded or even rolled for transportation. There’s heaps of information online about satellite TV dishes – and you’d think a second hand one of these would be a good bet, cost-wise – but nothing about how much they weigh.  However, they look heavy to me, and their particular design style, with the focus point well outside the rim of the dish, makes it seems as if they’d be difficult to wind-proof.

At the other end of the scale, I almost went for this hand-held item below.  However, although it’s much bigger than it looks – some 25cm (10″) diameter – and despite more positive than negative reviews on Amazon, it really did seem a little too expensive (around £25) and a little too small to me, and would almost certainly not be that effective – I’m looking out for a cheaper second-hand one on eBay to give it a try, though!

[Edit: I recently managed to get hold of one for only just over £20, and made a few modifications to it to make it a practical device to use.  I’ve written it up here]

So, in the end, I went with a UK firm I found, who make a decent reflector at a very reasonable price – OK, more expensive than most of my other projects, but reasonable indeed in the world of commercial parabolics. This was Innercore; or Parabolic Microphone, who make a 50cm ABS plastic reflector for about £65 with an integral stem for microphone mounting, a rubberized hand grip and a standard tripod mounting thread. I also bought their spandex wind shield for an extra £10, as I know from experience that wind can be a real destroyer of decent recordings in the field. As the dish is white, a black cover would, in any case, be a good thing from the point of view of concealing the dish – avoiding disturbing wildlife, and so on.

*

When the dish arrived, it was exactly as described, and, as well as the windshield, even included a microphone, User Guide and cable ties to attach the microphone to the central stem.

The central stem had the focal point clearly marked.  As the picture shows, a handle was attached on the back.  The dish, made of ABS plastic, as I said, was surprisingly light and could comfortably be carried for some time; but in the base of the handle is a hole with a standard 1/4″ thread in it, which would fit a photographic tripod.  I have a couple of handheld devices with 1/4″ threads on the top, capable of folding into a small tripod, which could prove useful.

I also acquired a light, but full-sized tripod, which could be used in the same way.

*

The main task, however, was to attach the microphone inside the dish – or, in this case, microphones, as I wanted something of a stereo effect.

This was unlikely to be pronounced, as the only sound entering the microphones would be that captured by the dish.  I have seen 3-microphone systems where two of them are forward-facing, recording ambient sound in Left/Right stereo and one is facing into the dish, recording the sound on which the disc is focused; but I decided to go with my standard 2-microphone set-up and not worry too much about creating mixers for extra microphones or how different the left and right recordings were.

So, to this end, I used a standard twin-phono socket lead, cut the plugs off one end, drilled a suitable diameter hole in the dish, threaded it through and soldered two small electret capsules to the end.

I wanted some small ones, and the only ones I had left after the two binaural projects, – the dummy head and the dummy ears – were a type called WM-61A.  The Panasonic WM-61A was a very popular and often-used quality electret, now no longer manufactured and consequently becoming more expensive; these were not advertised as ‘Panasonic’, and were not expensive, so their quality was not guaranteed . . .

To fix them to the central stem I used an old Allen key and a jubilee clip – the Allen key only because it had a right-angle shape with some straight sides, and would therefore fix fairly solidly in place. You can also see in this picture the blue band which marks the focal point of the parabolic dish.

I attached the lead and capsules to the stem, close to the focal point marker, with cable ties.

The small felt pad on the end of the stem was to protect the wind shield, which was quite thin, and, I thought, could be damaged by the pointed stem.

The final thing to be done was a little wind-proofing.  Firstly, I took a spare microphone windshield, cut a small hole in the end, and pulled it over the Allen key mount, covering the two capsules.

Finally, I pulled the spandex cover over the front of the dish, covering the whiteness of the plastic as well as helping to keep wind out of the dish.

The parabolic reflector was now ready for testing.

I went to a local nature reserve and made recordings in different areas: woodlands, a river path and a small lake with wildfowl.  The following extracts are typical of the results.  The first recording illustrates the difference in what is picked up when the dish is turned in a different direction.

By and large, though, I had to turn the recording levels up too high, and there was too much noise.  The first and third recordings are just as they came out; the second and fourth are the same recordings with noise reduction applied.

The noise reduction makes them just about acceptable to use, but this is contrary to the purpose of the reflector disc, which is supposed to amplify the sound naturally, without the need for noise-making electronics.

So I’m going to have to do more research and find out the cause of this: are the electret capsules at fault?  Are they badly placed within the dish?  Are the sounds I’m trying to capture too faint?  I’ll report back on any improvements I manage to make.

Edit: I recently tested the dish out again in my back garden, and was much more pleased with the results.  I think I was too ambitious the first time out, and trying to capture sounds that were just too far away, turning up the preramp gain beyond what was reasonable.

In the following recording you can hear just a little directionality as I move through 360 degrees:

27
Nov
19

Binaural Recording, Pt 3

After my second experiment in binaural recording, described in Part 2 of this series, the third area of my research focused on the importance of the ears, rather than the head, to the quality of the recorded sound.  The pdf article I had orginally read on the subject had stressed the importance of the shape of ears, rather than the presence of the head, and at least one range of well-known commercial binaural microphones, the 3dio, consists of ears without a head.

So, I set about sourcing a pair of realistic ears.  Some of these can be prohibitively expensive, but I found a type that were more reasonably-priced (a little under £6 for the pair, from China), moulded in silicone, and intended for acupuncture, it said, or medical study.

When they arrived I was surprised, as they were heavier, softer and more flexible than I was expecting – nothing like the hard, fixed ears of the dummy head.  Much more realistic, and softer even than real human ears.

Unfortunately, as you can see here, the right one – on the left in the picture – had been rather crushed in the post, with the ear lobe bent right over:

The insides of the plastic bags seemed quite moist, so I was hoping that if I pulled the ear lobe back and stored the ear upside down, with a bit of weight on it, it would still be malleable enough to return to something like its original shape.  Perhaps when taken out of the bags, the ears would then harden up in the right shape.

In the  end I had to use a dab of hot glue to pin the ear back to its proper place.  The ears became less moist, but not really less floppy after being out of their bags for a few days.

*

The next part of the plan was a pair of ear muffs, readily available from Chinese sources on eBay at about £1.  They come in all sorts of colours and finishes, but the ones I picked on had a fur interior and a faux-leather finish on the outside:

The reason I chose this type was that the fur would provide a certain amount of sound deadening, and the faux-leather would take hot glue.

More hot glue?  The glue, of course, was needed to attach the silicone ears to the ear muffs!

The purpose of this was to be able to use the ears in different contexts, either attached to a dummy head, or used on their own, relying on the ear-shape for the binaural effect, rather than the whole head.

Accordingly, I first obtained a cheap polystyrene dummy head and inserted some long nails to act as a support for the ear muffs:

It took a few tries to get the exact locations for the nails, but I fairly soon had them in the right place to hold the ears at the correct angle:

I then cut a small block of polystyrene to a suitable size to fit the ears on as a free-standing unit.  I estimated that 14-15cm would be a suitable separation distance for the two ears and trimmed the polystyrene accordingly:

The final and most important stage was to add the electret capsules inside the ears and attach a twin phono lead for the output to the preamplifier.

I used smaller capsules than the ones I had used in the dummy head, as it was difficult to make holes in the silicon ears.  In the end I used my polystyrene cutter, which has a small heated blade, inserted the cable between the silicon block and the ear muff backing, attached the capsules and then pushed them down into the ear canal towards where the ear drum would be.

These photographs illustrate this process:

You can also see a certain amount of melted silicone debris, which I had to remove.

After tidying this up and testing the sound was OK, I superglued the cables along the back of the ear muffs to keep the microphones from moving, and the project was finished.  As soon as there is some better weather, I’ll be able to go out and test the three different binaural systems together.

24
Nov
19

Ultrasonic Field Recording

I had been looking for ways of recording sound from scenes which was not immediately obvious.  I had developed an inductor-based recording device which could pick up electrical noise, and the next area I wanted to explore was ultrasonic sound – that is, sounds which are too high for our ears to hear.

A recording of sounds which are too high for our ears to hear, of course, would not be too interesting – you wouldn’t be able to hear anything on the recording, either; but I got the idea of what to do with them from a type of device available commercially in finished or even kit form – a Bat Detector.

Bats make noises which are mostly ultrasonic – too high for our ears to hear – when they hunt and communicate.  What the classic bat detector does is pick up these ultrasonic sounds, amplify them and lower their pitch by an octave or two, so we can hear them.

But not only bats make noises in the ultrasonic region, many noises around us contain ultrasonic elements which we can’t hear as well as elements which we can hear.  Lowering the pitch of the ultrasonic elements would enable us to appreciate the fullness of sounds which at the moment we only hear part of.

There are several ways of changing the pitch of ultrasonic sounds, and there are many circuits available on the internet utilising these methods for producing a bat detector.  The three main ways are:

1. Frequency Division, in which the very high-pitched bat sounds are converted into square waves which can be digitally divided by – typically – 10, to produce a much lower sound, within the range of human hearing. For example, a bat making calls at 50kHz, when divided by 10, will sound at 5kHz – quite high, but well within our normal hearing range of 20Kz to 20kHz.

2. Time Expansion, where sounds are recorded digitally in the bat detector at a high sampling rate, then played back at a slower rate.  This is a common method of pitch-changing in the world of digital sampling (and the method I used in the computer-based Black Widow sample manipulator).

3. Heterodyne, which works on the same principle as the electronic musical instrument, the Theremin: the high-pitched sounds are mixed with equally high-pitched sounds produced by an oscillator inside the bat detector. The aim is to tune the bat detector to produce a slightly different pitch to the bat, as the output is designed to be at a frequency which is the difference between the two pitches. In this case, if the bat is making calls at 50kHz, for example, and the bat detector is tuned to 45Hz, sounds will again be heard at 5kHz.

This latter turned out to be the method I used – in fact, I bought a bat detector kit.  The best commercially available bat detectors are very expensive, providing a wide frequency range to work within, and often providing more than one way to hear the bats.  I should make it clear at this point that I wasn’t particularly focusing on bats – I wanted to listen to any ultrasonic sounds that might be in the vicinity; but I wanted as wide a variety of sounds as possible to be detected and brought into hearing range.

So I found a neat-looking and very reasonably-priced kit, the Franzis Bat Detector, which was available from a number of sources, all at around £20-£25.  It comes in an attractive and quite sturdy cardboard box, which can serve as the container for the circuit when made up, with art work for the two potentiometers required – for frequency and volume – and holes behind which the speaker is attached.

Inside the box is a very small PCB, no more than 3″ long, already populated with about 25 tiny SMD (Surface Mount Device) components:

Together with the board is a plastic bag containing a handful of non-SMD components, which you solder in place yourself.  These include a battery clip (not shown), a 5v voltage regulator, a few capacitors, an LM386 i.c. amplifier, the two potentiometers and an ultrasonic receiver – in appearance rather like a large electret microphone capsule.

Together with the components, there was a nicely-produced and informative booklet, containing general information about bat detection, an explanation of how the circuit works, a circuit diagram and comprehensive instructions for assembly and testing.

*

Beginning at the front end of the circuit, there are many different types of ultrasonic receiver available, and the majority are rather expensive.  The one that came with the kit is the most popular of the more reasonably-priced ones, but is designed to work best at 40kHz, with quite a narrow band of frequencies in which it works at its greatest efficiency.  This is because it is designed to work in precisely that way, usually being paired with an identical-looking 40kHz ultrasonic transmitter, and commonly used together in detection or distance measuring applications.  I was concerned that this frequency restriction might limit the sounds the detector was able to pick up, bats or otherwise, but there is a certain amount of pickup outside the intended operating range.

*

This particular circuit would probably not suit it, but a possible alternative to the ultrasonic receiver in some circumstances would – surprisingly – be an electret capsule.  Although these are sold for use in ordinary microphones, some have good ultrasonic capabilities.  It’s hard to know which ones, and to what extent they might be useful in this regard, as figures are not normally released for frequencies above 20kHz, the normal extent of human hearing.

However, one capsule known to have a good response even in the environs of 100kHz is the Panasonic WM-61A, one which has been tested and used in this way.  Unfortunately, this particular capsule was discontinued more than a decade ago, and remaining ones are getting more and more expensive, even if they can be found.  Some are still advertised on, for example eBay, but I was put off by warnings of possible fakes, whose frequency response would not necessarily be the same.

A good currently available alternative is the Primo EM258 from FEL Communications.  At over £5 each, these were 20 times as expensive as the unbranded electret capsules I’d bought before for other more conventional microphone projects, but they are not much more expensive than genuine Panasonic WM-61As these days, and have been tested and shown to have a good ultrasonic response (better, in fact than the Panasonics, according to FEL).

JLI Electronics manufacture the JLI-61A, which is intended as a direct replacement for the WM-61A, but it wasn’t clear that this was available at a reasonable price in the UK.  In the US this would be a good  alternative, at half the price of the Primo.

FEL, incidentally, also advertise a potentially excellent alternative, a tiny SMD-style MEMS microphone.  Normally these things are practically invisible to the naked eye, but FEL have installed one on a breakout board like this:

The microphone itself is a Knowles SPU0410LR5H-QB, as the legend on the PCB suggests, with a sensitivity to ultrasonic frequencies up to 200kHz and beyond.  It was almost twice as expensive as the Primo electret, but would, no doubt work very well, and that price, just under £10, is not at all unreasonable compared to current good quality alternatives.

Alternatively, the cheapest way to obtain a second ultrasonic detector – other than ordering direct from China – might be to purchase a module like this:

Its purpose is distance measurement – the device on the left, marked ‘T’, is an ultrasonic transmitter, the one on the right, marked ‘R’ is a receiver.  It would be a few moments work to detach the receiver from the board, and attach it at the beginning of the circuit.

*

As for the construction, I planned to fit the circuit inside one of the small boxes I had previously used for microphone preamps; so I connected the small PCB to sockets in the box for power and audio out – I intended to use headphones instead of the speaker supplied.  I also added an extra socket for a line out from the wiper of the volume control.  Together with an appropriate preamp (for example, the one I use for my contact mics), this would enable me to record the ultrasonic sounds I was picking up.

 

I attached the ultrasonic detector to the front of the box with hot glue, and attached a pair of 2.5M bolts for the two aerials, which had threaded bases (in the end I only used one aerial).  I also added an extra socket for attaching an external aerial or detector; a plug here would disconnect the internal ones.

The remaining parts of the circuit were: a buffer/amplifier for the ultrasonic detector; a high-frequency oscillator, based on 555 integrated circuit; a mixing/heterodyne circuit, and an audio amplifier, based on an LM386 (the only part of the circuit which uses the full 9v available from the PP3 battery).

*

The difficulties with the first part of the circuit  – the buffer/amplifier – if you were to build it yourself, are to do with size.  The specified transistor for this amplifier, the BC849C, is a tiny, tiny 3-pin SMD device.  I didn’t have a 5p handy – physically the smallest coin currently in use – but I did have a 1p, which is only a little bigger, and a BC849C, and this is how they compared:

It would be quite a task trying to attach wires to this miniscule component – but at least they’ve separated the 3 pins onto separate sides.  I obtained this one just as an example – the actual one used in this circuit was already happily soldered to the PCB by the makers!

*

The mixer section is based on a CD2003 chip, ‘originally developed for radio receivers’, as the kit booklet says, ‘the core of an AM/FM radio with oscillators, mixer stages, intermediate frequency amplifiers and demodulators for the two ranges’.  In this design, only the AM preamp and AM mixer stage are used.  According to the booklet, the i.c. ‘offers a total amplification of 40 dB and a suppression of the input signal of -20 dB. The output of the mixer provides a low pass filter for an additional damping of the input signal.’ – a very handy chip for the task in hand.  It is possible to get hold of these, but they are not nowadays common or cheap – except from China, it appeared.

*

After connecting everything together, I plugged the headphones in and tested the detector out, using the preamp I had constructed for the piezo contact mics.

The device worked well: I detected ultrasonic sounds from jangling a bunch of keys and from rubbing my finger and thumb together – everyday sounds known to have a significant ultrasonic component – and outside in the evening I was pretty sure I detected some genuine bats.

This view of the front of the device shows the two potentiometers which need to be accessed when the device is in use: the tuning control on the left, which adjects the frequency of the internal oscillator and effectively ‘tunes in’ the high frequency noise picked up by the ultrasonic detector; and on the right the volume control.

This view of the back shows, on the left, the unit with the 9v battery attached (with velcro, in my usual way); and on the right, without the battery, but showing the caption for the switch, indicating that either the ultrasonic ‘mic’ or the attached aerial can be selected; a 3.5mm plug in the ‘EXT AERIAL’ socket on the front disconnects the switch, so a different size or kind of aerial can be used.

The following sound file gives examples of some quick recordings I made with the ultrasonic detector.  Unfortunately, it’s now late November – much later than when I first tested the circuit out – so no bats flying around.  Instead, I just went round the house for 10 minutes, picking out a few promising locations.

So, you can hear fingers rubbing together, the laptop, TV set, some unexplained radio-tuning type sounds, a low-energy light-bulb, jingling keys, and water streaming slowly into the sink from a tap. The laptop, TV set, radio-tuning and low-energy light-bulb were recorded with the aerial, the others with the ultrasonic microphone-type detector.

The keys are particularly interesting, and I look forward to trying this on some natural sounds outside – especially bats when they emerge from hibernation next spring.

Top

18
Nov
19

Making music with the BBC Micro:bit, Pt 1

Recently I was lucky enough to be given a BBC Micro:bit as a present.

What is a Micro:bit? – It’s a micro-sized computer, half the size of a credit card, with a row of input and output pins along one edge, Bluetooth capability, a display consisting of 25 LEDs in a a 5×5 pattern, and able to be powered and programmed via USB.  For ultimate simplicity, it can be programmed directly from the website www.microbit.org, via WebUSB using the Chrome web browser.

When it was introduced, its purpose was to ‘encourage children to get actively involved in writing software for computers and building new things‘, rather than being merely consumers of media, and around a million of them were given away to schoolchildren by the BBC.

Once I found out that it was considered suitable for primary school children, I was greatly encouraged that I would be able to write programs for it; and, in fact, there is a particularly straightforward way of doing this (as well as Javascript and a version of the Python programming language): that is, the Microsoft MakeCode system, which involves arranging and sequencing interlocking ‘blocks’.  You still have to have the programmer’s mentality, but without having to remember the precise wording and syntax.

As shown in the pictures above, The Micro:bit has a row of about 20 pins on its bottom edge, which have different digital or analog functions, and 5 of them, in particular, are easily accessed with crocodile clips or 4mm banana plugs.  These are +3v (actually 3.3v) and Ground, and analog pins P0, P1 and P2.  As a matter of fact, these last 3 pins can be operated simply by touching them!  You may have to touch Ground with your other hand to make sure they work, though.

Two tactile switch buttons are also available for incorporation into simple programs, and there is a tactile ‘Reset’ button on the back, which causes the Micro:bit to reboot.

For more complex applications – which can even include operating external devices such as servos – a range of edge connectors is available, which can aid permanent connections or take advantage of the smaller input/output pins.

There seemed to be several different ways in which I could make use of the Micro:bit’s capabilities.  First of all, it can, with a speaker attached directly to one of its analogue pins (typically pin P0), make monophonic square-wave sounds of its own, including playing a number of tunes stored in its own memory; secondly, it can be programmed to output MIDI messages; and thirdly, it can utilise and output data from its onboard detectors, which include light and temperature sensing, a three-dimensional accelerometer, and a compass/magnetic sensor.

I decided to start by using the Micro:bit’s internal sound-generating capabilities.

For this, I decided to make a module into which the Micro:bit could be inserted, and which would contain a power supply, speaker and various input and output sockets – all the hardware needed for a free-standing Micro:bit-controlled musical instrument.  That is the subject of this post.

*

I began with an empty Stylophone case, left over from an earlier project.  I left the speaker in, and the two slide switches on the front left.

In order to incorporate the Micro:bit, I bought a ‘proto-board’ – an edge connector into which the Micro:bit slots at a right-angle, with a section of stripboard attached for ancillary circuits to be built on.  I chose the right-angle one because I needed the Micro:bit to be visible when in use, and to have access to the front and back of the Micro:bit where its sensors are located.

I used this board for a couple of things: a simple op-amp based buffer/voltage follower, and an audio output transformer to be used with an alternative to the speaker, a piezo element.

I also bought a sturdy protective cover for the Micro:bit to ensure that it suffered no damage while being plugged in and out.  This particular type of cover leaves the edge with the pins exposed for just this sort of application.

This picture shows the board in situ, kept in place with matchsticks used as locating pins.  The transformer and op amp are on the right-hand side; on the left are a 4-pin i.c. socket and capacitor left over from an experiment with an audio amplifier, which I decided not to keep.

The voltage follower is the simplest possible op-amp circuit:

I used one half of an NE5532, as that’s what I happened to have available, but any op-amp can perform this task of ensuring the output has a suitably low impedence level.

I’m not sure how useful the transformer is in this exact context, but I learned of its use with piezos from this Nic Collins video on YouTube and had bought a handful of them for this kind of use.

These pictures show how the piezo was fixed into the former Stylophone case, from the inside (L) and outside (R) in the place previously occupied by the tuning knob, which protruded from the bottom of the case.

The Micro:bit can also be powered through thie proto board: mine had a terminal block already installed in it for +3v and Ground; I powered the unit with a PP3 battery, as I am wont to do, so added a small adjustable voltage regulator before the terminal block, set at 3.3v.  This meant that the Micro:bit was receiving its correct voltage, but more volts (up to 9v) would be available for any additional circuitry required.  Two LEDs show whether the 9v and 3.3v parts of the circuit are powered up.

While working on the inputs and outputs, I added the following: an external 9v power in socket; send and return sockets so that external tone controls (such as these) could be used; sockets for an external speaker or headphones and an external piezo; a line out socket for easier mixing or recording; and two sockets connected to analog input pins P1 and P2.

Pin P1 was connected to a 10k lin potentiometer, one end of which was connected to 3.3v, the supply voltage for this part of the circuit, the other to 0v; in this way a continuously variable voltage could be available at pin P1 for control purposes: the Micro:bit would interpret this as a number between 0 and 1023.  If something was plugged into the P1 socket, the potentiometer would be disconnected and the external signal read by the pin instead.

Pin P2 was not connected, unless something was plugged into the P2 socket.  A second 10k lin potentiometer, set up exactly like the one for P1, was added, terminating in a 3.5mm mono plug.  This was available to be plugged into the socket and used for the same purpose if a program were to require it.

In use, I found I had problems with the circuit if the PP3 battery wasn’t new or, if rechargeable, well charged; fortunately, with the external socket it would be possible to use a mains adapter.

*

I set the mIcro:bit up to make some trial tones, but the sound was rather quiet, through both speakers and piezo, so I added a small amplifier.  This was a very economical (99p) module from a UK eBay seller, based on the PAM8403 chip.  This is a 3W stereo amplifier chip, but I would only be needing one of the channels.

It required a 5v supply, so I powered it from the 9v source and added a small 7805 5v regulator.

7805

I put a 10k log volume control before the amplifier input, with the line out socket between the volume control and the amplifier input.  If a plug is inserted in the line out socket, the signal to the amplifier is cut.

After the amplifier there is a 3-way switch to choose between internal speaker, external speaker or headphones, and piezo element.

The following picture shows the majority of the interior at the end of phase 1 of construction (but before I added the two LEDs):

Features marked: 1 = the original Stylophone switch PCB, repurposed for 9v on/off and 3v on/off; 2 = volume control; 3 = the original Stylophone speaker; 4 = the 5v voltage regulator and amplifier PCB; 5 = the 3.3v voltage regulator PCB; and 6 = the 3-way audio output switch (internal speaker/external speaker or headphones/piezo element).

On the exterior I added three tactile switches to replace the two switches A and B on the front of the Micro:bit.  The first two switches simply duplicate the effect of the two switches on the Micro:bit; with the aid of a couple of diodes and a 4066 digital switch i.c., the third tactile duplicates the effect of pressing A and B at the same time, an action recognised by the Micro:bit.

I didn’t add any pull-up resistors on the outputs of the 4066 as the Micro:bit already has these internally.

*

After this I had a working module, so it was time for some programming!

*

I started with a couple of simple programs to make use of the light sensitivity and magnetometer functions.

While experimenting, I connected the Micro:bit to my Macbook with a USB cable, opened the Chrome web browser and wrote the programs using MakeCode on the microbit.org website.

The following picture shows the main features of the coding page:

1 = the simulator.  Most – but not always all – of the coding you write is automatically simulated here.  As you can see, the first instruction of my program, to display the number 1, is shown, as is the indication that I have chosen instructions which require the speaker to be attached;

2 = the button you press to load the program into your USB-connected Micro:bit.  WebUSB has not yet been implemented in most web browsers, which is why I use Chrome to do this.  Incidentally, if you’ve made any syntactical errors in the program, you will be told when you click this button;

3 = the area to name and save your program as a hex file.  The alternative way to program the Micro:bit is to open its window and drag and drop a hex file onto it;

4 = where you choose to program using the blocks, as I have done, or to write the code in Javascript;

5 = the area where the program is written.

*

As for my first program: the light control on the Micro:bit takes advantage of the fact that if the current to an LED is inverted, it becomes (slightly) sensitive to light.   The Micro:bit has an array of 25 LEDs on it, and it’s possible to use 9 of these together to record light levels on and around the device.

I found that the most useful way to use this feature was to set the Micro:bit up to sense the ambient light level, and then react to brighter lights being shone onto the LEDs, rather than the other way round (i.e. reacting to being shaded from the ambient light).

In this case, the reaction I programmed was to sound a note, then increase the pitch of that note as the light level increased.  Initially I just used the torch in my mobile phone, but I had already made 2 devices which could be used to control the Micro:bit in Light Reactive mode, the UFO and the Shuttlecraft.

As I said, the Micro:bit was programmed to start up in a waiting state and display the number ‘1’:

Then, when its Button ‘B’ was pressed – or the Button ‘B’ on the top of my module – it would run the part of the program related to the Light Reactive Instrument and display the number ‘3’:

The Micro:bit outputs a number between 0 and 255 to represent how bright the light level is.  0=dark and 255=bright.  The variable lightlevel in the program is set to be 20 times this number, i.e. between 0 and about 5,000.  The opening pitch chosen, 220Hz (the note A below middle C) and the range of values represented by lightlevel is designed to allow the Micro:bit to output pitches between 220Hz – a low to medium note – and about 5kHz – a very high note.

The variable lightambient is used to sample and remember the normal light level around the instrument on startup.  If the light level is no greater than this, the instrument makes no sound, the idea being that it should remain silent until a light is deliberately shone on it.

*

The second simple instrument I programmed was, in essence, the same thing, but reacting in this case to the presence of a magnet.

The Micro:bit measures magnetic force, as it says above, in microteslas (µT).  It turned out that the range of readings it gave did not need scaling or multiplying like the light level readings did, but produced a useful range of pitches without any changes.  So in this case the variable magforce was equal to the microtesla reading and gave rise to an output at the same Hz as the reading.

In this case, a magnet in the vicinity of the Micro:bit caused a pleasing arpeggiated effect, increasing in pitch the closer the magnet came to the Micro:bit, and decreasing as it was moved further away.

Again, the variable magambient was inserted in order to stop the instrument from sounding until the activating magnet was intentionally brought close to it.

I bought a neodymium (NdFeB) magnet especially for this purpose, as these are particularly powerful – up to 20 times as powerful as conventional ferrite (iron) magnets, in fact.

Neodymium magnets are graded from 28-52 according to their strength.  This one was an N52 (highest power) type.  It works very effectively, but has to be kept well away from any metal parts of the instrument – indeed metal parts of anything – as it will stick very easily and very strongly to them.  I wasn’t sure, but it even seemed to be affecting the speaker in some instances – a speaker, of couse, being driven by a magnet.

The only negative thing about this second instrument is that every time you reboot the Micro:bit, the compass/magnetometer has to be reset if you come to use it.  This is not, unfortunately, a simple matter, as you have to turn the Micro:bit every which way, with your progress shown by the LEDs lighting up one by one.  Only when all 25 of them are lit can you proceed.  This is obviously critical, if you genuinely want an accurate compass direction, but not so critical if all you want to do is make entertaining noises . . .

*

As I mentioned earlier, I had added two potentiometers connected to analog input pins P1 and P2.   I didn’t have an immediate use for these, but I thought it would be handy to have two variable inputs – for tuning or transposition, for example.

In preparation for Phase 2 of the instrument, I made use of the input to pin P1, and programmed it in the following way:

At the beginning of the program the potential input from pin 1, 0 – 1023, is divided into 21 equal sections, and scaled down to 0 – 20.  Each of the 21 divisions is numbered. ‘notenumber 0’, ‘notenumber’ 1′, ‘notenumber 2’, etc.

There are 20 notes on the former Stylophone keyboard, so there is one number for ‘off’, and one number for each note on the keyboard, ranging from 220Hz (‘Low A’) up to 659Hz (‘High E’).  When the potentiometer connected to pin 1 is turned fully anti-clockwise, the instrument is silent; as it is slowly turned clockwise, each note is stepped through in turn, until the highest note, ‘High E’ is reached.

This experiment proved that it should be possible to connect the keyboard to pin 1 and use the Micro:bit like a Stylophone.  This what I intend to do in Part 2 of this series.

Meanwhile, here are some recordings of these two instruments.  There are 8 short recordings, following this pattern: first the Light Reactive instrument through the internal speaker, external speaker, internal piezo element amd external piezo element; then the Magnet Reactive instrument through the same four media.

The recordings with the external piezo, glued to the bottom of the tin, are particularly interesting.  My experiments with piezos (beginning here), have so far only been in using them as microphonic elements, in particular as contact microphones, and as part of custom-made percussion instruments, and although the introductory article refers to their use as speakers, this is the first time I had actually used one that way.  Hopefully, there will be an opportunity to complete my survey of piezos by looking into this in more detail.

The tin, in fact, had been prepared for use as a kind of drum – and could easily function that way if attached to a suitable preamp.  It is quite large in size – 22cm (about 8.5″) in diameter and 14cm (about 5.5″) deep – and would make a very effective drum.  In this instance, using it as a speaker adds a noticeable reverb effect to the sound of the Micro:bit instrument.

 

 




andymurkin

May 2020
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Enter your email address to follow this blog and receive notifications of new posts by email.