Page 3 of 3 FirstFirst 123
Results 31 to 36 of 36

Thread: Arduino Help ?

  1. #31
    Join Date
    Dec 2010
    Location
    WNY
    Posts
    10,087
    Quote Originally Posted by David Buchhauser View Post
    John - I'm surprised that there isn't already someone out there who has done a similar clock winding project and documented it. I have not heard of a 1-way bearing before - I will need to look that one up. Did you purchase the arduino board and stepper motor as a kit? The stepper motor drives I have used in the past always had settings (jumpers or switches) to match the drive current to the particular stepper motor rated current. Perhaps you could measure the torque required to wind your clock and make sure that your particular stepper motor has the ability to supply that torque in a reliable manner.

    David
    I found one guy who has a stepper motor driving a marble lifting mechanism in his clock, but he didn't volunteer much when I contacted him. Others are using a DC motor, like the one I have in the clock now. One-way bearings are fairly common; all kinds of them on Amazon. I bought the Arduino, stepper motor and A4988 driver separately. There is a potentiometer on the driver that you adjust so the current matches the motor rating. The torque requirement to raise the weight on the clock is 0.7 lb-in and the stepper is rated at 2.3 lb-in holding torque, so it should work. I set the potentiometer based on a calculation using the motor winding resistance, but maybe I should have measured the current directly to confirm. I'll have to look into it before throwing it in a drawer and buying a more powerful one.

    Thanks.

    John

  2. #32
    Join Date
    Dec 2010
    Location
    WNY
    Posts
    10,087
    I have a working system using a single Hall effect limit switch. I bought a NEMA 17 motor with a 5/1 gear reduction. That has plenty of torque to lift the weight and enough torque to hold the weight in place even when power to it is switched off completely. I used the Enable pin to turn on power to the motor when the limit switch is tripped, and off again after it reaches its programmed run distance. Here's what the code looks like. Ignore the unused second limit switch in the code

    #include<ezButton.h>#include <AccelStepper.h>

    // Motor interface type must be set to 1 when using a driver
    #define dirPin 2
    #define stepPin 3
    #define motorInterfaceType 1
    #define enablePin 4 // Pin to enable/disable

    // Create a new instance of the AccelStepper class:
    AccelStepper stepper = AccelStepper(motorInterfaceType, stepPin, dirPin);


    #define MAX_POSITION 7500 // 0x7FFFFFFF // maximum of position we can set (long type)


    ezButton limitSwitch(A0); // create ezButton object that attach to pin A0;
    ezButton limitSwitch2(A2);

    bool isStopped = true; //false;

    void setup()
    {
    Serial.begin(9600);

    pinMode(enablePin, OUTPUT); // Set enablePin as output

    limitSwitch.setDebounceTime(50); // set debounce time to 50 milliseconds
    limitSwitch2.setDebounceTime(50); // set debounce time to 50 milliseconds

    stepper.setMaxSpeed(100.0); // set the maximum speed
    stepper.setAcceleration(15.0); // set acceleration
    stepper.setSpeed(10); // set initial speed
    stepper.setCurrentPosition(0); // set position

    digitalWrite(dirPin,LOW); //Change to LOW if motor turns the wrong direction
    //stepper.moveTo(MAX_POSITION);
    }

    void loop()
    {

    limitSwitch.loop(); // MUST call the loop() function first

    if (limitSwitch.isPressed())
    {
    digitalWrite(enablePin, LOW);
    stepper.moveTo(MAX_POSITION);
    Serial.println(F("The limit switch: TOUCHED"));
    isStopped = false; //true;
    //stepper.run();
    //delay(5000);
    }

    if (isStopped == false)
    {
    stepper.run();
    if (stepper.distanceToGo() == 0) // if motor moved to the target position
    {
    stepper.setCurrentPosition(0); //reset position to 0
    //stepper.moveTo(MAX_POSITION); // move the motor to maximum position again
    isStopped = true;

    digitalWrite(enablePin, HIGH);
    Serial.println(F("The stepper motor is STOPPED"));
    }
    }
    }



    John

  3. #33
    Join Date
    Apr 2017
    Location
    Tucson, Arizona
    Posts
    1,227
    John - glad to hear you've finally got it figured out and working. Nice job!!
    David

  4. #34
    Join Date
    Dec 2010
    Location
    WNY
    Posts
    10,087
    One final update. I now have a completely silent system, which was my reason for pursuing a stepper motor over the original simple DC motor. By changing from the A4988 I was using to a Silent Stepstick TMC2208 driver, motor noise went from acceptable only by isolating the motor mount to absolutely silent now. The TMC2008 generates are much cleaner sin wave signal to the motor. I highly recommend the TMC2208 for your stepper driver.

    John

  5. #35
    Join Date
    Apr 2017
    Location
    Tucson, Arizona
    Posts
    1,227
    Very interesting - thanks for the update. Did you use your oscilloscope to monitor the sine wave outputs for comparison or are you going from a previous published comparison of the two controllers?
    Thanks,
    David

  6. #36
    Join Date
    Dec 2010
    Location
    WNY
    Posts
    10,087
    Quote Originally Posted by David Buchhauser View Post
    Very interesting - thanks for the update. Did you use your oscilloscope to monitor the sine wave outputs for comparison or are you going from a previous published comparison of the two controllers?
    Thanks,
    David
    The sin wave info. is from Trinamic, the maker of Silent Stepstick. They show the sin waves from the two drivers; pretty clear how much smoother the TMC2208 is over the A4988. That's their claimed reason for the difference in noise. What I can say from using both of them is that the difference is dramatic, from sort of OK after a lot of work to isolate the motor, to zero noise even without isolation. Absolutely amazing.

    John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •