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

    1 more thing to think about. Homing. when the pic is reset or on startup, you need to home the drives of course. I would do this by jumping to my "home routine" first and wait for a button press from 1 of the 4 on the jog stick. Now if you have home switches installed, you can just run a loop to send pulses at a fixed rate and check for the switch after each pulse. then when all axis are on switches set current pos to zero and goto main.

    if you don't have switches, maybe do something like hold 1 switch for confirmation and hold 1 of the remaining switches for each axis to travel in the direction of home. when you are where you want to be, release both then press 1 again to confirm that axis. do this for each axis.

    You main loop will just have to get A/D values(all 3) and check for timer overflow. and if you have limit switches, watch for them here also.
    -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

    I will have to study your reply more when I have a bit more time, but for clarification, I need to give a few more details.

    The intent of the analog of the joystick is to variably control the speed in each axis in 0-500 counts of the A/D in the respective direction: ie 0-500 = max speed to 0 in the - direction, 501-527 = no movement even though the DIR bit has changed, 528-1028 will drive 0 to max in the + direction. It will still control speed. The trim, or "Z" will control the gain for both channels. For instance, when the gain is low, the max deflection in any direction will be very small (read: slow). When the trim is full, the full deflection of the stick will drive in the respective direction as quickly at the device is able.

    I only quickly read your post because I need to go, but if I misread it, I apologize and will look at it in a few hours.

    Thanks for your feedback.
    bo

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


    Did you find this post helpful? Yes | No

    Default

    More reading.... I'm thinking we are looking at this a bit differently.

    For normal CNC, I can control the position accurately with Mach3 with limits and such. What the joystick is for is relative movement and is basically freehand. The limits will be in effect for protection, but are not needed for normal positioning. The closed loop with the joystick is the person with his hand on it. On this specific application, the Z axis is actually a separately controlled process. Specifically, when the trigger on the joystick is activated, it starts an operation at the X-Y location that you manually positioned it to. Later additions will inhibit the X-Y movement when this process starts, but for now it just needs to position the head. Think "Helicopter". More stick, more pronounced movement. If you want it to stop, center the stick, pull the trigger, and the magic happens right where you want it. when it is done, move the stick to the new location and do it again. You are only controlling direction and speed.

    OK, I hope that adds some clarification.

  4. #4
    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!

  5. #5
    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

  6. #6
    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!

  7. #7
    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

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