Likes Likes:  0
Needs Pictures Needs Pictures:  0
Picture(s) thanks Picture(s) thanks:  0
Page 4 of 4 FirstFirst 1234
Results 46 to 58 of 58

Thread: Camera slider

  1. #46
    Join Date
    Oct 2011
    Location
    Adelaide
    Age
    59
    Posts
    3,149

    Default

    The way I've done it for normal (DC) motors is have a limit switch that cuts the power when it hits the stop but bridge that with a diode so that reverse current can still run.
    On reflection, probably doesn't help much with a stepper motor (but makes me feel that I have made a contribution )

    Michael

  2. # ADS
    Google Adsense Advertisement
    Join Date
    Always
    Location
    Advertising world
    Age
    2010
    Posts
    Many





     
  3. #47
    Join Date
    Jun 2008
    Location
    Victoria, Australia
    Age
    74
    Posts
    6,132

    Post

    Hi Ken,

    I had a quick look at the code you linked to, and can give you a push in the right direction... I think it should look something like this

    digitalRead(x) returns the state of digital input x,

    Code:
    #define  x_positive_limit  12   // whatever pin numbers you wire the switches to 
    #define  x_negative_limit 13   
    
    // somewhere in setup add the input pin configuration.
      pinMode(x_positive_limit, INPUT_PULLUP);
      pinMode(x_negative_limit, INPUT_PULLUP);
    
    
    // somewhere in the main loop... insert something like the following
    
    if (Sign==+1)   
    {
        // we are moving in positive direction  
       if (digitalRead(x_positive_limit)==LOW)
        {
          // whatever you want to happen at +limit
          // 
        }
    }
    if (Sign==-1) 
    {
        // we are moving in negative direction  
       if (digitalRead(x_positive_limit)==LOW)
        {
          // whatever you want to happen at -limit
          //
        }
    }
    Ray

  4. #48
    Join Date
    Nov 2006
    Location
    Heidelberg, Victoria
    Age
    79
    Posts
    2,251

    Default Limit switch coding

    Hi Ray,

    Thanks for your input, I sort of think I know what you are getting at, keeping in mind I know nothing about writing code.

    What I want to happen is this......when the right limit switch is hit, stop the motor and ready it to go in the other direction when the left direction button is pressed,
    and similarly, when the left limit switch is hit, stop the motor and ready it to go in the opposite direction when the right button is pressed.

    Does this make sense?

    Dill bury Ken

  5. #49
    Join Date
    Jun 2008
    Location
    Victoria, Australia
    Age
    74
    Posts
    6,132

    Post

    Hi Ken,

    Try this... I've padded it out with the housekeeping and run loop.

    Code:
    //  Ken's camera slider
    //
    
    #include <AccelStepper.h>
    
    // Define a stepper and the pins it will use
    AccelStepper stepper; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
    
    #define  x_positive_limit 6   // change to whatever pin numbers you wire the switches to 
    #define  x_negative_limit 7
    #define  left_button  8
    #define  right_button  9
    
    
    
    void setup()
    {  
     // Change these to suit your stepper if you want
       stepper.setMaxSpeed(100);
       stepper.setAcceleration(20);
       stepper.setSpeed(10);
       Sign=+1;
      //  
      pinMode(x_positive_limit, INPUT_PULLUP);
      pinMode(x_negative_limit, INPUT_PULLUP);
      pinMode(left_button,  INPUT_PULLUP);
      pinMode(right_button, INPUT_PULLUP);
    }
    
    // start up at slowish constant speed in +ve direction, until it hits a limit switch.  If it's already at the limit switch, it will just
    // wait for button press.
    
    void loop()
    {
    
        if (Sign==+1)   
        {
            // we are moving in positive direction  
            if (digitalRead(x_positive_limit)==LOW)
            {
                Sign=0;
                // whatever you want to happen at +limit
                while (digitalRead(right_button==HIGH)
                {
                       // Wait here for right button after hitting +ve limit switch
                      // right hand button makes servo move right to left (-ve)
                }
                stepper.setSpeed(30);  // speed for travel in -ve direction
                Sign=-1;
            }
        }
        if (Sign==-1) 
        {
            // we are moving in negative direction  
           if (digitalRead(x_positive_limit)==LOW)
           {
                Sign=0;
                // whatever you want to happen at -limit
                while (digitalRead(left_button==HIGH)
                {
                       // Wait here for left button after hitting -ve limit switch
                      // left hand button makes servo move left to right (+ve)
                }
                stepper.setSpeed(40);  // speed for travel in +ve direction
                Sign=+1;
           }
        }
        stepper.runSpeed();
    }
    Ray

  6. #50
    Join Date
    Nov 2006
    Location
    Heidelberg, Victoria
    Age
    79
    Posts
    2,251

    Default Arduino code translation

    Ray, I'm sure there will be a lot of us, me included, who are unfamiliar with code for the Arduino.

    Is there any chance you could describe your code and what it does, line by line, in plain English for us dills.

    May I ask what you use your Arduino board for? CNCing?

    It seems these little bundles of joy can do anything, only limited by one's imagination.

    Ken

  7. #51
    Join Date
    Jun 2008
    Location
    Victoria, Australia
    Age
    74
    Posts
    6,132

    Default

    Hi Ken,

    I don't use arduino stuff at all... but it's just c programming, which is what I do with embedded systems.

    Have a search on-line for c programming tutorials, there are lots to choose from. For CNC I use linux emc2.

    Ray

  8. #52
    Join Date
    Nov 2006
    Location
    Heidelberg, Victoria
    Age
    79
    Posts
    2,251

    Default C programming

    Thanks Ray, I had hoped you were into the Arduino, never mind.

    Learning a new language at my age would prove difficult, I have enough trouble just trying to learn all about my iPhone.

    Is C++ similar to C?

    Ken

  9. #53
    Join Date
    Jun 2008
    Location
    Victoria, Australia
    Age
    74
    Posts
    6,132

    Default

    Quote Originally Posted by neksmerj View Post
    Is C++ similar to C?

    Ken
    No, just stick with C.

    I have done arduino type programming, but not all that seriously.

    Ray

  10. #54
    Join Date
    Jul 2003
    Location
    geelong
    Age
    88
    Posts
    774

    Default

    Ken, See reply woodworking-CNC machines. NF.

  11. #55
    Join Date
    Jun 2011
    Location
    Australia east coast
    Age
    71
    Posts
    1,469

    Default

    Quote Originally Posted by neksmerj View Post
    Thanks Ray, I had hoped you were into the Arduino, never mind.

    Learning a new language at my age would prove difficult, I have enough trouble just trying to learn all about my iPhone.

    Is C++ similar to C?

    Ken
    C++ is enhanced C. Java is enhanced C++. C# is Microsoft's dummy-spit response to losing a court case against their bastardisation of Java.

    All one big incestuous family really.....

    That code is pretty simple and highly readable as-is. I'm not trying to be a smarty but you really need to understand it, or get someone else to do all the programming for you and just accept the end result. I realise that I say this from the POV of nearly 40 years programming, but still - I've found that with software, you either spend the time to learn, or not. You can't half-do it. This is why I've never gotten around to learning Solidworks or similar - time investment is too great for my needs.

    PDW

  12. #56
    Join Date
    Apr 2002
    Location
    Brisbane
    Posts
    5,773

    Default

    On the matter of limits switches.
    depending on the design of the transport and control system they may not be required.

    Many printer mechanisms, do not have limit switches.

    When the machine initilaises, it drives to one of the stops......as long as the motor and the carrage will stand being driven into the stop.....it will be fine.
    the control system then registers the stop as zero and drives in relation to that....counting steps or character spaces from there.

    If you are running a stepper motor drive that is only a variable speed drive and has no step counting this will not work.


    Another thaught is.....if this is a simple camera track that only travels a single pass at the nominated speed.......things may be different.

    you may only need stops or limit switches to prevent overdrive......so no particular smarts are required.

    In fact.....the whole thing could be way simpler.

    All that is needed is a gear motor and a PWM motor controller..or maybe even a voltage regulator.

    No micro, no processing and no programming required.



    I find it fascinating that the current generation of designers look to microprocessors and 3d printers before they look at simple straight forward engineering.

    I know that there is a lot that can be done with these cheap micros and 3d printers are a great thing.

    but all this sort of thing has been done in the past with very simple old school methods.

    cheers
    Any thing with sharp teeth eats meat.
    Most powertools have sharp teeth.
    People are made of meat.
    Abrasives can be just as dangerous as a blade.....and 10 times more painfull.

  13. #57
    Join Date
    Dec 2007
    Location
    Melbourne
    Posts
    3,277

    Default

    I haven't read through the full thread so my appologise if this has already been covered. But those types of aluminium extrusions are used extensively in the exhibition industry. You will be able to get 6m lengths if required.

    One of the brands is Octonorm and is represented here, places like Expohire use it etc.

    http://www.octanorm.com.au/Pages/Pro...2.aspx?dep=VMS
    …..Live a Quiet Life & Work with your Hands

  14. #58
    Join Date
    Dec 2007
    Location
    Melbourne
    Posts
    105

    Default

    Ken,

    I have replied to your thread on the CNC page. I have now read through the thread here and I think what you are trying to do is not too hard with either the Adafruit Motor Shield or the Easy Driver board - this assumes I understand what you are trying to do.

    1. Drive the stepper in a given direction. Continue to do so until you detect the limit switch changing state (i.e going from open to closed).

    2. Change the direction of the stepper motor (via the Adafruit library in you are using their motor shield) and step a given number of steps to back off from the limit switch (or alternatively back off until the limit changes state?).

    I have done a lot of Arduino stuff although I tend to use the Arduino to prototype a system and then build a board to that has all the necessary components (i.e the micro and all the interface circuitry).

    An Arduino Pro Mini is basically a minimal Arduino Uno (i.e doesn't have the USB/Serial interface on the board and uses a SMT micro which actually has more I/O than the DIL micro on the Uno). Once your work out how to get connect the separate USB/Serial interface (which only cost about $5) you will find the Pro Mini a great way to go (and they can be had for under $3).

    Grant

Page 4 of 4 FirstFirst 1234

Similar Threads

  1. Slider Length....Can I get away with 2m
    By woodman-79 in forum WOODWORK - GENERAL
    Replies: 8
    Last Post: 23rd July 2012, 11:44 AM
  2. Minimax slider for sale
    By HTM in forum TABLE SAWS & COMBINATIONS
    Replies: 0
    Last Post: 11th July 2009, 09:53 PM
  3. Drop saw or slider??
    By bullethead in forum GENERAL & SMALL MACHINERY
    Replies: 5
    Last Post: 22nd July 2008, 09:30 AM

Tags for this Thread

Posting Permissions

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