Bagpipe chanter playing robot. A chanter is a low cost device allowing you to learn to play the bagpipes. It resembles the important part of bagpipes, i.e. the part that plays the main tune with a reed and finger holes, you just blow down it for now until I can make a suitable air pump.

Here it is playing the Star Wars theme: Click Here

here playing the riff from Thunderstruck by AC/DC (sort of): Click Here

and here playing Amazing Grace: Click Here

The brain is an Arduino Mega 2560.

The encoding of the music within the Arduino code is a custom system I have come up with (more later).

I particularly wanted it to have "hands" with moving fingers which played the notes and so I have used an off the shelf open source design of 3D printed prosthetic hand called a Raptor-reloaded, from the Enable project for 3D printing prosthetic hands for matched recipients in developing countries: www.enablingthefuture.org

The finger tips are lifted off the holes of a bagpipe chanter with 12V DC solenoids.

The solenoids are controlled by the Arduino board via opto-isolated MOSFETS which can be bought on low cost boards fully assembled in groups of four.

This makes a good project for an automaton:

i) The air flow is constant, ii) Notes are played by lifting fingers in groups off the holes so solenoids are not active all the time, iii) Only 8 "fingers" required (actually 7 fingers and one thumb), iv) A basic chanter is not expensive, v) As the air flow is constant, melody notes are separated by "grace notes" and "doublings" which can be thought of as all the fast sounding extra notes between the main notes that you can hear when pipes are played, there are various rules and finger sequences governing these that lend themselves to logical description in a computer program.

My "rules" on which the code was written were obtained from this website on how to learn to play bagpipes:


I used the "rudiments" index for my program rules so clearly there are other finer aspects I have not encoded yet!

An outline of how my program encodes the music is given in the last step. It will allow you to understand the Arduino code just about.

Note: The easiest way to do this, probably musically better as well, is to turn the chanter on its side and arrange solenoids so they push directly onto the holes. There are 3 or 4 videos of systems like this on YouTube, see below. Examples include Andrew Schaff, Neil Traser and the great "McBlare project from the Robotics Dept. of Carnegie Mellon University (RB Dannenberg). However I wanted moving fingers, because they look so cool for one thing and in time I can add arms and a head.

And the great McBlare project. There is an interesting downloadable book chapter on this here:



Main parts listing (each given in more detail in appropriate section)

Solenoids x 8: ZYE1-0530 DC 12V 1A 10mm Stroke Push Pull Type Open Frame Solenoid approx $5 each.

MOSFET board for Arduino to control solenoids, x 2: "Trigger Switch Module 4-Way FET" $10-15

Single sided 3mm thick foam tape 100 wide.

Arduino Mega 2560

Short piece soft plastic tubing approx 3mm diameter.

Bagpipe chanter, example for about $20 given later on.

Wooden board.

Assorted 15mm screws to fix items to wooden board.

12V battery or mains adaptor capable of taking a 5Amp current draw.


Hot melt glue gun

3D printer, hobby level OK, mine is a pre sell-out plywood MakerBot which works just fine by the way.

Length of tube to connect to chanter to blow through (have not made an air pump yet).

Step 1: Print the Hands, Fingers and Clamps to Hold the Chanter. 3D Files Attached.

The files for the hands and fingers are freely available online from the enable project link on the title page. You need to 3D print them at a scale of 1.71, i.e. 171% i.e. big!

The reason for this is that at this scale the finger spacing almost exactly matches the spacing of the holes on the my chanter. I assume this is true for all chanters but that is what was required for mine anyway.

All the parts will need filing and fettling to make them fit together nicely. Each pair of fingers hinges at the knuckle via a long pin as shown. Make sure they are not so loose they wobble from side, but move freely up and down.

The joint in the middle of each finger is to be glued so it does NOT bend and flat part of finger presses down flat on the holes of the chanter.

