Simple RPM Detector

discussion of design changes / improvements / suggestions
Post Reply
swhillier
Posts: 50
Joined: Mon Jan 12, 2015 3:47 pm

Simple RPM Detector

Post by swhillier » Thu Apr 16, 2015 1:00 am

I have a DWP611 router which has electronic variable speed control. The speed control allows me to adjust the router speed from 16,000 RPM to 27,000 RPM. The speed is selected by picking a setting on the router that goes from 1 to 6. The actual RPM is not indicated so you need to guess by hoping the control provides linear increments from minimum to maximum RPM. Since RPM seemed important to calculating CNC feed and speed rates I thought it would be nice to know the actual RPM. You can remove the guess work for a few dollars by building a simple RPM detector.

I know there are some good router speed controllers out there but I wanted something cheap and easy. This RPM detector can be made using an Arduino, LCD keypad shield, optical sensor, white paint and a few extra parts. Depending on your source it should be less than $20 dollars not including a case. It’s also a fairly easy project that doesn’t require any drilling of holes in your router’s case.

There are three main pieces that are needed:
- RPM Sensor – uses an optical photosensor and a bit of white paint to detect the router spindle rotation.
- Sensor Interface – simple circuit to help deliver a single pulse for each spindle rotation.
- Arduino & LCD Shield – Microcontroller to calculate the RPM and a display to show it.

