AutoStrummer
{This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com).}
The AutoStrummer can be placed over/into the hole of an acoustic guitar, and will strum the string set selected by 6 tactile buttons. A potentiometer allows for tempo control, and a menu system provides the user with a few rhythm choices for the strumming.
While time constraints did lead to some poor design choices (see Known Issues below), the end result worked! However, I had to modify my guitar string heights slightly by placing spacers at the bridge, so it may not work on every guitar right off the bat. Also, it's sized for my guitar, so it may or may not fit every acoustic guitar out there, I'm not sure. My guitar hole is 3.875" diameter.
Supplies
Tools:
- Screwdriver
- 3D Printer
- FDPD Upload chip to upload data to microcontroller
- 12-30V Power supply, 300 mA min.
- Acoustic Guitar (pretty much required)
Parts:
- 1x - Arduino Pro Mini, Nano, or other small sized micro-controller
- 1x - Voltage Regulator, Linear -- LM2940T-9.0
- 6x - Tactile Buttons, With internal LED -- TL1240GQ1JCLR
- 1x - 28BYJ-48 Stepper Motor, (5V Preferred, 12V seemed to have lower top speed)
- 1x - Potentiometer
- 1x - Microswitch
- 1x - Stepper Motor Driver Chip -- DRV8825 or Comparable
- 1x - PCB Prototype Board, 3cm x 7cm
- 1x - 2.1X5.5MM Power Jack -- EJ501A
- 6x - 470 Ohm Resistors
- 1x - 22 µF Capacitor
- 1x - 100 µF Capacitor
- 1x - 100 Pack of 4-40 Phillips Screws, 1/4" (will not use all 100)
- 1x - 100 Pack of 4-40 Phillips Screws, 1/2" (will not use all 100)
- 12x - 4-40 washers or nuts
- 2x - Spring
- 22 Gauge insulated wire, solid and stranded
- Various pin connectors as needed
- Cheap Guitar Pick (or you can use my STL file to print one)
- Foam or Cotton Balls
Additional Notes:
The spring I used was 1" x 1/4", from a Home Depot spring kit. I would not recommend this simply due to the force required to compress it. If you can find a weaker spring equally sized (or even a smaller diameter), it would really make putting this on a guitar a lot less of a pain.
The potentiometer and microswitch I used were scavenged from old hardware, so sourcing their exact match will be difficult. The microswitch base can be custom printed to meet the size of whatever one you use. For the potentiometer, a spacer can be used if needed to boost it to the appropriate height. If you can't find one that fits, it can be left out completely, and the circuit modified so that the appropriate pins would always see 5V (so it will play at fasted tempo all the time). See the Circuit section below.
Printing
The first step is to print each part out! While there are some identical components, I have included every part with a unique file. So just print every file provided.
All of the STL files can be found in the .zip file. Instructables won't let me upload a zip file for some reason, so just delete the '.txt' and it will work as a normal zip file.
Downloads
Assemble LH and RH Bases
Here we will assemble the part that latches into the hole of the guitar. Each side is identical, so you'll just do this step twice!
First, screw each hole clip to the slide with 1/4" 4-40 screws and nuts. You'll want to see how the inside of your guitar's hole is structured, and place the feet accordingly so they'll fit (each foot has an offset flange). If you can't get the nuts started with the 1/4" screws, you can first use 1/2" screws and then switch the screws out once the nuts seat into the plastic.
For the last step, place the slide into the base, and pop the screw into position so that it sits in the circular grooves on each part. The spring I used (see photo) was a bit too strong, which made it hard to install on the guitar. Try to use a decently strong spring, but weak enough where it can still slide under reasonable force.
Attach LH and RH Bases to the LH and RH Mid-sections
Here we will simply screw the bases onto the mid-sections with 1/4" screws. Easy and quick! Each side should still be separate.
The photo is from later on in my build -- so don't worry about the foam yet, we'll add it later.
Assemble the Pick Box
To assemble the pick box, you will first need to cut a guitar pick to fit inside the box. You can either use the 3D printed pick itself, or use it more as a tracing guide to cut a real pick. I never tried the 3D pick, so not sure how well it would work.
Insert this pick into the box, and insert two pins into the holes to lock the pick in place. I had these pins on hand, but screwing or gluing in the 1/2" screws should work as well. At the very worst, drill the pin holes all the way through the box, and use longer screws with nuts.
Cut small squares of foam and put inside the pick box to keep the pick in the vertical position (each foam piece should be identical so forces are equal). If you don't have foam, I'm guessing cotton balls might work as well.
Screw the pick box to the pick slide and make sure to include the shim between the two. This ensures the pick is the appropriate height above the strings. You can always add more/less shims as necessary if your guitar strings are different. The shims I printed were too long and hit the pick, so I used metal cutters to trim them shorter.
Stepper Motor Modification
The stepper motor is a unipolar motor, so we first need to convert it to a bipolar motor. Basically, a unipolar motor just inputs the 5V current into the middle of each coil, and the motor driver chooses which half of the coil gets current to control whether that coil 'pushes' or 'pulls' the motor. However, the DRV8825 chip driver can send current forwards and backwards through the same pin, so we don't need to split the coil in half.
In the 28BJY-48's case, the red wire provides the power to the center of both coils. So we need to not only cut this wire completely, but also cut the trace on the motor's circuit board so the coils aren't shorted together at their middles.
Take pliers and pry/pull off the blue plastic cover of the motor chip. If you break it, that is okay as the motor will be safely covered by the strummer housing. Look where the red wire enters, and see how there is a center trace that runs to both coils. Scratch this trace with a metal screwdriver or something pointy to sever the connection. Check with a multimeter that the coils are no longer electrically connected.
Note: If you ever want to reuse the motor as a unipolar, all you need to do is re-solder the trace cut. However, make sure you don't clip the red wire short in this case, as you will want to have the wire again when you switch it back. I don't plan on using these as unipolar again, so I just cut the red wire completely.
Attach Motor and Pick Slide
First, slide one arm of the pick box slide into the square hole on the LH mid-section. I used some silicone grease here, but it's optional.
Next, push a metal pin into one end of the the stepper motor's arm. I had to use a bench press to press it in as it was tight. Then push the arm onto the output post of the stepper motor until it is fully seated. Not pushing it down enough will cause it to rub the cover when it rotates.
Lastly, screw the stepper motor onto the support post of the LH mid-section. Make sure to set the pin into the slot of the pick box so that when the motor moves it pushes the pick box side to side.
Attach the Feet and RH Side
Screw the dual-foot onto the back of the LH mid-section as shown with 1/2" screws. Then screw the single LH and RH foot onto each respective mid-section (the screw head should be in the mid-section's recessed slot, not the bottom of the foot).
Attach RH Side
Connect the RH side to the LH side with 1/2" screws through the stepper motor's mounting flange, the center post, and the back foot.
Assemble the Cover
Take the LH and RH cover pieces, and connect together with the half-circular slide cover using 1/4" screws. We won't actually attach this cover to the rest of the strummer until the very end, but you will want to push everything together and in place as you assemble the circuit to make sure things fit.
Add Foam
At this point, we can add some foam strips to the bottom of the strummer body where it would contact the guitar, and to the hole feet.
Cut squares just big enough for the clamping surface that would rub against the inner rim of the guitar hole. Use a glue stick to coat the foam, and then stick them to the plastic. Take two or three rubber bands and stretch them around all 4 feet, to make sure the foam sticks to the plastic as the glue dries.
After the glue dries, place the strummer body on the guitar by compressing the feet inwards and then down into the hole. You may want to screw on the top cover first as this provides a lot of the structural support when pushing in the feet. Once on the body of the guitar, place foam under the body and feet to help support it at an appropriate level, and to prevent scratching.
For my guitar, I ended up using two layers of foam on one side, and one on the other. So do what works.
Level Strings
While the strummer is on the guitar, move the pick across the strings (you may have to remove the motor arm to do this).
The guitar strings probably won't really be flat, which will make the pick box miss or get stuck on some of the strings. Look across the strings horizontally, and try to see which ones stick up too high, or not enough. Take the string shims and try to level the strings as best as possible by placing them between the strings and the bridge, so that the pick hits each string evenly. Use extra foam to raise the whole thing up if some strings are too high, or increase/reduce the pick box's shim (installed earlier). Just be careful to consider how everything will fit together in the end when changing shims!
Arduino Sketch
With most of the assembly done, let's get our Arduino chip software ready to go. The files are included here in the zip 'text' file, and can be compiled and uploaded as normal via Arduino IDE. I've also included the PinChangeInterrupt library.
The remaining program files were written by myself, partly as a learning experience and partly because the stepper libraries I tried to use weren't running my motor as expected for whatever reason (probably user error). You will want to modify the code so that the pins you use for each component are accurately programmed by changing the number next to the #define lines within StrummerMain.cpp.
If you find that you want to use a higher voltage and think it will let you play faster, you can change the maximum tempo by changing the value in the pot.max_tempo() function under Setup() in StrummerMain.cpp. This number is in Beats Per Minute.
Lastly, you can change the step positions that the stepper motor will use as points between strings by changing the values under struct stringPositions in GlobalVars.h. Care should be taken when modifying these, as setting them too high will result in the motor stalling out on the housing and losing steps. Also, it might be a good idea to back these up before changing them, as they were found initially by measuring angles in the CAD drawing and may be difficult to find simply through trial and error.
With the sketch ready to go, the last part is just uploading it into the chip. I used an FDTI shield board by SparkFun. This does require soldering a pin header onto the board, but makes it a lot easier to upload the sketches.
Downloads
Circuit Design Overview
The next few steps will involve the circuitry. The image above is the circuit diagram. For my project, I used a Pro Mini Arduino and a DRV8825, but the Pro Mini is supposedly not produced anymore by Arduino so you may have to find a 3rd party manufacturer. Also, the DRV8825 can theoretically be replaced by any stepper driver since they are all based on the same general pinout, but voltage limits would have to be considered.
Note: My 3D print originally was made for a ULN2003AN transistor driver board, but I later changed to a bipolar chip driver. Thus, I made a custom bracket to hold a small PCB prototype board for the additional circuitry. Depending on how you integrate your parts, you might need to make a slightly different bracket.
There are a few main components of the circuit, detailed below:
- Motor Driver Chip: This requires step, direction, 5v supply pins, 4 motor pins, and separate power and ground. The program will pulse the step and direction pins as appropriate, and hold 5V high during motor operation to the reset and sleep pins of the stepper driver. When the motor isn't running, the 5V pin will drop low to keep the stepper from getting hot as it otherwise tries to provide 'holding torque' to the motor.
- Potentiometer: Supplied with 5V, and connected to ground on the other. We read the potentiometer setting with an analog input pin to see what tempo to play the strummer at.
- 6 Tactile Buttons: Each button is connected to an individual INPUT_PULLUP pin. When the button is pressed, it will trigger an interrupt in the program. The program will then read all 6 buttons, and determine which ones are pressed (low voltage = pressed).
- Button LEDs: Each button has a unique LED within it, which helps the user use the program and menu. There are thus 6 unique LED pins, which route through 470 Ohm resistors prior to reaching the LED.
- Voltage Regulator: The 5V stepper motor runs best when higher voltage runs through a current limiting chip driver. In my project, I supplied 22V to the DRV8825 (which can handle up to 48V), but limited the current to about 160mA. The Arduino, however, needs 12V or less. The voltage regulator thus reduces the 22V (this regulator can only handle 26V max) down to 9V, which the Arduino can easily convert to 5V. Two capacitors, as marked on the schematic, help filter any surges before and after the regulator. The 22 µF is required, but the 0.47 µF is optional if you have a good power supply and the distance between the supply and the strummer isn't too great.
- Microswitch: The microswitch helps zero the stepper motor during operation, which can easily miss a step or two due to the changing forces as it crosses strings. This needs an INPUT_PULLUP pin to read when the switch closes the connection to ground.
The actual circuit construction will be left somewhat up to you. Because PCB prototype boards are a pain to wire (and this one has a lot going on for the small space), you will have to get creative in how to fit it all together. The main things to consider are space considerations to make sure everything fits together still in the end, and efficiency. By efficiency, I mean that many things like the grounds can be bussed together into single wires.
However, you can see in the images above and following steps how I ended up wiring mine, for better or for worse. I would actually highly recommend creating an actual PCB in KiCad or another program, to save space and headache. If I were to do this project again, this is what I would do.
Circuit Assembly: Voltage Regulator
The voltage regulator has three pins. The regulator input connects to the high voltage point on the 2.5mm jack and the ground of the regulator to the ground of the jack. The 9V output pin connects to the Arduino board's Vin. Lastly, solder the 22 µF capacitor from the output pin to ground, and the 0.47µF capacitor from the input pin to ground.
Circuit Assembly: Chip Driver
You will need to connect:
- 4 motor wires to A1, A2, B1, B2
- Step pins
- Dir pins
- VMOT to the high input voltage (pre-regulator)
- 2 GND pins to ground
- Reset and Sleep pins to 5V pin (needs to be a digital pin as program will turn this off/on)
Before actually connecting the motor, you will need to set the current limit using the potentiometer on the chip. Because 160 mA is so small (the stepper motor can is cheap), the pot will need to be almost at the full 0 position. You'll have to test which way this is, but I'm pretty sure 0 = Fully CW.
To test, plug the motor into the power source with the motor DISCONNECTED, touch a multimeter probe to the pot screwhead, and then touch the other to ground. Keep turning the pot until the appropriate reference voltage is read (you'll have to read the chip's datasheet for the specific voltage-to-current formula).
Circuit Assembly: Buttons and Arduino Board
Place each button on the prototype board so that they will fit between the squares of the strummer case as shown. Place a 470 Ohm resistor in each button's center for the internal LED. Solder the buttons and LED lines to pins, and then create a single ground bus wire for all the buttons and LEDs. Connect this ground bus to the board's ground pin.
The Arduino board can be soldered onto the PCB, offset to the side opposite of where the chip driver will sit. Take a lot of time to make sure there will be room, and really think out how you plan to lay out all the required connections. Refer to the schematic, and plan. It's a lot to put into a small space, so even a few mistakes will mean it won't end up fitting.
Circuit Assembly: Potentiometer
The potentiometer needs to be connected to 5V power from the board's 5V output pin (not a digital pin), and the other side to ground. The center is then connected to an analog pin. Direction doesn't matter, unless you want to control the actual direction of rotation for increasing/decreasing tempo. The potentiometer just sits on the post in my design (feel free to glue it). So whenever you're ready to assemble it, just plop it on and it's ready to go!
Attach the Microswitch
One lead of the microswitch connects to ground, and the other end to a digital pin. Direction doesn't matter, as it's literally just a switch.
Next, attach the microswitch to the mounting block using two 1/2" screws. Because the screws were too long, I added nuts as thick washers to reduce their length.
Next, take the microswitch mounting block, and attach it to the RH side loosely. You'll notice that the slots are oblong to allow for slight position adjustments. Screw in the microswitch, and adjust as appropriate so that the pick box just barely closes the switch when it is far right (but before it makes contact with the housing). Tighten the mounting block screws, so that the switch is secured at this position.
Circuit Assembly: Put It All Together
Route wires as appropriate. The housing has some slots for the stepper motor wires, and the photo above shows how I routed all the others. It took a bit of shoving together and bending (and a little bit of cutting of some of the plastic connectors), but I fit it all in there. Depending on how you do it, you could probably save a lot of space by smartly routing the prototype board.
You can see how nuts the wiring ended up being for my prototype board, as I severely underestimated the number of connections needed. If it looks messy, just do your best to fit it all in as smartly and neatly as possible.
Note: There is a central post to support the prototype board when the buttons are pushed. You will want to make sure no wires or soldered connections are in this central location on the board (it is offset slightly to the right though). Checking fit periodically as you put the circuit together is a must!
Upload the Sketch
Once the circuit is assembled, we can now upload our final sketch into the Arduino chip using the FDPD pins of the chip. You can theoretically do this much earlier, but you may find that your pin layout has changed during the assembly due to space limitations, or you may even cause corruption of the program after handling the chip during assembly. (This happened to me during some troubleshooting, and it took me a bit to figure out what was wrong. After re-uploading the sketch into the chip, the strummer suddneely worked again).
Screw It Up!
Once the sketch is uploaded, you can put everything together with the screws. Except for the stepper motor and the circuit board, the screws should all be 1/4" 4-40's. The circuit board needed really small screws, which I pulled off some scrap hardware (but you could easily buy smaller screws for this).
Play
You can now attach the strummer to your guitar. Compress the feet inwards, and drop them into the hole of the guitar so they clip in, making sure the back feet don't catch on the strings. Use foam to help level the strummer over the strings, and to also keep it from accidentally scratching the surface.
Plug your 22V power source (or other appropriately regulated voltage) into the jack, and the motor will zero. When it finishes zeroing, the LEDs will flash 3 times, and then it is ready to play!
You can press the corresponding string's button to play it, or make the motor play a range of strings by pressing two buttons at once. If more than two buttons are pressed, it will play up to the outer-most selected strings.
Use the potentiometer to control how fast the stepper motor strums the next beat. The fastest speed is still relatively slow due to using such a cheap stepper motor, but higher voltages could theoretically allow faster speeds.
Enter 'Rhythm Menu Selection Mode' by holding the outermost strings, and both innermost strings (1,3,4,6) simultaneously for 3 seconds. Once in menu mode, you can select different rhythms by pressing the two center flashing buttons (for up and down). The LED on the high E string flashes on the downbeat of the rhythm to help identify what beat it's on. And the low E button can be held for another 3 seconds to exit the menu mode.
Known Issues and Final Thoughts
There are some known issues with the current state of the project, some of which would probably benefit from a complete redesign. First, the stepper motor's speed and lack of power results in a very slow play speed.
Second, the program has a bug that I have not been able to identify yet, which basically causes the program to freeze up and stop playing occasionally. Simply unplugging the power and restarting solves the problem, but is rather annoying. Feel free to debug the program if you wish!
Lastly, the strings of a guitar are not as flat as one might initially think. The bridge of the guitar is actually curved, meaning that as the pick goes across the strings some are higher than others relative to the pick, causing the loudness of each pluck to change. And when the player presses a string, it changes this height enough to actually cause strings to not play at higher frets.
But enough of the pessimism! The guitar still plays, it was still a great learning experience, and it looks cool! I'm definitely interested in trying a second version at some point, and hope to improve upon the initial design. Maybe individual picks for each string to really get some riffs goin'?!