Anyone know how to make a spindle speed display

Hi All
One thing I would like to do is to be able to see what rpm my spindle is running at via an LCD display as I will have a spindle speed controller attached in line.

I imagine it should be possible, but I am a CNC and Arduino noob so any advice or links to plans would be helpful.


Looks like someone has done it…

If you use a VFD spindle, the VFD will display the speed on the control panel.

The Super-PID controller for speed controlling routers has a display. The way it knows the speed is by monitoring an optical sensor that detects a spot of white paint on your spindle’s collet/rotating shaft. The idea is that it counts the number of times it sees the white paint and divides it by how long it’s been counting. So maybe it counts the number of rotations in 2 seconds and then divides that number by 2, that’s rotations per second. Then it multiplies that number by 60 to get RPM; though it’d be faster to calculate RPM by multiplying the counts in 2 seconds by 30, or multiply counts in 1 second by 60, etc. You’ll have to play with those numbers yourself to get a readout that’s as accurate/smooth/responsive as you’d like. Though, in theory, the speed would be fairly consistent so those changes might not make much of a difference. The biggest hurdle is figuring out how to monitor the rotations of your spindle. An optical sensor is probably a good bet. What speed controller are you using?

Check this out:

Thanks Erik, will look into this.

Thanks Nathan

Interesting option, but not really what I was after as I would like a continuous readout.

The tachometer will give you actual speed. I figure I would mention some methods for getting commanded speed. .You could grab the M3 or M4 values from G-Code. If grbl or tinyg are using PWM you could externally display a scaled value of the PWM ( You could get it internally by changing the grbl source code but then you would need to apply a patch every time it changes.

You’ll probably want a handheld as well for comparison purposes while you build your mounted unit. You can also “hack that tach.” Pop it open short the measurement pad to keep it on. Locate the photodiode and feed the positive lead to an Arduino (or other microcontroller) analog input pin. Use PulseIn to measure pulses. The tach and the Arduino should share a ground connection. The trick is to permanentely mount the two LEDs to your machine (one bounces light off your spindle collet and the other receives the light) reliably.

Send your pulsein readings to your serial monitor every 10ms and note the difference between the reflection off your collet v. the reflections off a black mark (or any other color mark) you put on your collet. Every black mark represents an RPM. Once you know what constitutes a pulse, the math is easy. Then there are libraries for using LCD’s and even shields that make it even easier. Even though a the timing crystal inside the Arduino prevents it from keeping actual, accurate time, the number of milliseconds that construes an actual second (usually around 1,000) will be close enough.

The Arduino environment is so darn addicting… once you start experimenting it can get crazy.

[EDIT] Just watched the video above - making my post redundant. It looks like he is using ONLY the photodiode and not reflecting an incremental light source. Probably works just as well but you would probably get better pulse resolution with a white LED reflecting off the collet to enhance the contrast between his collet and his white mark.

Yes that is the other option too, it’s just that I will have a spindle speed controller so it seems a shame not to take advantage of it.

1 Like

Thanks Earwigger I will have a good look at this.

Just to be clear - the advantage of the SuperPID is that it reads the RPMs and adjusts the power to the motor to achieve your desired spindle speed. Everything else mentioned here simply tells you the speed of your spindle. So, for instance, you adjust your speed according to your homemade Arduino tachometer, then once is starts cutting and the bit is under load, the spindle speed will decrease substantially.

The SuperPID adjusts the power to the motor to account for the load so your spindle speed remains consistent - even under load. It is an ACTIVE speed controller. Whereas the stock software with the x-carve proportionally applies power to the spindle but there is no feedback mechanism - so your actual spindle speed is anyone’s guess.

So, you really do not have a spindle speed controller without a feedback mechanism.

Interestingly, the longer you CNC, the less important this feature becomes because you will start to “hear and feel” a sweet spot for a given bit in a given job on a given machine and you will want precise manual control.

(unless you are using commercial CNC machines which have incredible torque and active spindle speed mechanisms coupled with variable frequency drives).

Reading through this forum, there is a strong tendency toward using software to determine feeds, speeds and spindle rpms. You will break a lot of bits this way. This machine and firmware is just not capable of this level of control. Every machine is different, every bit and the material you are cutting is different.

Just my honest opinion. I have been building home made CNC machines for only ten years but each modification brings a new set of capabilities and variables. That is the most gratifying element of this time and money consuming hobby! Have fun.

Thanks Earwigger. You make some great points. I agree I look forward to using my experience in the future with this hobby.

@MaurizioCostabile - I built a homemade Arduino-based tachometer that will soon permanently mount to my machine. I was able to find a cheap Arduino clone, I nice IR LED/REceiver combo (10 pack), and a tiny, inexpensive OLED display. $12 for the Uno; $2 for the sensor; $10 for a cool readout. I wrote the code yesterday and tested it. Works great. Will mount this weekend. Let me know if you want the details, schematic or code.

Yeah, please send details, code, photos, etc.

Will do, once I get it mounted. For now, you’ll need the following:

  1. Arduino clone (cheap ones work great):

  2. A Display. I chose a more modern looking OLED display - plus it was priced right and only requires four connection points. Whatever you choose, makes sure there is a library to support it. The reviews on Amazon should tell you all you need to know.

  3. A Sensor - I chose the TCRT5000 because it is widely used in robotics and is dirt cheap (I bought the 10 pack for other projects):

  4. A 100ohm resistor and a 10kohm resistor.

  5. A case - X-Carvers should really make their own case. I bought this one because it is sealed, can be cut easily and provides plenty of room inside for sloppy wiring (you won’t need a battery):

Here is the pinout for the sensor. IGNORE THE ARDUINO CONNECTION. The taper of the sensor provides orientation:

Connect the tiny monitor: Vin to 3.3v on arduino. GND to GND. SDA to A4. SCL to A5. On revision 3 Arduinos, the SDA and SCL pins could be the two unmarked pins above AREF on your Arduino (not on mine).

Connect the sensor: + to 5v pin, - to GND, The IR receiver pin before the resistor connect to D2 (because we are using interrupts).

That’s it! On your Arduino you need to install the appropriate libraries as indicated in the code below. Googling should turn them up. I soldered my sensor to a tiny piece of circuit board so it is facing sideways. This will be screwed to the bottom of my router. Will send pics later.

Here is the code. It could be cleaned up a bit but I added notes for you so you can mess with your screen (if you do not have the Arduino IDE installed you can open this in Notepad to read it):

1 Like

Thanks Earwigger…I’ll try this!

I’m already working on v 3.0. Above starts choking above 12,000 rpms. I have a new library that uses some clock frequency trickery and some fuzzy logic to make much more stable and higher frequency measurements. It works - but not ready for prime time… for instance, I can’t get it to read zero yet.