For the RPM optical sensor I used an RPR-220 (http://www.rohm.com/products/databook/s/pdf/rpr-220.pdf) because it was readily available and fairly cheap. There are also many similar products available. The photosensor has two parts. An infrared LED, the first part, reflects light off of objects to be detected by a phototransistor, the second part. It can be used to detect changes between dark and light. To detect the speed of the router spindle there needs to be a transition from dark to light and back again. Since my router collet was black I painted a white stripe on one side of it.
collet2.jpg
collet2.jpg (71.89 KiB) Viewed 2125 times
I soldered some wire leads onto the photosensor so that I could mount the sensor next to the router spindle and run the leads back to the sensor interface. The sensor needs to sit level with or slightly above the bottom of the spindle collet to get a good reading. I had already printed a deflector for my DWP611 based on http://www.shapeoko.com/forum/viewtopic ... +deflector . I taped the sensor to it for demonstration purposes. I plan to print a new deflector which has a slot where I can glue the sensor in permanently.

The sensor interface is a simple circuit that helps to clean up the signal coming from the RPM sensor so that the Arduino receives a clear pulse for every rotation of the spindle. I based mine on the Grove – Infrared Reflective Sensor http://www.seeedstudio.com/wiki/Grove_- ... ive_Sensor. It uses an op amp as a voltage comparator and has a potentiometer to adjust the comparator for the signal generated by the RPM sensor. It helps to guarantee that only a ‘0’ or ‘1’ is sent to the Arduino. I modified the circuit slightly for the op amp I had on hand:
RPM-Interface.png
RPM-Interface.png (14.09 KiB) Viewed 2125 times
I used a small breadboard to create my sensor interface board:
https://drive.google.com/file/d/0B4cRJF ... sp=sharing (ran out of attachments for this post)

I used an Arduino Uno R3 and an LCD keypad shield as the core of the RPM detector. I ordered Chinese knockoffs so it was only about $10 for the pair. I connected the RPM sensor to the sensor interface board and then the data pin from the interface board to the Arduino data pin 2 which is also interrupt 0. There is a lot of example code available for using the LCD keypad as well as how to calculate RPM using an interrupt. I’ve attached a simple sample program. The LiquidCrystal library is required and is included in the Arduino IDE installation. I also wanted to do some simple formatting of the output to the LCD so I added printf support to my libraries. It’s easy to do and instructions are here: http://playground.arduino.cc/Main/Printf

A demo of the RPM detector working can be found here:
https://youtu.be/0mrSSKUFVT4
Attachments
rpm_demo_v02.txt
RPM detector sample code. Change the extension to .ino
(3.31 KiB) Downloaded 89 times

CastIrony
Posts: 650
Joined: Mon Jul 21, 2014 10:21 pm
Location: Portland, OR

Re: Simple RPM Detector

Post by CastIrony » Thu Apr 16, 2015 6:49 am

I was actually considering doing something like this when I was planning to get a Shapeoko 2 with a DC spindle. A simple, cheap board could intercept the PWM signal from Grbl, figure out what the target RPM was, read the current RPM with a sensor like yours, and use a PID loop to output the "correct" PWM to the motor speed controller. Then the Shapeoko 3 was announced, I got a 611 and a Super-PID and lost interest in the project.

I'm not sure how useful an RPM readout would be on its own, because the relationship between the speed you set on the knob and the RPMs you get out will change based on the material you're going through. Still better than not having any RPM information, I guess.

If you're interested, there are pictures of how I mounted my RPM sensor here.
Shapeoko 3 #192 - Complete! Needs limit switches.

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Simple RPM Detector

Post by cvoinescu » Thu Apr 16, 2015 9:57 am

I think the 1 pF capacitor is a typo.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

swhillier
Posts: 50
Joined: Mon Jan 12, 2015 3:47 pm

Re: Simple RPM Detector

Post by swhillier » Thu Apr 16, 2015 11:14 am

cvoinescu wrote:I think the 1 pF capacitor is a typo.
You could be right. I'm more of a software guy than a hardware guy. The original Grove sensor circuit I based mine on had the 1pF capacitor in the circuit. I couldn't figure out why it was there and it does seem to work with or without so I left it in.

swhillier
Posts: 50
Joined: Mon Jan 12, 2015 3:47 pm

Re: Simple RPM Detector

Post by swhillier » Thu Apr 16, 2015 11:33 am

CastIrony wrote: I'm not sure how useful an RPM readout would be on its own, because the relationship between the speed you set on the knob and the RPMs you get out will change based on the material you're going through. Still better than not having any RPM information, I guess.

If you're interested, there are pictures of how I mounted my RPM sensor here.
Thanks. I had only seen the version that required removing the power switch and drilling through to the spindle behind the switch.

I have tried putting some load on the spindle to see how well the electronic control in the 611 maintains the speed and its not bad. Of course I haven't cut anything yet so that may change things. At least with an RPM display you can see how much it is slowing down and retry at a higher speed if needed. Ultimately, if you want to use lower RPMs than 16K some sort of PID control is needed.

Since the SO3 will be my first CNC router I figured I'd stay with cheap and simple until I figure out how to use it properly and then maybe go for some sort of PID controller.

Schruminator
Posts: 259
Joined: Wed Oct 30, 2013 1:04 pm
Location: Littleton, CO
Contact:

Re: Simple RPM Detector

Post by Schruminator » Thu Apr 16, 2015 1:49 pm

If you want to compare your RPM numbers to see how they compare to other 611's out there, check out:
http://www.shapeoko.com/forum/viewtopic.php?f=8&t=3918

A live reading would be fun to watch though, just for seeing how much the RPM's vary as the router is running under load. I keep forgetting to measure mine during a job to see how it changes.
1.8m x 1.0m SO2 #3638 / Vectric Aspire / ACME Z-axis / View my photography at http://www.mschrum.com

veng1
Posts: 250
Joined: Fri Nov 30, 2012 12:09 pm

Re: Simple RPM Detector

Post by veng1 » Thu Apr 16, 2015 3:34 pm

cvoinescu wrote:I think the 1 pF capacitor is a typo.
I agree. It is there to provide a little filtering for the op-amp threshold. At 1pF it is rather useless but it could be 1nF or 1uF or whatever is in your junk box. But personally, I'd put, say 1.uF and I'd use a ceramic cap. I would not use an electrolytic. However, some bulk decoupling between VCC and GND might be a good idea.

But,as they say, if it ain't broke don't fix it.

Post Reply