3 pcs Electronic hand wheel encoders to Audurino uno ?

Discussion in 'CNC Machines and Conversions' started by kadora, Aug 8, 2018.

Help Support HMEM by donating using the link above.
  1. Aug 8, 2018 #1

    kadora

    kadora

    kadora

    Project of the Month Winner!!! Project of the Month Winner HMEM Supporter

    Joined:
    Jul 1, 2012
    Messages:
    374
    Likes Received:
    303
    Hello friends.
    I am building small milling router but I would like to control it by electronic
    hand wheel encoders separately one wheel for each axis . /to be independent on computer/
    I have Arduino uno board + red shield with motor drivers.
    Encoder wheels 5V - 100 pulses per rev. - outputs A,B,-A,-B.
    So my question
    Is possible to control X,Y,Z axis with X,Y,Z hand wheel encoders connected to Arduino board only?
    If it is possible could you please explain me how to do it or where to find a tutorial?
    Thank you
    CNC beginner .
     
  2. Aug 8, 2018 #2

    Anatol

    Anatol

    Anatol

    Well-Known Member

    Joined:
    Jan 22, 2018
    Messages:
    214
    Likes Received:
    36
    Gender:
    Male
    Location:
    Los Angeles
    Are you asking if you can make 'manual' control of each axis, each axis encoder directly controlling its respective motor?
    Can you send more details of the encoders? (brand, part number...)
     
  3. Aug 9, 2018 #3

    kadora

    kadora

    kadora

    Project of the Month Winner!!! Project of the Month Winner HMEM Supporter

    Joined:
    Jul 1, 2012
    Messages:
    374
    Likes Received:
    303
    Hello Anatol
    I need exactly what you described .
    I have only wheel encoder pictures from ebay . There is not mentioned if it is kind of magnetic or light
    encoder but output are 5v impulses./see last picture/ and China production.
    Thank you for your effort to help me.
     

    Attached Files:

  4. Aug 9, 2018 #4

    Anatol

    Anatol

    Anatol

    Well-Known Member

    Joined:
    Jan 22, 2018
    Messages:
    214
    Likes Received:
    36
    Gender:
    Male
    Location:
    Los Angeles
    Those are cute. but not what I would call rotary encoders = shaft encoders.
    Presumably they are 'absolute', not relative. 100 pts per rev is 3.6 degrees per step, probably not accurate enough. The diag seems to indicate gray code (I don't read chinese). - which will quadruple your resolution, but to 100 or 400?
    Interface with Arduino will be trivial, as long as you have enough digital-in lines. Driving the steppers (are hey steppers?) much more difficult, especially if you use PID, which is more or less required.
     
  5. Aug 10, 2018 #5

    Wizard69

    Wizard69

    Wizard69

    Well-Known Member

    Joined:
    Mar 9, 2013
    Messages:
    1,188
    Likes Received:
    241
    Im not sure if i follow 100% what you are asking but if you want control completely independent of the Arduino the easiest way likely would be an OR gate controlling the step signal. You would also need logic to support decoding the direction signal.

    The step signal is easy. How to come up with a direction signal not so easy.

    Im not certain why you want independent control. Generally you are better off letting the CNC controller take care of count collection and management of position data.
     
  6. Aug 10, 2018 #6

    kadora

    kadora

    kadora

    Project of the Month Winner!!! Project of the Month Winner HMEM Supporter

    Joined:
    Jul 1, 2012
    Messages:
    374
    Likes Received:
    303
    Thank you friends
    Wizard69
    I want to control my mini router ball screws with electronic wheels via steppers instead of classic handwheels
    attached straight to the ball screws.//Ball screw 4 mm per turn = poor handwheel resolution + need for some kind of ball screw brake.//
    Maybe it is crazy idea but I would like to have PC independent router as well as router which is easily reconfigurable to work as cnc machine. For example one ardurino box for electronic wheel controller and second arduino box for normal cnc controller.
    Have a nice weekend
     
  7. Aug 11, 2018 #7

    Wizard69

    Wizard69

    Wizard69

    Well-Known Member

    Joined:
    Mar 9, 2013
    Messages:
    1,188
    Likes Received:
    241
    If the goal is to drive steppers via hand wheels you can use simple shaft encoders to produce the step pulse train. As stated above deriving the direction signal will take a bit more work.

    Im trying to understand why you want to do this. In some cases you can get away with a direction toggle switch. In other cases you are better off decoding the direction signal from the encoders A&B signals.
     
  8. Aug 11, 2018 #8

    ignator

    ignator

    ignator

    Member

    Joined:
    Jan 22, 2012
    Messages:
    18
    Likes Received:
    8
    Gender:
    Male
    Occupation:
    Retired EE
    Location:
    USA, Iowa
    Kadora: Go to youtube, and do a search of "Arduino encoder tutorial". There are minions of videos posted. Work through the tutorial, which will give a link to download or copy the code needed to get you started. Most will use an output terminal (virtual display with print commands so you can see what the counters are doing for your encoder pulse changes) simulation so you can see how it will count up and down. Also look for a video on stepper motor control with arduino, and follow one or more tutorials on that. You can find a tutorial of both an encoder combined with a stepper. But you really want to understand the basics of each operation, which will enable you to integrate any future CNC external commands to drive the stepper motors from a PC driving them.
    I don't understand Anatol's comment about requiring a PID control as this is needed for analog motor servos. Stepper motor control is "open loop" as it is assumed that a step pulse command will move the shaft. This will only happen if the drive torque of the stepper can exceed all friction and cutting forces that a router bit induces into the work piece. As you are the operator, you provide the closed loop control of what is happening. If you are in a CNC mode, and the step speed or torque of the motor are exceeded the system will loose some pulses. The only way around this is a higher torque motor, slower pulses, or an absolute position (e.g. DRO system) used to close the position loop.
     
  9. Aug 11, 2018 #9

    Anatol

    Anatol

    Anatol

    Well-Known Member

    Joined:
    Jan 22, 2018
    Messages:
    214
    Likes Received:
    36
    Gender:
    Male
    Location:
    Los Angeles
    Ignator, quite right. PID is irrelevant for steppers. But kadora had not specified, he just said "read shield with motor drivers", so it wasn't clear he was talking steppers.
     
  10. Aug 12, 2018 #10

    Wizard69

    Wizard69

    Wizard69

    Well-Known Member

    Joined:
    Mar 9, 2013
    Messages:
    1,188
    Likes Received:
    241
    I'm not on the cell phone so I have an additional bit to add. Chips like these: https://www.usdigital.com/products/interfaces/ics/LS7184N-S take the A & B outputs of an encoder and convert them to other useful signal formats. In this case a clock and up/down signal.

    I'm still wondering about the hows and whys. Generally if you have a CNC machine you are better off getting the controller to respond to your jog commands and move an axis for you
     
  11. Aug 12, 2018 #11

    Cogsy

    Cogsy

    Cogsy

    Moderator Moderator Global Moderator

    Joined:
    Jul 30, 2012
    Messages:
    2,226
    Likes Received:
    642
    Gender:
    Male
    Location:
    Perth, Western Australia
    From what I read, I think he wants to be able to easily switch from CNC to manual operation, but have the handwheels operate electronically. I know I wouldn't want to manually machine anything on a CNC mill simply using jogging. I can see where this would be useful as well - if you've only got one machine and want to do a series of simple operations on a part and don't want to generate g-code, flick the switch to manual and have at it. Then, when you're finished, flick back to CNC and run your next part. If I was going CNC I think I'd be interested in something like this as well.
     
    kadora likes this.
  12. Aug 12, 2018 #12

    kadora

    kadora

    kadora

    Project of the Month Winner!!! Project of the Month Winner HMEM Supporter

    Joined:
    Jul 1, 2012
    Messages:
    374
    Likes Received:
    303
    Hello
    Thank you guys for your answers .
    Cogsy described my needs perfectly : simple operations on a part and don't want to generate g-code, flick the switch to manual and have at it. Then, when you're finished, flick back to CNC . Thank you Cogsy.
    Ignator I spent many hours on internet searching for 3 encoders to arduino tutorial but I found tutorials only
    for one encoder .
    Anyway thank you friends for your effort to help me. Now I see that three encoders connection is not easy task.
     
  13. Aug 13, 2018 #13

    ignator

    ignator

    ignator

    Member

    Joined:
    Jan 22, 2012
    Messages:
    18
    Likes Received:
    8
    Gender:
    Male
    Occupation:
    Retired EE
    Location:
    USA, Iowa
    Kadora, you most likely will not find a tutorial on your wanted operation. This you will need to produce on your own, and my post was to point you in a direction of how to learn Arduino operations so you can make this system yourself. If you looked at any of the encoder tutorials, they will teach you how an encoder works with the A and B phase, which your encoder of choice produces. And how to count pulses, and produce a direction signal. The direction signal is if the count is up or down. Most of these tutorials use an integer variable to count the encoder 'clicks', and by looking at the phase of the A and B, determine if the count should be incremented or decremented.
    In another tutorial, you can find out how to produce pulses to a connected stepper motor amplifier/driver, as that typically is as simple as a pulse/clock and a direction discrete output from the Arduino discretes.
    I have seen tutorials that will use an encoder and then drive a stepper. This is a single channel of what you want to have triple of.
    So in youtube search, I keyed in "arduino encoder stepper", which brought up many found videos, the first one being;
    If you follow through the tutorial, the author shows the arduino code, and describes what it is doing. If you click on the "Show more" under the video window, the authors web page is found where the code can be down loaded. You do have to search for this specific example on his web page, as I found it on the 4 sub-page of the site.
    Note all the other examples on this Brainy-bits page, even ones showing the driving of multiple steppers.
    If you have an Arduino Uno, you may not have enough discretes to control the 3 channels, and this may need an Arduino Due, or Mega that has a few more. Or you need to figure out using the direction and step signal connection in parallel to the 3 stepper amplifiers, with an enable discrete unique to each of them. But all of this will require YOU to do the coding and design. This is mostly copying the code and modifying it for your specific system.
    Understand, that if you post your code on this HMEN site, others will help you if you include the bugs you are experiencing.
    So in a follow up post or yours, you want to integrate your existing CNC control with a manual input. That is going to require some sort of switching between the output drivers of these 2 systems. That can be a big hurtle to over come, as if you put digital output drivers fighting each other, the one with the bigger transistor will most likely burn out the other driver. So you need some way of what is called "oring" the signal, so the CNC machine, OR the Arduino is in control without have what is called "bus contention". And I'm afraid I'm getting beyond your electronics skill, if I use the term "open collector driver".
    I hope this advice is of use.
     
    Anatol likes this.
  14. Aug 13, 2018 #14

    kadora

    kadora

    kadora

    Project of the Month Winner!!! Project of the Month Winner HMEM Supporter

    Joined:
    Jul 1, 2012
    Messages:
    374
    Likes Received:
    303
    Ignator thank you for prompt replay.
    I have to learn a lot from CNC art but I do not give up. I will start according your advice to study
    already written programs.
     
  15. Aug 14, 2018 #15

    Wizard69

    Wizard69

    Wizard69

    Well-Known Member

    Joined:
    Mar 9, 2013
    Messages:
    1,188
    Likes Received:
    241
    This i understand but the point i was trying to make is that the jog wheel talks to the CNC controller which then outputs to the steppers or servos. You do need a CNC controller capable of taking input from a pulse generator though.
    Id look at those chips i linked to earlier. Add some OR gates and it could give you what you are asking for. Your big hassle will be creating a PCB to mount your circuitry on. Id do some web searching to fond prior examples.
     
  16. Aug 25, 2018 #16

    swst

    swst

    swst

    Member

    Joined:
    Jul 25, 2014
    Messages:
    10
    Likes Received:
    2
    Hi kadora

    The simple method to use 3 individually Hand Wheel Encoders to control your CNC Machine XYZ Axial by Manual Feed without CNC Controller and Mach3 Controller.

    The selected switch to the control CNC / Manual .

    Connect power +5V and 0V to the Encoder VCC and 0V, A and B phase to be connected to the stepper driver pul + & Dir + , 0V to Pul - & Dir -.

    If the direction is reversed to change A & B connection each other.

    Please see the attached connection Diagram and YouTube
    Sunny Tam



    手輪連接圖02.jpg
     
    kadora likes this.
  17. Aug 26, 2018 #17

    Cogsy

    Cogsy

    Cogsy

    Moderator Moderator Global Moderator

    Joined:
    Jul 30, 2012
    Messages:
    2,226
    Likes Received:
    642
    Gender:
    Male
    Location:
    Perth, Western Australia
    I wonder if maybe a better, or at least different, option would be a directional joystick and potentiometer for speed control. Of course this assumes you have a DRO so you can hit your numbers without graduated dials. I can see this being a simple thing to implement with servos but no idea of difficulty with steppers. Just thinking aloud basically...
     
  18. Aug 26, 2018 #18

    kadora

    kadora

    kadora

    Project of the Month Winner!!! Project of the Month Winner HMEM Supporter

    Joined:
    Jul 1, 2012
    Messages:
    374
    Likes Received:
    303
    Thank you guys again
    SWST your solution is EXACTLY what I need . Thank you very much !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    COGSY it is interesting idea but to control steppers by this way is over my ability.
     
  19. Aug 26, 2018 #19

    tjwal

    tjwal

    tjwal

    Well-Known Member

    Joined:
    Sep 22, 2013
    Messages:
    49
    Likes Received:
    5
    Great find SWST. Amazing that it can be done without a microprocessor!
    I’ll have to look at it closer to understand how the signals work. The way he has the wheel connected provides step and direction. This two wire connection could also be used with an Arduino and avoids needing to concert grey code.

    I’ve used a UNO and two AS5048 magnetic encoders to control a remote camera head. Amongst other things it has to display current position while updating 50 times a second. I’ve no doubt that the UNO could be coupled to these handwheels to make a more versatile control. It could allow for varying gear ratios allowing for fast traverses and it could also be used to count and display steps for a simple DRO.

    Again. Great find!
     
  20. Aug 27, 2018 #20

    Wizard69

    Wizard69

    Wizard69

    Well-Known Member

    Joined:
    Mar 9, 2013
    Messages:
    1,188
    Likes Received:
    241
    I had another message that apparently didn't make it. In any event there are CMOS chips designed to do exactly what you want, an example is here: http://www.twovolt.com/2018/04/23/q...rection-signal-converter-using-ls7084-ls7184/ Here is a LSI data sheet for the newest rev.: https://lsicsi.com/datasheets/LS7183N_LS7184N.pdf

    The Sunny Tam solution might work for your needs but you need to watch out for a couple of things. One is that the drawing indicates a mechanical switch selecting between manual and automatic or NC control. This could lead to issues due to switch bounce and floating wires. How much of a problem is unknown but it is something to watch out for. The other potential problem is setup time for the direction input.
     
    kadora and Anatol like this.

Share This Page