PC joystick to (Servo or Stepper) STEP/DIRECTION


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Ok, I know I can be a bit dense at times, but I think I finally have it. All you really want to do is jog x,y to a point, fire the trigger(this will invoke cycle start or run), a program will run in mach, when done you will jog to a new position and run again. And I get that the trim will be used to set the full scale speed of for the stick. ie: trim in 1 position, full stick may be 200pps max, while another position will be 400 pps max. full trim will set full stick to 6000 pps max, and all the numbers in between. Do I finally have it?

    I think with a small bit of rearranging, my posts still apply in concept, just not in operation. I did realize the person is closing the loop, but I know on my mills and lathes, it it far too easy to jog right onto a limit, without which it would crash.

    What I did not realize was you are planning to have mach still be able to run also. To me, the software side for the pic is pretty stright forward, but I am not sure how you will interface the 2 (joy stick and mach). How you will be doing this might have bearing on your program.

    After you have time to read over all the babbling I did, feel free to keep asking questions. I enjoy helping on things like this as I love puzzles.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  2. #2
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default Seems no one can hear all the voices in my head....

    Sorry about that, all of this made prefect sense in my head, I didn't do a very good job of explaining it to you.

    The comment about Mach3 should have been clarified. The control panel will have a selector to determine if Mach3 will have the control or it will be given to the joystick exclusively. They will never share control and the joystick isn't meant to control through Mach3. The control panel may be shared with my mill in the future, in which case a pendant will make more sense. For now, the gantry isn't set up for heavy machining and just needs a semi-automated positioning. I think Henrik is correct, Mach3 has a provision for joystick input, but this is more an experiment in direct control with the PIC and joystick. Currently the application with the gantry and Mach3 may be masking the usefulness of this. Since Step/Direction controls are easily available and can be used with servos or steppers, there are a lot of uses for an independent control system that is very intuitive. I'm thinking animatronics and such too.

    I have had a little time and started to study your thoughts and I agree, the main parts are there. I also am studying Walter's link to glean how it was done there. Sorry I don't have any code to share yet, I'm still working through the structure.

    Bo

  3. #3
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default No Worries :)

    Nobody ever hears mine either. It doesn't really matter if I understand what you intend to do. It only matters if I understand your question(s). So assuming I have the joystick operation correct, I can try and help you with the structure. Its no matter about mach. You asked for help with the actual driving of the step part. I, as I always do, went off making assumptions about your application. Sorry bout that. Seems after 20 years of helping customers in a small job shop machine shop, I now try to get at what they want to do, just in case there is more to the question then they realize. I will call it a job hazzard.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  4. #4
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Talking Sidetracked

    OK, Bert, I just got sucked into your site for the past few hours! Shame on you for distracting me! I'm suppose to be cranking out code!

    That's neat stuff, I and never considered some of these techniques. Pretty amazing results.

    Do you discuss your phlat-cha-ma-callit anywhere? Also would love to know more about your 4D hotwire. Couldn't discern much from the picture.

    You know what.... better yet, don't tell me about it, otherwise, I'll never get anything done!

    Back to MicroCode Studio....

    Bo

  5. #5
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default Math thoughts

    So here is the path that my mind is headed down:

    Pulley Circumference 2.375"
    Rev/Sec 4.21
    Travel/Sec 10"
    Pulse/sec 6063
    Counts/bit A-D 12.126
    Freq of pulses 165 uS

    My conclusion so far is:
    You have a control range of 500 A/D counts on each side (plus/minus)
    for every bit of A/D change, you increment your pulses sent out by 12.126 @ full speed
    you have to be able to send a pulse every 165 uS to get full speed
    encoder counts of 1440/rev give you a movement of 0.00165" per count

    So, as long as I can read the A/D's, adjust the gain, check limits, and send out 2 pulse trains in under that time, I should be able to make it work.

    Anybody see any holes?

    Bo
    Last edited by boroko; - 30th October 2010 at 22:27.

  6. #6
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default Trying to get the algorithm

    What I'm not seeing is a way to connect the 0-500 A/D reading to the 165uS rollover of the timer.

    Setting one of the timers so that at max Z, it will rollover at 165uS, I can adjust that timer with the Z to slow it down and get the "gain", ie: increase the time it takes to rollover

    Reading the A/D, I can tell whether it is above 528 or below 500 and set direction.

    Each of the 4 possible 0-500 values signify the number of those rollovers that generate pulses out.

    Does this snippet look plausible?
    Code:
    IntCnt  var  word
    ADval   var  word[3]
    Holdoff var  word[3]       
    '**** Interrupt ****************
           IntCnt = IntCnt + 1       
           ADval[n]*12 = Holdoff[n]
           if IntCnt = Holdoff[n] then Pulse
              else NoPulse
              endif
    Pulse: 
           Pin[n] low         ' drive a step pulse active
           IntCnt = 0         ' clear count of interrupts 
           pauseus 2          ' delay to meet minimum time for drive
           Pin[n] high        ' return the pulse to inactive
           return             '
    NoPulse:
           return             ' go back without sending a pulse
    Bo

  7. #7
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Bo, I'll pm about the site. Feels like spamming to discuss it here.

    Deleted wrong information
    Last edited by cncmachineguy; - 31st October 2010 at 01:42. Reason: i was wrong
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

Members who have read this thread : 0

You do not have permission to view the list of names.

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