To begin with I would mount your chanter securely on a wooden board. I have made some clamps for you to do this which may need slight modification for your chanter. I designed them in google sketchup and then converted to .stl files for printing.

Files are attached for both the chanter clamps.

Step 2: Angled Platform to Hold the Hand in Correct Position. 3D File Attached

The palm of the hand is glued to an angled platform which raises to correct position relative to the chanter.

The platform is correct for both left and right printed hands and the file is attached as .skp and .stl versions.

Step 3: View of How the Hand Mount Relative to the Chanter

The chanter is mounted on a board using the clamps (3D files already provided).

The chanter is raised up slightly from the board as there has to be space for a thumb mechanism to cover one single hole on underside of the chanter.

See here how we glue the hands onto the board, on their angled mountings, so each finger will LINE UP with its respective hole on the chanter.

Also I have given you a photo here representing the sort of wooden low cost chanter I used.

Step 4: Print Out All the Hand Parts. 3D Files Attached

Having mounted your chanter, with the holes pretty much level in relation to the wooden board, you need to get the hands printed out. This takes a while.

Fingers are all identical. You do not need to print 2 extra ones as "thumbs" except for cosmetic reasons later on.

For now print 7 sets of fingers, a right palm, a left palm and the various pins. You need to print 4 knuckle pins (one per finger pair).

Parts attached, also available from the enable website on front page.


Step 5: The Thumb. 3D Printed Parts.

There is a hole at the top on the underside of the chanter. This is pressed normally by your thumb. I had to design a device to do this resembling a small "see-saw" where a solenoid lifts one end, causing a foam pad to be removed from the underside of the chanter, i.e. uncovering the hole. It is returned by a spring when the solenoid de-activates.

Here you see the mounting structure, a pivot pin, and the part that tilts, all 3D printed. I use 3mm thick self adhesive foam for the pads that occlude the holes on all the fingers.

The 3D files for this "thumb" arrangement are attached.

Step 6: Fettling of the Proximal Part of Each Finger

Look at where the finger hinges at the knuckle. There is a groove for a nylon "tendon" which originally was intended to make the hand grip when used as a prosthetic. We need to widen it as in this image as a long coiled spring is going to travel along it. Do this for all 7 printed fingers.

Step 7: Finger Mods Continued

Take a large paper clip and bend it to this kind of shape.

Step 8: Finger Mods Continued

Hook it through the proximal finger 3D print so end sticks out towards knuckle end as shown. Make sure you use the correct end of the 3D printed "proximal" finger component. Do a test assembly of the whole hand first.

Step 9: Finger Mods Continued

Loop the end of the wire over and cut it to size as shown. We loop it through a long spring as shown. Try to make a full loop so spring does not keep detaching itself.

Step 10: Mount the Fingers

I am showing you this so you now see how this goes together. The springs will pull through the "tendon" holes in the body of the hands and will attach to wire from paper clips. In this way the downward force each finger makes when "pressing" over the holes in the chanter can be adjusted by adjusting the length of the wires that the springs attach to on the top of the hand. If not pressed hard enough the holes will leak and it will sound terrible. If pressing down too hard the solenoids will not be able to lift the fingers off the holes.

Step 11: Even More Finger Mods

The flat part of each finger will press over the holes, NOT the finger tips.

In this 3D model there is a recess where this flat part should be so I am simply filling it in with a hot melt glue gun.

Do this to all fingers. I mount finger upside down horizontally while the glue sets using a blob of blu-tack on the bench.

Step 12: Aligning Fingers With Chanter Holes

OK, nearly done with the fingers, they are quite important after all.

I mentioned we are going to use self adhesive 3mm thick foam as the pads that press on the holes. Where exactly on each finger do we stick them?

I found easiest way was to glue the mounting frames / white "palms" of each hand in place so the fingers line up with the holes, with a small amount of hot melt glue so I could unpick it again if they were not quite aligned with the chanter holes.

I then attach each finger to the knuckle joints one at a time, with some blu-tack in place of where the foam pad will go.

