Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Auto traversing mechanisms: ideas and potential problems.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    I am currently hacking my Grizzly mini lathe to run with Arduino control. I am just running the wire through the hole in a stock servo arm. It's hardly even an "application" - I just stuck a servo on a board and mounted in front of the lathe face. For the sketch I press a button to start the software, turn a knob to set left limit of travel, press the button again, set right limit, press button again, and it starts sweeping back and forth and the speed set in the sketch.

    Yes you need to power any kind of motor externally. My little servo is running off a 12v, 1A wall wart that is smoothed out with caps and brought down to 5v with a regulator. I'm no expert but I think the Arduino is meant to power just things like sensors, LEDs, control pins on chips - very low current stuf.

    When it's done my old laptop will just sit there hooked up to it so I can load sketches for different pickups. My current step is an optical counter but that's on hold now because my basement office flooded Sunday night.

    Comment


    • #17
      KindlyK sorry to hear about the flood, hope you get that cleaned up with a minimum of damage.

      Comment


      • #18
        Originally posted by Kindly Killer View Post
        I am currently hacking my Grizzly mini lathe to run with Arduino control. I am just running the wire through the hole in a stock servo arm. It's hardly even an "application" - I just stuck a servo on a board and mounted in front of the lathe face. For the sketch I press a button to start the software, turn a knob to set left limit of travel, press the button again, set right limit, press button again, and it starts sweeping back and forth and the speed set in the sketch.

        Yes you need to power any kind of motor externally. My little servo is running off a 12v, 1A wall wart that is smoothed out with caps and brought down to 5v with a regulator. I'm no expert but I think the Arduino is meant to power just things like sensors, LEDs, control pins on chips - very low current stuf.

        When it's done my old laptop will just sit there hooked up to it so I can load sketches for different pickups. My current step is an optical counter but that's on hold now because my basement office flooded Sunday night.

        Ha! Hadn't even thought about running it through the servo arm. You CAN run a small hobby servo directly off the Arduino... whether that's ideal long term or not, I don't know. Are you hand-tensioning, or do you have some sort of tensioner set up?

        Comment


        • #19
          got a PM request for my sketch but i couldn't send it (too many characters). i'll just attach it here

          there's nothing to it, really - just copy and paste from examples mostly

          As I mentioned in the thread, this is just the first stage of hacking this winder to be Arduino-controlled, so nothing is polished at all. E.g. the traverse speed is just written into the loop as a value, where it should be in a variable at the top or in an included file...

          btw i use buttons without resistors - i just have a switch jammed right into my breadboard between pin 2 and ground (right next to it in my arduino nano)

          /*

          Traverse control, using mostly cut-and-paste code from Arduino documentation and online examples.
          Credits from plundered sketches are at the very bottom of the code.

          05 May 2012 by Michael Gregory

          */


          #include <Servo.h>

          Servo myservo; // create servo object to control a servo

          int potpin = 0; // analog pin used to connect the potentiometer
          int ccwVal; // variable to read the value from the analog pin
          int rightVal; // variable to read the value from the analog pin
          int pos = 0; // variable to store the servo position



          // constants won't change. They're used here to
          // set pin numbers:
          const int buttonPin = 2; // the number of the pushbutton pin
          const int ledPin = 13; // the number of the LED pin

          // Variables will change:
          int ledState = HIGH; // the current state of the output pin
          int buttonState; // the current reading from the input pin
          int lastButtonState = LOW; // the previous reading from the input pin
          int stage = 0;

          // the following variables are long's because the time, measured in miliseconds,
          // will quickly become a bigger number than can be stored in an int.
          long lastDebounceTime = 0; // the last time the output pin was toggled
          long debounceDelay = 50; // the debounce time; increase if the output flickers

          void setup() {
          pinMode(buttonPin, INPUT);
          pinMode(ledPin, OUTPUT);
          digitalWrite(buttonPin, HIGH);
          Serial.begin(9600); // open the serial port at 9600 bps:
          myservo.attach(9); // attaches the servo on pin 9 to the servo object
          }

          void loop() {
          // read the state of the switch into a local variable:
          int reading = digitalRead(buttonPin);

          // check to see if you just pressed the button
          // (i.e. the input went from LOW to HIGH), and you've waited
          // long enough since the last press to ignore any noise:

          // If the switch changed, due to noise or pressing:
          if (reading != lastButtonState) {
          // reset the debouncing timer
          lastDebounceTime = millis();
          }

          if ((millis() - lastDebounceTime) > debounceDelay) {
          // whatever the reading is at, it's been there for longer
          // than the debounce delay, so take it as the actual current state:
          buttonState = reading;
          if(reading == LOW){ //this is definitely a debounced button press
          Serial.print(stage);
          stage += 1;
          delay(1000);
          }

          }


          if (stage == 0){ //this is the stage when the user sets the CCW limit of the servo
          ccwVal = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
          ccwVal = map(ccwVal, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
          myservo.write(ccwVal); // sets the servo position according to the scaled value
          delay(15); // waits for the servo to get there
          }

          if (stage == 1){ //this is the stage when the user sets the right limit of the servo
          //Serial.print(ccwVal);
          rightVal = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
          rightVal = map(rightVal, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
          myservo.write(rightVal); // sets the servo position according to the scaled value
          delay(15); // waits for the servo to get there
          }

          if (stage == 2){ //this is the stage when servo rotates back and forth in the limits set with the knob
          //Serial.print(rightVal);
          for(pos = rightVal; pos < ccwVal; pos += 1) // goes from 0 degrees to 180 degrees
          { // in steps of 1 degree
          myservo.write(pos); // tell servo to go to position in variable 'pos'
          delay(200); // waits 15ms for the servo to reach the position
          }
          for(pos = ccwVal; pos>=rightVal
          ; pos-=1) // goes from 180 degrees to 0 degrees
          {
          myservo.write(pos); // tell servo to go to position in variable 'pos'
          delay(200); // waits 15ms for the servo to reach the position
          }
          }







          // set the LED using the state of the button:
          digitalWrite(ledPin, buttonState);

          // save the reading. Next time through the loop,
          // it'll be the lastButtonState:
          lastButtonState = reading;
          }

          /*
          Debounce

          Each time the input pin goes from LOW to HIGH (e.g. because of a push-button
          press), the output pin is toggled from LOW to HIGH or HIGH to LOW. There's
          a minimum delay between toggles to debounce the circuit (i.e. to ignore
          noise).

          The circuit:
          * LED attached from pin 13 to ground
          * pushbutton attached from pin 2 to +5V
          * 10K resistor attached from pin 2 to ground

          * Note: On most Arduino boards, there is already an LED on the board
          connected to pin 13, so you don't need any extra components for this example.


          created 21 November 2006
          by David A. Mellis
          modified 30 Aug 2011
          by Limor Fried

          This example code is in the public domain.

          Arduino - Debounce
          */

          // Controlling a servo position using a potentiometer (variable resistor)
          // by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

          // Sweep
          // by BARRAGAN <http://barraganstudio.com>
          // This example code is in the public domain.

          Comment


          • #20
            got a PM request for my sketch but i couldn't send it (too many characters). i'll just attach it here

            there's nothing to it, really - just copy and paste from examples mostly

            As I mentioned in the thread, this is just the first stage of hacking this winder to be Arduino-controlled, so nothing is polished at all. E.g. the traverse speed is just written into the loop as a value, where it should be in a variable at the top or in an included file...

            btw i use buttons without resistors - i just have a switch jammed right into my breadboard between pin 2 and ground (right next to it in my arduino nano)

            /*

            Traverse control, using mostly cut-and-paste code from Arduino documentation and online examples.
            Credits from plundered sketches are at the very bottom of the code.

            05 May 2012 by Michael Gregory

            */


            #include <Servo.h>

            Servo myservo; // create servo object to control a servo

            int potpin = 0; // analog pin used to connect the potentiometer
            int ccwVal; // variable to read the value from the analog pin
            int rightVal; // variable to read the value from the analog pin
            int pos = 0; // variable to store the servo position



            // constants won't change. They're used here to
            // set pin numbers:
            const int buttonPin = 2; // the number of the pushbutton pin
            const int ledPin = 13; // the number of the LED pin

            // Variables will change:
            int ledState = HIGH; // the current state of the output pin
            int buttonState; // the current reading from the input pin
            int lastButtonState = LOW; // the previous reading from the input pin
            int stage = 0;

            // the following variables are long's because the time, measured in miliseconds,
            // will quickly become a bigger number than can be stored in an int.
            long lastDebounceTime = 0; // the last time the output pin was toggled
            long debounceDelay = 50; // the debounce time; increase if the output flickers

            void setup() {
            pinMode(buttonPin, INPUT);
            pinMode(ledPin, OUTPUT);
            digitalWrite(buttonPin, HIGH);
            Serial.begin(9600); // open the serial port at 9600 bps:
            myservo.attach(9); // attaches the servo on pin 9 to the servo object
            }

            void loop() {
            // read the state of the switch into a local variable:
            int reading = digitalRead(buttonPin);

            // check to see if you just pressed the button
            // (i.e. the input went from LOW to HIGH), and you've waited
            // long enough since the last press to ignore any noise:

            // If the switch changed, due to noise or pressing:
            if (reading != lastButtonState) {
            // reset the debouncing timer
            lastDebounceTime = millis();
            }

            if ((millis() - lastDebounceTime) > debounceDelay) {
            // whatever the reading is at, it's been there for longer
            // than the debounce delay, so take it as the actual current state:
            buttonState = reading;
            if(reading == LOW){ //this is definitely a debounced button press
            Serial.print(stage);
            stage += 1;
            delay(1000);
            }

            }


            if (stage == 0){ //this is the stage when the user sets the CCW limit of the servo
            ccwVal = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
            ccwVal = map(ccwVal, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
            myservo.write(ccwVal); // sets the servo position according to the scaled value
            delay(15); // waits for the servo to get there
            }

            if (stage == 1){ //this is the stage when the user sets the right limit of the servo
            //Serial.print(ccwVal);
            rightVal = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
            rightVal = map(rightVal, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
            myservo.write(rightVal); // sets the servo position according to the scaled value
            delay(15); // waits for the servo to get there
            }

            if (stage == 2){ //this is the stage when servo rotates back and forth in the limits set with the knob
            //Serial.print(rightVal);
            for(pos = rightVal; pos < ccwVal; pos += 1) // goes from 0 degrees to 180 degrees
            { // in steps of 1 degree
            myservo.write(pos); // tell servo to go to position in variable 'pos'
            delay(200); // waits 15ms for the servo to reach the position
            }
            for(pos = ccwVal; pos>=rightVal
            ; pos-=1) // goes from 180 degrees to 0 degrees
            {
            myservo.write(pos); // tell servo to go to position in variable 'pos'
            delay(200); // waits 15ms for the servo to reach the position
            }
            }







            // set the LED using the state of the button:
            digitalWrite(ledPin, buttonState);

            // save the reading. Next time through the loop,
            // it'll be the lastButtonState:
            lastButtonState = reading;
            }

            /*
            Debounce

            Each time the input pin goes from LOW to HIGH (e.g. because of a push-button
            press), the output pin is toggled from LOW to HIGH or HIGH to LOW. There's
            a minimum delay between toggles to debounce the circuit (i.e. to ignore
            noise).

            The circuit:
            * LED attached from pin 13 to ground
            * pushbutton attached from pin 2 to +5V
            * 10K resistor attached from pin 2 to ground

            * Note: On most Arduino boards, there is already an LED on the board
            connected to pin 13, so you don't need any extra components for this example.


            created 21 November 2006
            by David A. Mellis
            modified 30 Aug 2011
            by Limor Fried

            This example code is in the public domain.

            Arduino - Debounce
            */

            // Controlling a servo position using a potentiometer (variable resistor)
            // by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

            // Sweep
            // by BARRAGAN <http://barraganstudio.com>
            // This example code is in the public domain.

            Comment


            • #21
              Hey KK,

              Thanks again for that code base! I've added a little bit to it, and have included my changes if you want them.

              I added another stage that allows you to stop the process by pressing the button one more time. After that, if you press the button once again, you're back to the beginning of the process. I've also added some dummy proofing. If you happen to enter the left(ccw) and right(cw) limits in reverse, that situation is handled by flipping the positions.

              Here's the code:

              Code:
              /* 
              
              Traverse control, using mostly cut-and-paste code from Arduino documentation and online examples. 
              Credits from plundered sketches are at the very bottom of the code.
              
              05 May 2012 by Michael Gregory
              
              */
              
              
              #include <Servo.h> 
              
              Servo myservo; // create servo object to control a servo 
              
              int potpin = 0; // analog pin used to connect the potentiometer
              int leftVal; // variable to read the value from the analog pin 
              int rightVal; // variable to read the value from the analog pin 
              int pos = 0; // variable to store the servo position 
              
              
              
              // constants won't change. They're used here to 
              // set pin numbers:
              const int buttonPin = 2; // the number of the pushbutton pin
              const int ledPin = 13; // the number of the LED pin
              
              // Variables will change:
              int ledState = HIGH; // the current state of the output pin
              int buttonState; // the current reading from the input pin
              int lastButtonState = LOW; // the previous reading from the input pin
              int stage = 0;
              
              // the following variables are long's because the time, measured in miliseconds,
              // will quickly become a bigger number than can be stored in an int.
              long lastDebounceTime = 0; // the last time the output pin was toggled
              long debounceDelay = 50; // the debounce time; increase if the output flickers
              
              boolean posFixed = false; // keeps track of whether or not a fix to positions was made (5/9/12 - CT)
              int trueLeftVal; // left (ccw) position value after any fix, if needed (5/9/12 - CT)
              int trueRightVal; // right (cw) position value after any fix, if needed (5/9/12 - CT)
              
              void setup() {
                pinMode(buttonPin, INPUT);
                pinMode(ledPin, OUTPUT);
                digitalWrite(buttonPin, HIGH);
                Serial.begin(9600); // open the serial port at 9600 bps:
                myservo.attach(9); // attaches the servo on pin 9 to the servo object 
              }
              
              void loop() {
                // read the state of the switch into a local variable:
                int reading = digitalRead(buttonPin);
              
                // check to see if you just pressed the button 
                // (i.e. the input went from LOW to HIGH), and you've waited 
                // long enough since the last press to ignore any noise: 
              
                // If the switch changed, due to noise or pressing:
                if (reading != lastButtonState) {
                  // reset the debouncing timer
                  lastDebounceTime = millis();
                } 
              
                if ((millis() - lastDebounceTime) > debounceDelay) {
                  // whatever the reading is at, it's been there for longer
                  // than the debounce delay, so take it as the actual current state:
                  buttonState = reading;
                  if(reading == LOW){ //this is definitely a debounced button press
                    Serial.print(leftVal);
                    Serial.print(rightVal);
                    if(stage == 3) // if in the "stopped" stage, reset to start
                    {
                      stage = 0;  
                    }
                    else
                    {
                      stage += 1; 
                    }
                    delay(1000);
                  }  
                }
              
                if (stage == 0){ //this is the stage when the user sets the CCW limit of the servo
                  leftVal = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) 
                  leftVal = map(leftVal, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) 
                  myservo.write(leftVal); // sets the servo position according to the scaled value 
                  delay(15); // waits for the servo to get there 
                 
                }
              
                if (stage == 1){ //this is the stage when the user sets the right limit of the servo
                  //Serial.print(leftVal);
                  rightVal = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) 
                  rightVal = map(rightVal, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) 
                  myservo.write(rightVal); // sets the servo position according to the scaled value 
                  delay(15); // waits for the servo to get there 
                  
                }
              
                if (stage == 2){ //this is the stage when servo rotates back and forth in the limits set with the knob
                  //Serial.print(rightVal);
                  //if(rightVal < leftVal)
                  //{
                    boolean _stop = false;
                    
                    //check to see if the user has entered the left and right values in reverse...  if so,
                    //flip the left and right positions, and then continue
                    if(rightVal < leftVal && posFixed == false)
                    {
                      posFixed = true;
                      trueRightVal = leftVal;
                      trueLeftVal = rightVal; 
                    }
                    else
                    {
                      trueRightVal = rightVal;
                      trueLeftVal = leftVal; 
                    }
                    
                    if(!_stop)
                    {
                      for(pos = trueLeftVal; pos < trueRightVal; pos += 1) // goes from 0 degrees to 180 degrees 
                      { // in steps of 1 degree
                        myservo.write(pos); // tell servo to go to position in variable 'pos' 
                        delay(60); // waits 60ms for the servo to reach the position 
                        
                        // the following is to interrupt the process of the button is pressed again
                        int reading = digitalRead(buttonPin);
                        // check to see if you just pressed the button 
                        // (i.e. the input went from LOW to HIGH), and you've waited 
                        // long enough since the last press to ignore any noise: 
                      
                        // If the switch changed, due to noise or pressing:
                        if (reading != lastButtonState) {
                          // reset the debouncing timer
                          lastDebounceTime = millis();
                        } 
                      
                        if ((millis() - lastDebounceTime) > debounceDelay) {
                          // whatever the reading is at, it's been there for longer
                          // than the debounce delay, so take it as the actual current state:
                          buttonState = reading;
                          if(reading == LOW){ //this is definitely a debounced button press
                            stage = 3;
                            
                            _stop = true; // set the _stop bool to true so no further loops are run, and the servo stops in its tracks (5/9/12 - CT)
                            break;
                          }
                        }
                      }
                    }
                    if(!_stop)
                    {
                      for(pos = trueRightVal; pos>=trueLeftVal; pos-=1) // goes from 180 degrees to 0 degrees 
                      { 
                        myservo.write(pos); // tell servo to go to position in variable 'pos' 
                        delay(60); // waits 60ms for the servo to reach the position 
                        
                        int reading = digitalRead(buttonPin);
                        // check to see if you just pressed the button 
                        // (i.e. the input went from LOW to HIGH), and you've waited 
                        // long enough since the last press to ignore any noise: 
                      
                        // If the switch changed, due to noise or pressing:
                        if (reading != lastButtonState) {
                          // reset the debouncing timer
                          lastDebounceTime = millis();
                        } 
                      
                        if ((millis() - lastDebounceTime) > debounceDelay) {
                          // whatever the reading is at, it's been there for longer
                          // than the debounce delay, so take it as the actual current state:
                          buttonState = reading;
                          if(reading == LOW){ //this is definitely a debounced button press
                            stage = 3;
                            
                            _stop = true; // set the _stop bool to true so no further loops are run, and the servo stops in its tracks (5/9/12 - CT)
                            break;
                          }
                        }
                      }
                    }
                }
                
                if(stage == 3) {
                  // do nothing...  acts as a stopping point
                }
              
              
                // set the LED using the state of the button:
                digitalWrite(ledPin, buttonState);
              
                // save the reading. Next time through the loop,
                // it'll be the lastButtonState:
                lastButtonState = reading;
              }

              Comment


              • #22
                Wow that's great! Open source FTW!

                Comment


                • #23
                  Originally posted by Kindly Killer View Post
                  Wow that's great! Open source FTW!
                  Fixed some bugs in my stop code. Removed the "stopped" stage so that if the button is pressed while the traverse is running, the program will simply go back to the "set limits" stage (stage 0).

                  Code:
                  /* 
                  
                  Traverse control, using mostly cut-and-paste code from Arduino documentation and online examples. 
                  Credits from plundered sketches are at the very bottom of the code.
                  
                  05 May 2012 by Michael Gregory
                  
                  */
                  
                  
                  #include <Servo.h> 
                  
                  Servo myservo; // create servo object to control a servo 
                  
                  int potpin = 0; // analog pin used to connect the potentiometer
                  int leftVal; // variable to read the value from the analog pin 
                  int rightVal; // variable to read the value from the analog pin 
                  int pos = 0; // variable to store the servo position 
                  
                  
                  
                  // constants won't change. They're used here to 
                  // set pin numbers:
                  const int buttonPin = 2; // the number of the pushbutton pin
                  const int ledPin = 13; // the number of the LED pin
                  
                  // Variables will change:
                  int ledState = HIGH; // the current state of the output pin
                  int buttonState; // the current reading from the input pin
                  int lastButtonState = LOW; // the previous reading from the input pin
                  int stage = 0;
                  
                  // the following variables are long's because the time, measured in miliseconds,
                  // will quickly become a bigger number than can be stored in an int.
                  long lastDebounceTime = 0; // the last time the output pin was toggled
                  long debounceDelay = 50; // the debounce time; increase if the output flickers
                  
                  boolean posFixed = false; // keeps track of whether or not a fix to positions was made (5/9/12 - CT)
                  int trueLeftVal; // left (ccw) position value after any fix, if needed (5/9/12 - CT)
                  int trueRightVal; // right (cw) position value after any fix, if needed (5/9/12 - CT)
                  
                  const int delaytime = 60; // this delay controls the speed of the traverse...  higher=slower
                  boolean _stop = false;
                  
                  void setup() {
                    pinMode(buttonPin, INPUT);
                    pinMode(ledPin, OUTPUT);
                    digitalWrite(buttonPin, HIGH);
                    Serial.begin(9600); // open the serial port at 9600 bps:
                    myservo.attach(9); // attaches the servo on pin 9 to the servo object 
                  }
                  
                  void loop() {
                    // read the state of the switch into a local variable:
                    int reading = digitalRead(buttonPin);
                  
                    // check to see if you just pressed the button 
                    // (i.e. the input went from LOW to HIGH), and you've waited 
                    // long enough since the last press to ignore any noise: 
                  
                    // If the switch changed, due to noise or pressing:
                    if (reading != lastButtonState) {
                      // reset the debouncing timer
                      lastDebounceTime = millis();
                    } 
                  
                    if ((millis() - lastDebounceTime) > debounceDelay) {
                      // whatever the reading is at, it's been there for longer
                      // than the debounce delay, so take it as the actual current state:
                      buttonState = reading;
                      if(reading == LOW) { //this is definitely a debounced button press
                        Serial.print(leftVal);
                        Serial.print(rightVal);
                     
                        stage += 1;
                        
                        delay(1000);
                      }  
                    }
                  
                    if (stage == 0) { //this is the stage when the user sets the CCW limit of the servo
                      leftVal = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) 
                      leftVal = map(leftVal, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) 
                      myservo.write(leftVal); // sets the servo position according to the scaled value 
                      delay(15); // waits for the servo to get there   
                     _stop = false; 
                    }
                  
                    if (stage == 1) { //this is the stage when the user sets the right limit of the servo
                      //Serial.print(leftVal);
                      rightVal = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) 
                      rightVal = map(rightVal, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) 
                      myservo.write(rightVal); // sets the servo position according to the scaled value 
                      delay(15); // waits for the servo to get there 
                    }
                  
                    if (stage == 2) { //this is the stage when servo rotates back and forth in the limits set with the knob
                      //Check to see if the user has entered the left and right values in reverse...  if so,
                      //flip the left and right positions, and then continue
                      if(rightVal < leftVal && posFixed == false) {
                        posFixed = true;
                        trueRightVal = leftVal;
                        trueLeftVal = rightVal; 
                      } else {
                        trueRightVal = rightVal;
                        trueLeftVal = leftVal; 
                      }
                        
                      if(!_stop) {
                        //Serial.print(travDelay);
                        for(pos = trueLeftVal; pos < trueRightVal; pos += 1) { // goes from 0 degrees to 180 degrees 
                          // in steps of 1 degree
                          myservo.write(pos); // tell servo to go to position in variable 'pos' 
                          delay(delaytime);
                            
                          // the following is to interrupt the process of the button is pressed again
                          int reading = digitalRead(buttonPin);
                          // check to see if you just pressed the button 
                          // (i.e. the input went from LOW to HIGH), and you've waited 
                          // long enough since the last press to ignore any noise: 
                          
                          // If the switch changed, due to noise or pressing:
                          if (reading != lastButtonState) {
                            // reset the debouncing timer
                            lastDebounceTime = millis();
                          } 
                          
                          if ((millis() - lastDebounceTime) > debounceDelay) {
                            // whatever the reading is at, it's been there for longer
                            // than the debounce delay, so take it as the actual current state:
                            buttonState = reading;
                            
                            if(reading == LOW) { //this is definitely a debounced button press
                              stage = 3;
                                
                              _stop = true; // set the _stop bool to true so no further loops are run, and the servo stops in its tracks (5/9/12 - CT)
                              break;
                            }
                          }
                        }
                      }
                        
                      if(!_stop) {
                        for(pos = trueRightVal; pos>=trueLeftVal; pos-=1) { // goes from 180 degrees to 0 degrees
                          myservo.write(pos); // tell servo to go to position in variable 'pos' 
                          delay(delaytime);
                            
                          int reading = digitalRead(buttonPin);
                          // check to see if you just pressed the button 
                          // (i.e. the input went from LOW to HIGH), and you've waited 
                          // long enough since the last press to ignore any noise: 
                          
                          // If the switch changed, due to noise or pressing:
                          if (reading != lastButtonState) {
                            // reset the debouncing timer
                            lastDebounceTime = millis();
                          } 
                          
                          if ((millis() - lastDebounceTime) > debounceDelay) {
                            // whatever the reading is at, it's been there for longer
                            // than the debounce delay, so take it as the actual current state:
                            buttonState = reading;
                            
                            if(reading == LOW) { //this is definitely a debounced button press
                              stage = 3;
                                
                              _stop = true; // set the _stop bool to true so no further loops are run, and the servo stops in its tracks (5/9/12 - CT)
                              break;
                            }
                          }
                        }
                      }
                    }
                    
                    if(stage == 3) { // basically just a "reset to start" stage
                      stage = 0;
                    }
                  
                    // set the LED using the state of the button:
                    digitalWrite(ledPin, buttonState);
                  
                    // save the reading. Next time through the loop,
                    // it'll be the lastButtonState:
                    lastButtonState = reading;
                  }

                  Comment


                  • #24
                    Originally posted by Chris Turner View Post
                    Has anyone explored the idea of using an arduino board for this?
                    I guess you didn't see this old thread?

                    http://music-electronics-forum.com/t18663/
                    It would be possible to describe everything scientifically, but it would make no sense; it would be without meaning, as if you described a Beethoven symphony as a variation of wave pressure. — Albert Einstein


                    http://coneyislandguitars.com
                    www.soundcloud.com/davidravenmoon

                    Comment


                    • #25
                      Originally posted by copperheadroads View Post
                      YOU JUST NEED MORE PRACTICE handwinding
                      get confortable , rest you hands & put you feet flat on the floor
                      I've been hand winding for about seven years now. I'd rather have a winder that does it for me! I could be doing other things for those 10 minutes or so....
                      It would be possible to describe everything scientifically, but it would make no sense; it would be without meaning, as if you described a Beethoven symphony as a variation of wave pressure. — Albert Einstein


                      http://coneyislandguitars.com
                      www.soundcloud.com/davidravenmoon

                      Comment


                      • #26
                        Originally posted by David Schwab View Post
                        I guess you didn't see this old thread?

                        http://music-electronics-forum.com/t18663/

                        Oh... yeah, I think I've browsed that thread. I didn't realize it was running off of an arduino board.

                        EDIT: Hell, I didn't just browse it, I posted in it several times. Ha!

                        As soon as I get some cash together, I'm going to pick up a stepper motor, driver board, and LED module, and start hashing out my own winder. Probably won't be as elaborate as Elepro's setup. My plan is to base it off of the winder shown here: Arduino Guitar Pickup Winder. With the auto-traverse I plan on adding, it should be pretty slick.
                        Last edited by Chris Turner; 05-19-2012, 07:25 PM. Reason: Derp!

                        Comment


                        • #27
                          Originally posted by David Schwab View Post
                          I guess you didn't see this old thread?

                          http://music-electronics-forum.com/t18663/
                          Is the code and schematic available?

                          Comment


                          • #28
                            I think you can still order a PCB and programmed PICs from Elepro. It isn't open source if that's what you're looking for but it is standalone. You can also just buy MachIII and find code to run on an old PC or write your own code. Arduino and PicAx will do as well.

                            Comment


                            • #29
                              Right but I'm looking at the homemade criterion in the thread.

                              Comment


                              • #30
                                That all looks like a lot of work to me...like I say, two cheap single axis stepper drivers off ebay & a 24V psu, a demo version of MAch 3, and Gcoil to generate the g-code for the actual coil wind is all you need. Unless of course this is a mountaineer type ethos...you want to climb it because its there.

                                Comment

                                Working...
                                X