Stepper motor too weak

#include <AccelStepper.h>
#include <Wire.h> 
//#include <LiquidCrystal_I2C.h>

// Definiere den Stepper mit den Pins
AccelStepper stepper(AccelStepper::DRIVER, 9, 8); //PIN 9 Step, PIN 8 DIR
// Definiere den LCD mit den Pins
//LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

//Define
int en = 10;
int down = 0;
int up = 1;
int enter = 2;
int led1 = 3;
int led2 = 4;
bool warten = false;

//----------------------------------------------------------------------------------------------------------------------------

void setup()
{ 
  //Definiere Pins 
  pinMode(en , OUTPUT);
  pinMode(down , INPUT_PULLUP);
  pinMode(up , INPUT_PULLUP);
  pinMode(enter , INPUT_PULLUP);
  pinMode(led1 , OUTPUT);
  pinMode(led2 , OUTPUT);
  //Definiere Stepper
  stepper.setMaxSpeed(20000);
  stepper.setAcceleration(90000); 
  // Initialisiere den lcd
  //lcd.init();                       
  //lcd.backlight();
  stepper.move(400);
  delay(1500);
}

//----------------------------------------------------------------------------------------------------------------------------

void loop()
{
  stepper.run();
  if (stepper.distanceToGo() == 0)
  {
    if (warten == false)
    {
      stepper.move(-405);
      warten = true;
      delay(1300);
    }
    else
    {
      stepper.move(405);
      warten = false;
    }
  }  
}

This is working :slight_smile: Now I only have the problem, that the stick is on the drumhead a bit too long. Just have to optimize the ideal stepper steps. Maybe implement the endstop, so that it regains track of its position when it looses steps by hitting the drum at higher speeds.

Thank you very much for your help! :wink:

dodoka:
Will I loose steps when I hit the drum? So I need an encoder, or drive back to an endstop after each hit, right?

I have been thinking about this. I wonder if using a setup similar to a piano key would solve the possibility of skipping steps during the drum strike.
The piano key pushes the hammer which strikes the string. But that push stops just before the strike, and the hammer continues on to strike the string though inertia.

vinceherman:
I wonder if using a setup similar to a piano key would solve the possibility of skipping steps during the drum strike.
The piano key pushes the hammer which strikes the string. But that push stops just before the strike, and the hammer continues on to strike the string though inertia.
Action (piano) - Wikipedia

I thought about this too, but if it´s possible, I want to keep it as simple as possible... So if I can manage it, I´d like to have it only driven by the stepper motor. Nearly ever drum robot I saw uses servos. I´m sure that they are easier to control, but the stepper should be "better"m right? I only need a steady beat. Nothing fancy. The drum I´m using is a really cheap one, maybe a better one will automatically sound louder and better :wink:

Brainstorm:

Accelerate the drumstick and disabling the stepper driver before impact, so that intertia drives it into the drum and back :slight_smile: Then it falls back to the floor and it gets accelerated again. No need for counting the exact steps and no need for additional mechanical parts :smiley:

Looking at your picture, might it need less torque if the motor is above the drum instead of below it?

It would still look cool.

dodoka:
but if it´s possible, I want to keep it as simple as possible...

Yeah, there is nothing simple about the piano key mechanism.

ChrisTenone:
Looking at your picture, might it need less torque if the motor is above the drum instead of below it?

Thats a good Idea! Only the mount would be a bit more complicated :slight_smile:

I tried the inertia-style approach. Works like a charm :smiley:

Video of it working: ** Klick**

I maybe need a more flexible arm (now its a fiberglass one), then the sound wouldn´t be so dull. But other then that I´m happy for now :slight_smile: Thanks again for the help!

dodoka:
@Johan_Ha Sorry^^ It was late and I didnt want to search for an online pic-hoster.

I just used the address of your attached file in the image tag. You can do the same.