I then press the finger down over its respective hole and remove it all again. This shows you where the hole will come relative to the finger and so where to attach the foam pad, as in this photo.

Step 13: Fingers, Still....

Here I am with fingers assembled in sequence of pressing down using blu tack imprint method, then adding foam pads.

Note how the joint in middle of each finger has been glued in a fixed position so that the flat part of the finger is flat against the hole, not covering it at an angle, which would then be harder to make an airtight seal with.

Step 14: Finger Preparation Final Step

Stick the foam pad onto the flat part of the finger.

You can cheat and mount it on a film of hot melt glue if you want a perfect profile adjustment.

Notice how I have also cut a small recess in tip of finger for the rounded tip of the armature of the solenoid to engage with. I lined it with glue gun glue as the finger is more or less hollow.

It is worth taking time over this and being methodical as if the holes do not seal the device will just make random noise.

Step 15: Thumb Mechanism on Underside of Chanter

Two things shown here.

i) The "see-saw" thumb mechanism we mentioned earlier.

ii) Look away now in horror bagpipe experts: I have filed the holes flat on the chanter, ever so gently, so the foam pads make a seal more easily when pressed onto them. Sorry, I am sure this is very wrong but it does the job. I am using a very cheapo chanter anyway.

Step 16: Thumb Solenoid

More info on solenoids later but see how the solenoid slots down into a 3D printed square hole which is a part of the mounting for the thumb lever mechanism. You slide the solenoid up and down to get its height just right, then glue-gun it into place as the last step.

Step 17: Thumb, More

Here I have made a little hole in the end of the thumb lever and attached a fine coil spring which holds the thumb pad up against the underside of the chanter when the solenoid is not active and is retracted, i.e. spring pulls downwards slightly.

Step 18: Putting the Solenoids In

The solenoids also have to fettled slightly, more in a minute.

Meanwhile here we see the solenoids in place in 3D printed holders. The solenoid armatures pop up, engage with small recess we earlier cut into tips of the fingers, and lift the fingers.

The solenoids are pushed up and down in their square holes and glued in place once the height of each one has been correctly worked out by assembling the finger above it, with foam pad on.

Step 19: Setting Up the Solenoids

The solenoids are mounted in 3D printed square holes. You slide main body of solenoid up and down with fully assembled finger above it and when in correct position, glue it into place. The tip of the armature of the solenoid engages with recess you cut earlier into tip of the finger. Leave 2mm gap so finger can press fully over hole without hitting top of armature.

Step 20: Numbering the Fingers. Solenoid Holder 3D Files.

The fingers are numbered as shown and the Arduino sketch uses same numbers for each finger.

Also, since each of your fingers has now been custom fitted to its respective hole in the chanter, it is wise to number them for this reason too, they are no longer interchangeable!

The 4 fingers on the left (numbered 1 to 4) have their 4 solenoids held in a 3D printed structure.

Fingers 5 and 6 are held in another 3D printed structure and finally finger 7 has its own solenoid holder.

The three 3D printed solenoid holders defined above are attached to this step as both .skp and .stl files

Finger 7 is a pain. Notice how its knuckle does NOT quite line up with the last hole on the chanter. I glued the proximal and distal 3D printed parts of this finger together at an angle so the finger looks bent towards lower edge of this photo. This was deliberate to get it to cover the hole properly with its foam pad. This is why I made the holder for solenoid 7 as a separate 3D print so I could move it around slightly on the wooden board.

Step 21: About the Solenoids

I used cheap solenoids. However the ones I started with were not quite powerful enough. The ones that were not quite powerful enough were rated at 4Newtons force and 10mm travel. The ones that worked were in effect the next size up and still pretty low cost. These were 1Amp, 10Newton force, 12Volt as in photo and listed below.

Correct one: ZYE1-0530 DC 12V 1A 10mm Stroke Push Pull Type Open Frame Solenoid

