SparkFun will be closed Nov 26th and 27th for the Thanksgiving holiday. Orders placed after 2:00pm MT on the 25th will ship out Monday the 30th.

Member #108924

Member Since: January 6, 2010

Country: United States

  • I couldn’t tell from the datasheet what the range of processing time was for gestures. If very short (perhaps <100ms, which physiologically feels nearly “instant”), it seems like you could use one or more of these for an interesting musical instrument. Has anyone tested how short and consistent the processing time is? Thanks! Excited to see how people use this.

  • After an evening of tinkering I was able to make it work akin to the example video. I don’t have it set up as a pong game, but I do have it hitting programmable set points.

    Hooked up with ATtiny85 (adafruit trinket) and L293D (equivalent: https://www.sparkfun.com/products/315).

    • Motor leads to OUT1 and OUT2 on L293D.
    • Potentiometer lead 1 to Ground, 2 to an analogRead pin, and 3 to 5V. I didn’t attach the other set, but I might try in case that improves sensitivity.
    • The L293D gets 5V to +V and +Vmotor, and Ground to 0V. EN1 is hooked to a PWM pin, and IN1 and IN2 are hooked to digitalWrite pins.

    I didn’t have success using PWM; anything short of 255 would lock and buzz, so I changed my program around to use digitalWrite instead. Not sure if that issue was in my programming, wiring, or something else.

    Here was my code. Please let me know if you have suggestions.

    //Demo of accelerating hitTarget pattern
    int enablePin = 0;   int in1Pin = 1;  int in2Pin = 2; 
    int potPin = 2;  //on the ATtiny85, analogRead(2) is digital(4)
    float pos = 0;
    void setup() {
        pinMode(in1Pin, OUTPUT);
        pinMode(in2Pin, OUTPUT);
        pinMode(enablePin, OUTPUT);
    void loop() {
        for (int d = 2000; d > 1; d /= 1.5) { 
          for (int t = 10; t <190; t+=30) {hitTarget(t); delay(d);}
          for (int t = 190; t>30; t-=30) {hitTarget(t); delay(d);}
    //Drives the motor toward goal and stops when close enough.
    void hitTarget(int target) {
        int threshold = 2;
        while (abs(pos-target)>threshold) {
            if (target > pos ) { setMotor(1, 1); }
            if (target < pos ) { setMotor(1, 0); }
    //Takes a smoothed reading. Works ok w/o smoothing too.
    void readPos() {
        float readWeight = 0.7;
        pos = (1-readWeight)*pos + readWeight*analogRead(potPin)/4;
    void setMotor(boolean on, boolean reverse) {
        digitalWrite(enablePin, on);
        digitalWrite(in1Pin, ! reverse);
        digitalWrite(in2Pin, reverse);
  • Have you been able to get good control of the output timing? I was able to produce some basic algorithmic music, but I’d love to be able to program in more “feel” to the canned drum parts, for instance. I’ve converted a midi beat into an array of noteOn/noteOff signals with associated “tick” timing, but my programming skills are lacking when it comes to triggering those on time as they arise. For instance, I want to trigger kick and hi-hat at or around tick 0, snare at tick 96, hi-hat at tick 150, etc., with each tick only 5-10 ms, depending on tempo. Has anyone done or seen something similar? Many thanks for any advice.

    Btw, your SongPainter project is great!

No public wish lists :(