Announcement

Collapse
No announcement yet.

Adventures in Spindle Tachs for CNC

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

  • Adventures in Spindle Tachs for CNC

    My old spindle tach died so I had to make a new one and I had some adventures along the way. I thought I'd share in case someone else might learn from my adventures.

    I went with an NPN proximity sensor. Some people like to use an optical gate, but the proximity sensor method seemed simpler to me, and the $4 price was right. http://www.ebay.com/itm/150890634819...84.m1497.l2649

    I made a sensor bracket from scrap metal and clamped it to the lathe with a hose clamp. I reused the old "target" which was a 3/16 x 10-32 setscrew JB'd to the spindle. If I had to do it over again, I'd prolly just hose clamp some sort of target to the spindle, rather than using glue.


    My old sensor had originally worked fine with unshielded wire, but this new sensor did not. So I had to upgrade to shielded wire, with the shield tied to the system's common ground. Then the tach worked fine at low RPM. However, it would start giving errors around 1000 rpm, often reading half the true speed. Various tweaks to the wiring failed to fix the high speed errors.

    Soooo..... I tried a larger target, figuring that would give the PC more time to read the signal. I just screwed a nut onto the existing setscrew. Bingo! Now it reads reliably at all speeds that I tried, up to 2100 rpm. I didn't try anything faster than 2100 rpm and normally I wouldn't run that fast, anyway.


    Here is how I wired it, bearing in mind that I am using a non-isolated breakout board. Isolated BOB's may require different wiring.

    The purpose of the resistor is to drop the voltage at P13 down from 12V to 5V. The tach will work without the resistor, but in theory it's better not to shoot the parallel port with more voltage than it's designed to handle.

  • #2
    With a NPN sensor, you can supply the sensor with the normal power, usually 10 to 30 vdc and the output is open collector type. You can use a 1K pull-up resistor between your 5v board positive supply and the black lead of the sensor and then connect to P13 on BOB. The effect will be the following: when the sensor's not activated, a 5 v voltage will be present on the output, when it detects the nut, this voltage will go low to almost 0v thus creating a clean pulse.


    Helder Ferreira,
    Setubal, Portugal
    Helder Ferreira
    Setubal, Portugal

    Comment


    • #3
      I use a fiber optic retroreflective sensor on my mill. Just painted a bit of the pulley black.

      Comment


      • #4
        IR photo sensor here.... and a home made encoder ring for the spindle.

        Comment


        • #5
          Noitoen is correct. The resistor is not an effective way of acheiving what you need.

          If you're worried about over-voltage on the port, then you should connect a resistor in series between the sensor and port, then have a suitable zener diode (for 5V protection, you'd normally use a 5.1V zener) between the port and ground. That way if the voltage goes too high, the zener conducts limiting the voltage on the port, and the resistor limits how much current is actually flowing through the sensor/zener and stops magic smoke being released from anything.

          Comment


          • #6
            Originally posted by M_C View Post
            Noitoen is correct. The resistor is not an effective way of achieving what you need.
            Why is my resistor not effective? It dropped the 12V from the sensor down to 5.1V at P13. I'm not arguing, just trying to understand.

            I'm guessing your zener proposal would be able to handle some variation in voltage, whereas my resister is sized to handle 12V and only 12V?

            Still, since the sensor is powered by the computer's 12V, the sensor output should never exceed 12V under normal circumstances, unless my lathe is struck by lightning, in which case I'll have other things to worry about (The power pole near my house did get hit by lightning some years back and it did zap some of my equipment).

            I ran with 12V from the sensor applied directly to P13 for years, and it never seemed to bother the computer, but I just thought it sounded like a bad practice? Surely there must be some limit to how much the PC's parallel port can handle?

            I appreciate the contributions on alternative CNC tach methods. You'd think it would be straightforward yet there seems to be some confusion on the subject, and different suppliers make different recommendations, particularly with regards to how to connect to the BOB and whether any signal conditioning is required.

            I've had a chance to do a little bit of CNC threading lately (which is why I needed to figure out my BOB and tach) and my tach has been working OK. One in a great while it'll hiccup but not enough to complain about. I'm wondering what the optimal sensor target size is, and what the optimal degrees of dwell is? My experiment with the nut proved that the dwell time can make a big difference, but I'd never seen that discussed on CNC forums. :/

            Comment


            • #7
              Originally posted by MTNGUN View Post
              Why is my resistor not effective? It dropped the 12V from the sensor down to 5.1V at P13. I'm not arguing, just trying to understand.
              Its is not a good design. At the very least I would use a voltage divider. Look it up.

              For this kind of stuff I use an opto22 module like this: http://www.opto22.com/site/pr_detail...4&item=G4IDC5B

              You can get them for next to nothing on ebay and give a nice, clean signal out.

              Comment


              • #8
                Originally posted by macona View Post
                Its is not a good design. At the very least I would use a voltage divider. Look it up.

                For this kind of stuff I use an opto22 module like this: [url]http://www.opto22.com/site/pr_details.aspx?cid=4&item=G4IDC5B[/ur]

                You can get them for next to nothing on ebay and give a nice, clean signal out.
                Thanks for the tip on the opto isolator. At the the moment I'm using a non-isolated BOB, but if I were using an isolated BOB, would the opto22 still be helpful?

                I was under the impression that my circuit *was* a voltage divider, bearing in mind that the proximity sensor has an internal resistance of roughly 10K ohms ?

                This is what Wiki shows as a voltage divider. It's functionally identical to my circuit.

                Comment


                • #9
                  It's best to ignore what's inside of the sensor. Just consider it not current limited and work from there.

                  Yes, the opto22 is good for just about anything. They also help clean up the signal if you have some noise in the line. I use these guys in my mill and my lathe and I am using a whole bunch more for the laser welder. It needs a massive amount of isolated IO.

                  Comment


                  • #10
                    UPDATE: a couple of things have happened since my last tach post.

                    It turned out that I had to filter the tach signal with a software"debounce" in order to get CNC threading to work satisfactorily. Without the debounce, the signal would intermittently "hiccup" in the middle of cutting a thread -- you couldn't see it, but it was there -- and the Z velocity would change to attempt to keep up with what it perceived as a changing RPM. That screwed up the thread. The debounce set up was a bit of a pain in LinuxCNC but my HAL changes were posted on the LinuxCNC forum if anyone is interested. I haven't had a bit of problem with threading since adding the debounce.

                    Today, I converted another lathe to the same tach and the same software. Since everything was 100% identical, I was surprised when the results were not identical. The signal seemed to crap out at about 250 rpm. As I increased the revs above 250 rpm, the displayed speed would decrease until it was zero.

                    I tried a second Chinese sensor and was able to get the speed up to 400 rpm before the signal crapped out.

                    Adjusting the sensor gap to a bare minimum increased the working speed up to 650 rpm.

                    The fact that it was sensitive to the gap between the sensor and the target suggested that it might have something to do with the signal's "dwell" time. So I replaced the original target, that only provided about 5 degrees dwell, with section cut from a piece of pipe that provides nearly 180 degrees dwell. Lo and behold, problem solved. Now it has a clean RPM signal at any speed.




                    I suspect a better quality sensor would not be so sensitive to the size of the target.
                    Last edited by MTNGUN; 11-19-2014, 04:32 PM.

                    Comment


                    • #11
                      If you are running LinuxCNC you ought to put a timing belt pulley on the spindle and install an encoder. It will work a lot better than a single point reference.

                      Comment


                      • #12
                        Originally posted by MTNGUN View Post
                        I suspect a better quality sensor would not be so sensitive to the size of the target.
                        The response time on some of these proximities is not that high, especially the cheaper imports.
                        Max.

                        Comment


                        • #13
                          Originally posted by macona View Post
                          If you are running LinuxCNC you ought to put a timing belt pulley on the spindle and install an encoder. It will work a lot better than a single point reference.
                          That's what I was told over at the LinuxCNC forum, and I purchased the optical sensors to build a proper quadrature encoder, but after adding the software debounce and sorting out the target requirement I have not encountered any problems with my $3 chinese tach. So the optical sensors have been set aside. I'm sure I'll find a use for them someday.

                          Comment

                          Working...
                          X