Wrong One DC 12V Open Frame Solenoid Electromagnet 4N Holding Push Type

They also need to modified very slightly.....

Step 22: Solenoids: Remove End Cap Nut

The solenoids do not create their full lifting power over their whole 10mm range. They seem to generate most power when the armature is about 4mm further inside the coil than in their default start position. If not modified like this they will still struggle to lift the fingers against the finger tensioning springs.

So, step 1, unscrew the cap screw (it is only finger tight) from the end and slide the black O ring down the shaft by about 4mm.

Step 23: Solenoid Fettling

Cut a 4mm length of plastic tube, I had some lying around, and push it over the solenoid end as shown.

Step 24: Solenoid Fettling 3:

Replace the cap nut and slide tube and O ring back up against underside of nut.

We have now in effect moved the bump stop along the shaft of the armature of the solenoid by about 4mm. When energised it will now generate a lot more force and travel about 6mm. For me this worked really well as a modification.

Step 25: Odds and Ends: Springs

The finger tensioning springs were from a boxed set. According to the box they are 4.8 x 44.5mm if that helps people.

Step 26: Odds and Ends: Foam Tape

The foam pads used on the fingers/thumb were 3mm thick 10mm wide, make sure you buy single sided adhesive foam as most of the foam for sale like this is double sided, which you do not want.

Step 27: Power Electronics

The electronics are not too bad.

The solenoids are driven by two of the above boards attached to an Arduino Mega 2560.

These can be thought of as 8 relays controlled by the Arduino digital output pins. They are not really relays but MOSFETS which can be turned on and off by the Arduino board and send DC current to the solenoids.

You need 2 of these boards as 4 channels per board.

Step 28: Wiring Up

Each solenoid is attached to the output side of each channel of the board. Remember the step where I numbered the solenoids and showed where each one wires into these boards.

The wires from each solenoid can go in either way around BUT there needs to also be a diode added as shown for each one and these DO need to be the correct way around as shown in the figure. These help the coil de-energise quickly and safely after each activation.

A 12V DC supply has to be provided at the 2 contacts shown in the photo. I used a lead-acid battery as plug in mains 12V DC power adaptors did not seem to react fast enough to the sudden current requirement (1 Amp per solenoid), up to 4 active at one time, from each solenoid.

Step 29: Diode Close Up

Closer view of the diode. Make sure you get them all the right way around.

Step 30: Numbering

The solenoids are to be wired up as shown.

0 is the thumb hole on the back of the chanter.

Running down the front of the chanter the 7 holes are then numbered 1 to 7.

This is how they are defined in my Arduino code also so best to stick to this arrangement.

Step 31: Connect the Arduino

The Arduino wiring is pretty simple to the MOSFET boards.

Wires from 8 of the Arduino digital pins (described in the Arduino code) run to the +ve input side connectors of the MOSFET boards. All the -ve connections on the MOSFET boards are then joined together and return to one of the GND pins on the Arduino.

Step 32: Mechanical Debugging

The main problem to be adjusted out is the problem of finger pads not properly occluding the holes in the chanter.

My way to debug this was as follows:

When you run the code you will find that each finger lifts individually in the order 0-7 at 1 second intervals. This does not play notes BUT if you blow through chanter, you should hear the tone change as each individual finger is lifted and then replaced.

To debug:

i) Wrap each hole with insulation tape leaving a folded over tag on the end of each piece of tape.

ii) Replace all the fingers in position with springs all tensioned.

iii) First: Check the solenoids do actually lift each finger when Arduino started up. If not, you have an electrical fault OR the tensioning spring on that finger needs to have its tension reduced slightly (rework the length of the wire paperclip used to tension the finger spring over back surface of the main (white) body of the hand as seen in photos).

iv) Unwrap tape from hole 0. Reset Arduino and see if tone changes as thumb lifts from that hole and then goes back to same deep tone you started with.

