Copper Pipe Auto-Glockenspiel

by CamsLab in Circuits > Arduino

12423 Views, 95 Favorites, 0 Comments

Copper Pipe Auto-Glockenspiel

20231212_030126453_iOS.jpg
20231212_030115102_iOS.jpg
Copper Pipe Auto-Glockenspiel

If you love music and automation then this is the project for you! Behold, a combination of simple copper pipes, custom PCBs, 3D printed parts, some aluminum extrusion and an Arduino Mega. This project may not be for everyone but the finished product is well worth the investment!

The inspiration for this project came from my recent fascination with solenoids. I wanted to make a musical instrument with them but at first I couldn't decide what to build. A lot of demos with these small solenoids use glasses filled with different amounts of water but I didn't like how temporary that setup would be. I had also considered using solenoids to play the keys of a piano or a keyboard but not only would this bring it's unique set of design challenges, it's likely the solenoids would create an unwanted clicking sound when hitting the keys. That's when I found copper pipes. Other people have made there own versions of these as they are simple to build but I didn't see any that were automated. Since the solenoid hitting the pipe is the desired sound, this project is as simple as holding a solenoid next to a pipe!

Supplies

At a minimum these are the high level supplies needed to make this project:

  • 1/2 in. copper pipe (about 10' total)
  • Pipe cutter (handheld)
  • 3D Printer
  • Fishing line
  • 20mm aluminum extrusion (or support material of your choosing e.g. wood)
  • 5V solenoids (ROB-11015)
  • Power supply (20W+)
  • Arduino
  • FET
  • Flyback diode
  • Jumper wires

The schematics below can be copied for component values.

One cool thing about this project is you can make it large or small and the costs scale pretty well. I wanted to make a bigger glockenspiel but decided to start out with a reasonably sized (15 pipes) as a proof of concept.

Circuit Design

LTSPICE.jpg
LTSPICE2.jpg
Without 470uF.png
With 470uF.png

The first step in this project is to design the circuit that will control each solenoid. I first started in LTspice by creating a circuit that would drive a solenoid with enough current. Since solenoids require (~1A) a lot more current than an Arduino can output (~40mA) a power FET (IRL520) is used to connect the solenoid to the power supply. A flyback diode is added to absorb the current when the solenoid is turned off as it is inductive (current wants to keep flowing but would have no where to go without the flyback diode). These are all you really need and there are plenty of examples online on how to power solenoids if you need more information.

However, can you spot a potential problem with this design?

This design works by driving the Arduinos 5V output high to drive the solenoid for a brief period, and then driving it to 0V. But if it is stuck or left at 5V, current will continuously flow through the power FET and the solenoid. These could damage either component or strain your power supply if it is undersized. At the very least it will cause things to heat up and that is not the goal here.

The circuit shown uses 3 BJTs (2N3904) to solve this issue. Q1 and Q2 work together with C1 and R4 to hold the FET open for a fixed time (determined by the time constant of C1 and R4) and then turn off. A 5V positive edge from the Arduino is all that is needed to start this pulse. Q3 is there to hold the base of Q2 negative for the full duration of the desired pulse length. This means that an instant 5V pulse from an Arduino is all that is needed to drive each solenoid appropriately. And if the output is stuck high at 5V the FET and solenoid will be off.

That means Arduino code can look like this:

digitalWrite(C7, HIGH);

digitalWrite(C7, LOW);

delay(milliseconds);

The large 2000uF capacitors are there to provide local energy storage for the solenoid so the power supply does not need to provide a spike in current.

This is shown in the screen shots taken from a Siglent oscilloscope (the difference between the blue and green traces are the current from the power supply). With the bulk capacitance the current rise is more gradual from the power supply.

That being said, I found the circuit works fine without the capacitors. Feel free to design this circuit however you wish (I also added an indication LED on the right side of the picture). Once you are happy with you circuit design it is time for step 2!

Custom PCB

Schematic.jpg
Layout.jpg
3DView.jpg
3DView2.jpg

If you like making your own PCBs, this is a great opportunity! This project has a lot of repeated circuits that custom PCBs can really help out with. If not, there is no harm in using perf-boards or even breadboards.

I knew I was going to order my PCBs from JLCPCB and they have an order minimum of 5 so I decided to put 3 circuits on each, leaving me with 15 total circuits. I made one schematic page and copied the circuit from the previous step over. The only additional things are mounting holes and screw terminals for power.

I used KiCAD for this design as I find it intuitive to use and they already have a lot of footprints ready to go.

After schematics it is time for layout. I used a 2 layer PCB with only a ground fill on the backside. I also used through-hole components which take up more room but can also help out with layout, as it is easier to route traces underneath them. They are also a bit easier to hand soldier.

Copper Pipes

Spreadsheet.jpg

Now it is judgment time. How accurately can you cut your pipes? If you are like me and want each pipe to be not audibly out of tune, then the smallest pipes will require about 0.01" accuracy. Let's take a step back first.

Copper pipes resonate at a fixed frequency depending on their diameter, mass (density) and length. If you only use on kind of pipe (1/2 in.) you can vary the pitch by varying the length (shorter = higher frequency). But how do we know how long to cut each pipe?

We don't exactly. At least, it depends on a number of things that aren't easy to measure (temp, pressure, slight variations in the pipe) and compared to the tried and true, trial and error method, calculating everything would be a waste of time. That being said, there will be some calculating:

The frequency = a constant / (length ^2)

We don't know this constant and it changes slightly with different length of pipe so I found this method is best:

  • Cut pipe
  • Measure frequency (I suspended it on some rubber bands and hit it with a drumstick)
  • Use Audacity to analyze the waveform and find the peak frequency
  • Measure the length of pipe you have and with the frequency calculate the constant
  • Use that constant now to calculate the length (shorter) needed to be at the desired frequency (e.g. A7 = 3520Hz)
  • Compare the desired length to the current length and find how much needs to be removed
  • I found around 0.05" to 0.2" to be pretty accurate. Any more and it will be harder to hit the right frequency
  • Finally start over because you overshot it again and are running out of pipe (jokes)
  • Watch the attached video to see the frustrating find that one pipe had 2 different resonant frequencies depending on which way it was turned.
  • Repeat these steps until you have enough pipes

I also attached my calculation spreadsheet. You can use these lengths as references but yours will almost certainly be a bit different.

I used +-5 cents tolerances as humans can't really distinguish different frequencies in that region (+-5% the distance to the next note).

Mounting and CAD

20231208_051529859_iOS.jpg
bcd25a03-a596-47e0-8b43-a6ba201bf275.PNG
20231203_224858270_iOS.jpg
20231206_070413399_iOS.jpg

The part I wrestled with the most on this project was how to mount the pipes to the solenoids so that they were close enough, not too close and didn't move over time. I started with using some 2x4s which are easy to work with but I couldn't figure out a good way to mount everything else. I leave it up to you to find your own solution (and save some money). That's because I ended up drawing everything in Fusion 360 and using aluminum extrusion because I could model it and order exactly what I needed.

I also heavy relied on my 3D printer (Snapmaker A350 with dual extruder). The dual extruder was very helpful for most of the 3D printed parts I created as I needed support material for most parts.

I mounted the 5 PCBs and the Arduino Mega across the bottom and I created some friction fit posts to suspend the pipes.

I used fishing line to suspend the pipes as it is cheap, non-stretchy and discrete. It also would not absorb much energy from the vibrating pipe. It is however a bit hard to grab and tie but I eventually found a good method of pulling one lone piece through each side and wrapping it along the way.

Programming Music

This part is simple but tedious:

  • Create each output to each note (int)
  • Create delay times (int)
  • In the setup routine
  • Set each pinMode to output
  • In the loop routine
  • digitalWrite(note, HIGH)
  • digitalWrite(note, LOW)
  • delay

And that's it. For the demo I programmed a few songs by hand. It's not the most efficient but for easy stuff it works well. If you wan simultaneous notes you can put multiple before each delay.

Enjoy!

Project Files:

https://github.com/Cams-Lab-GitHub/Copper-Pipe-Auto-Glockenspiel-15-v1.0

The programming potential is only limited by the number of pipes, and your creativity!