Sunday, January 25, 2015

Part 1, Hardware Design, BeatBuddy Tempo Pedal / MIDI Beat Clock Generator / OPEN SOURCE


This is Part 1, hardware design and schematic.


See Part 2 for parts list and build pictures.


See Part 3 for Arduino sketch.


See Part 4 for software design notes.



This is an Arduino based project to generate MIDI beat clocks, at a tempo set by an expression pedal  (a simple potentiometer or "pot" in a foot pedal.)



This project is for hackers/makers/musicians who want to control BeatBuddy drum machine (and/or other MIDI devices), using a foot-controller to set the tempo.

How much will it cost?  Under $50 in hobbyist electronics parts available at Amazon, Sparkfun, etc.  You'll also need an expression pedal, about $30, or you can repurpose a passive volume pedal (see below).

Skills required to build: soldering components, wires, perf board; building into an enclosure, with holes and cutouts for switches, connectors, displays.


BeatBuddy Tempo Control 
via
MIDI Beat Clock

Part 1, Hardware: 

  • Schematic
  • Circuit Design Notes 
  • Pictures

Part 2, Build Info:


  • BOM (parts list)
  • Lots More Pictures

Part 3, Software:
  • Arduino "Sketch" (source code listing)
  • Software Design Notes

All projects on mikesmicromania.com are open source, public domain.  I'll also try to answer your questions and give advice on building projects.  Just scroll down the bottom of this page and submit your questions and comments. 


My goal was to control the tempo on my BeatBuddy while playing guitar, without bending down to fiddle with tempo control or mess around with tap tempo.  Now I can easily vary the tempo up or down, using my foot, rapidly or slowly.  Along with a volume pedal, I get great artistic control of the BeatBuddy. 

Although designed for use with BeatBuddy, it could be used with any MIDI device that accepts the MIDI beat clock input.  I'm not sending any other MIDI commands in this project, as all I wanted was to easily adjust tempo while playing a song.  It wouldn't be hard to add some footswitches for MIDI transport commands: Start, Stop, Pause, Resume.  Another possibility would be a bank of footswitches to recall some preset tempo values. 

I've created an inexpensive but very functional pedal board, shown below, with volume and tempo pedals:


(Left to right): 
        • BeatBuddy (BB), with MIDI Sync Cable
        • this project (black box with LEDs)
        • (optional) BeatBuddy Footswitch (BB-FS)
        • (optional) Volume Pedal (e.g. Boss FV-50H)
        • Expression pedal (e.g. Behringer FCV100)
I joined a few pieces of wood together with gorilla glue.  The exact dimensions aren't important, but a few design features that worked out well and were easy to build:

  • Heel block, e.g. 2x3, for comfortable control of BB and BB-FS
  • Elevated base for BB-FS, to same height as BB
  • Volume and Tempo foot pedals comfortably mounted

Regarding MIDI, it's a serial interface, easily implemented with Arduino hardware and software (details below, and in Part 3).  I used a small project box, and didn't have room for a MIDI jack, so I hard-wired a short MIDI cable, with a standard MIDI connector.  And that plugs directly into the BeatBuddy MIDI Sync Cable.  The 5 pin MIDI plug is shown below, just below the 4 digit display:


The longer cable, with 1/4" TRS connector, plugs into the expression pedal, which is simply a "pot" (potentiometer).  If you've ever used a 10K pot to drive an Arduino analog input, this is the same thing.

I used a Behringer FCV100, for my expression pedal.  Frankly, it's so-so, at best, when used as a guitar volume pedal: it's noisy and it "sucks tone" from high Z guitar pickups, e.g. a Fender Strat.  But it works fine as an expression pedal ("CV" mode, switch on the side, near the Output2 jack).  And it does not need the 9V battery (yeah!) in CV mode.  About $30 on Amazon.

One point of caution, expression pedal wiring is not standardized, so if you're using some other expression pedal, make sure to check its wiring to get it properly connected.  (You can easily check it with an ohmmeter.  Leave a comment if you'd like details.)  And if you already have a passive (no battery) volume pedal, you can easily use a volume pedal as an expression pedal.

Ok, so here's the schematic:



I used a Moteino as a low cost, small form factor replacement for Arduino.  I highly recommend LowPowerLab.com, please check them out.

The power supply for the project is the de facto standard for guitar stompboxes: 2.1mm coaxial power jack, with -9V on the center pin.  The current draw is low, only about 15mA, and the BeatBuddy power adaptor has 200mA available.  (500mA supply minus BeatBuddy max current draw spec of 300mA).  So I grafted another power plug onto the BeatBuddy wall wart, and extended the cord by about 6 feet while I was at it:


Fuse F1 and diode D3 protect the Moteino, for example if power supply polarity or voltage are wrong.  The Moteino has an onboard 3.3V voltage regulator, spec'd for either 13V or 16V maximum, depending on vintage, according to the Moteino spec sheet.  So, 9 volts is nominal, but anything from 3.5V to 12V should work fine.  (But do watch out for cheap unregulated wall warts, a nominal 12V one might put out 18V with no load!)  

The 3.3V regulated outputs on the Moteino provide power to the expression pedal, the MIDI output cable, the Serial Seven Segment Display, and the RGB LED.  Diode D4 protects the voltage regulator output, in case the expression pedal plug is connected to an external voltage source by accident.

Capacitors C2 and C3 provide bypassing to shunt high frequency noise to ground, leaving a nice clean DC level, exactly what we want. 

The expression pedal pot voltage is read by analog input A1, which is protected by diodes D1 and D2, and resistor R2.  Capacitor C1 forms a low-pass filter with R2, and to some extent, the expression pedal pot.  The high frequency cutoff works out to greater than 100 Hz, way faster than anyone could pump the expression pedal, so no limitation there.  C1 eliminates high frequency noise that could possibly cause the BPM to jump around, perhaps +/- a few BPM, without it.  This low-pass filter works quite well, and the BPM display is rock steady.

Regarding pot resistance, I've tested down to 10K ohms and it worked fine.  With a 5K ohms pot, it worked, but lost a couple BPM off the top of each BPM range.  That's because of resistor R1, which is there to limit the current from the 3.3V supply, in case of miswiring to the expression pedal.  I'll discuss this again in Part 2, Software, as it would be easy to make this work (and get full BPM range) down to 1K ohms.  On the high end, I tested a 1 Meg pot and it worked fine.  I expect pots greater than 1 Meg would also work, but at some point the low pass filter frequency cutoff will be low enough to cause noticeable delay in the BPM response to the pedal.  

The toggle switches are monitored using digital inputs, D11, D12, D13.  S1 is a sub-mini SPST on/off toggle switch, to enable/disable the MIDI clock output.  S2 is a mini SPDT on/off/on toggle switch, to select the BPM range for the pedal.  After some trial and error, I settled on three overlapping BPM ranges.  And I use the RGB LED to indicate status:
  • Red 
        • MIDI Clock output OFF
  • Blue
        • Low Range: 40 to 160 BPM
        • MIDI Clock output ON
  • Blue+Green
        • Mid Range: 120 to 240 BPM
        • MIDI Clock output ON
  • Green
        • High Range: 180 to 300 BPM
        • MIDI Clock output ON

I also tested a full range setting, 40 to 300 BPM (which is the BeatBuddy's range) and it worked.  It did sweep the entire range, but it was hard to move the pedal by a small enough amount to change the BPM by +/- one count.  The solution was multiple ranges.

The RGB LED is driven by digital outputs, D3, D5, and D6, which
 sink current through resistors R6, R7, R8.  Those resistor values, and R5, where chosen to adjust the brightness to my liking for the various colors, listed above.  

The BPM ranges listed above would be easy to change in the Arduino sketch, as I'll cover in Part 3, Software.  On that note, if I were building project this again, I'd use a slightly larger box, and the Moteino-USB, with the USB port accessible for re-programming.  For the current build, I used the Moteino, which is smaller and lower cost, but requires a USB BUB, or some other FTDI cable.  So if I want to change the program, I have to open up the project box:


I used a Serial 7 Segment Display for BPM.  I think it's bargain at $13, because it's so easy to use: power, ground, and one serial input.  I used the SoftwareSerial library to drive it via digital output pin D10.  

The BeatBuddy's own BPM display does track the pedal, but this display is bigger, brighter, easier to see, and it tracks the expression pedal much more quickly.  So it lets you quickly see and set the desired tempo.  While you could omit this display, and the project will work fine without it, IMO, it's well worth the added cost and build time.  And you can get them in various colors.

The MIDI output is very simple, just two resistors, R3 and R4, and one digital output, D8.  I used the SoftwareSerial library to transmit the MIDI Clock (hex 0xF8) repeatedly, at 24 times the desired BPM (beats per minute), per the MIDI standard.  

OK, so that wraps up Part 1.  Please leave comments and questions below, and check back for Part 2, Parts List,  more build pictures; and Part 3, software: Arduino 'sketch' (source code); and Part 4, software design notes.