v) If (iv) is a success, repeat this by removing tape from hole 1 (using tweezers or long nose pliers grasping the tag you left on the end of the tape covering the hole, to remove the tape without having to dismantle the whole thing).

This way you can sequentially track down a dodgy finger that is not properly covering its hole on the chanter.

Step 33: Arduino Sketch and How the Music Is Encoded

Arduino sketches attached.

The first lifts each finger in sequence, then plays "Amazing Grace".

The second does the same then plays "Highland Cathedral" rather badly.

I have developed my own music encoding system which may have faults but works as follows:

I encode each note with 3 characters:


LowG: All holes closed represented in the code by the character: G

LowA: Hole 7 lifted all others remain closed represented in the code by the character: A

B: Lift 6+7 represented in the code by the character: B

C: Lift 5+6 represented in the code by the character: C

D: Lift 4+5+6 represented in the code by the character: D

E: Lift 3+7 represented in the code by the character: E

F: Lift 2+3+7 represented in the code by the character: F

HighG: Lift 1+2+3+7 represented in the code by the character: H

HighA: Lift 0+1+2+7 represented in the code by the character: G

I also have to encode how long a note is to last for:

Full note: 32 units of time.............................ASCII character j

Half note (minim) : 16 units of time.............................ASCII character Z

Quarter note (cotchet): 8 units of time.............................ASCII character R

1/8th note: 4 units of time.............................ASCII character N

1/16th note: 2 units of time.............................ASCII character L

1/32nd note: 1 unit of time.............................ASCII character K

Subtracting 74 from the numerical value of the ASCII character gives me values between 1 and 32 for the note durations.

In piping there are also gracenotes and doubles which serve to divide up the main notes as the air flows past the reed all the time.

Gracenotes have same duration as 1/32nd notes and in the rules I have written, if a main melody note has a gracenote in front of it, it is shortened in duration by a corresponding 1/32 as these gracenotes are not "officially" part of the main tune but embellishments that admittedly make it much more interesting.

There are also "doublings" which can precede the main melody notes. These usually are a sequence of 2 or 3 notes played very rapidly each again given a duration of 1/32nd in my code.

Gracenotes are coded as: Ggracenote: g Dgracenote: d Egracenote: e

(there are others which are not in my code yet). There are rules on the finger sequences required to play each of these depending on the preceding and following notes and these sequences are included in the code.

Doublings are encoded as: LowG: 1, LowA: 2, B: 3, C: 4, D: 5, E: 6, E: 7, F: 7, HighG: 8, HighA: 9.

So for each main melody note, it has been encoded as three ASCII characters in the sequence:

First character: If there is a gracenote or double, use symbol for that, otherwise use a dash symbol "-"

Second character: Define the main melody note to be played (i.e. A,B,C,D,E,F,highG,highA)

Third character: Define duration main note is to be sounded for (this is automatically slightly shortened if there has been a gracenote or double in front of this main note): Use characters for number of 32ths of time it is to sound for i.e. j,Z,R,N,L,K

so gAR would be note A with a g gracenote in front of it and to be played for 8/32 arbitrary units of time (automatically reduced by 1/32 since there was a gracenote before it which lasted 1/32). I am not sure this is how pipers play gracenotes in the real world however, their timing appears to be down to personal interpretation.

The notes then form a sequence of triplets of letters separated by a space and the code just works its way along the sequence, playing the notes.

I appreciate that this needs improving but my reasoning is that so long as the mechanicals are correct and they respond rapidly then in theory at least it should eventually be able to play really well, depending on how much I improve the control software.

My "rules" on which the code was written were obtained from this website on how to learn to play bagpipes:


I used the "rudiments" index for my program rules so clearly there are other aspects I have not encoded yet!

<p>I think this one is going to win!</p>
<p>What a wild project!</p>
<p>I know!</p>

About This Instructable




More by XenonJohn:Ardu McDuino: Bagpipe playing robot (chanter) Star Wars Maz Kanata Inspired Glasses Music & lights in childproof case 
Add instructable to: