Simple Clock In to control SH-101

Hi-

I'm working on my first Arduino project (total noob) and looking for some input. Essentially I want to specify a BPM (derived in ms), then have the Arduino send out a +5v trigger signal for the 101 to lock to. Here's the very basic start I have:

/*
  SH-101 Ext Clock In
  
  reference for translating BPM to MS
  http://www.futureproducers.com/forums/production-techniques/getting-started/bpm-millisecond-conversion-chart-224476/

  Whole: (60.0 / bpm * 4000,1)
  Half: (60.0 / bpm * 2000,1)
  Quarter: (60.0 / bpm * 1000,1)
  Eighth: (60.0 / bpm * 500,1)
  Sixteenth: (60.0 / bpm * 250,1)

  
  BPM: 120
  Whole: 2000.0 Half: 1000.0
  Quarter: 500.0 Eighth: 250.0
  Sixteenth: 125.0
  
  This example code is in the public domain.
 */

int analogPin = 3;   // output to go to keyboard

void setup() {                
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);     
}

void loop() {
  // initial pulse
  
  digitalWrite(13, HIGH);   // set the LED on
  analogWrite(analogPin, 255); // turn on signal to full strength
  delay(250);              
  
  // recovery
  digitalWrite(13, LOW);    // set the LED off
  analogWrite(analogPin, 0); // turn on signal off
  delay(250);              
}

After hooking up to my DMM and getting no voltage on the output, I think I've gathered I need to make a DAC to convert the voltage to something usable from analogWrite().

http://provideyourown.com/2011/analogwrite-convert-pwm-to-voltage/

I think I may be missing something on the timing - am I thinking about this right adding a delay, or is the actual timing going to be controlled with the Modulation Frequency? I also got a bit lost trying to figure out what values to plug into the online calculator at (Sample)RC Low-pass Filter Design for PWM - Result -

Lastly - given the seemingly more complex nature of the stuff I see you guys doing, is there something out there already that does this? It seems pretty low rent. Any advice would be great - I'm slowly learning!

Thanks!

If you're willing to live without generating the clock from a precise BPM figure, you could build a simple cheap square wave clock from a 40106.

Having said that the Arduino is a really fun platform to use for triggering/playing analogue equipment, and great for learning on.

As a start, if you're trying to trigger the SH-101 sequencer, I'd suggest using a digital output pin rather than a PWM (analogue-ish) output. Don't forget to set the pin you use as an output in your setup(). Connect the digital out to the SH-101 clock in through a 1k resistor, and attach a pull-down 100k resistor from the digital out to ground.

Once you've got that working you could do stuff like attaching a potentiometer to one of the analogue ins to set the delay between triggers, add an LED readout for the BPM, use interrupts rather than delays so you could vary the length of the triggers, have multiple outs set to different dividers… and random clocks, control the pitch of the 101 through a cheap DAC - you could go nuts.

Just to prove that the 101 sequencer will trigger from an Arduino, I built a little overcomplicated Sync24 clock divider box a while back:

Probably the cheapest way of getting your SH-101 to run at a particular BPM setting in a commercial product is to clock it from a computer or drum machine through the Dtronics MIDI-to-sync box, although I've not tried this myself -

http://www.engineersatwork.nl/dtronics/pages/midi_sync_converter_ms06.html

hth