PDA

View Full Version : Digital spindle speed readout



Oldgreybeard
28th April 2015, 05:16 PM
The following document was written as part of my studies in Microprocessor control systems. As it relates to a possible upgrade adding a digital speed display to my lathe, I thought it may be of interest to members of this forum.

If it is not appropriate would the moderators please delete it.

Bob

Digital spindle speed readout for woodturning lathe

]My Teknatool Nova 3000 was originally supplied with an 8 stage pulley setup giving spindle speeds of 178, 300, 570, 850, 1200, 1800,2400, and 3000 rpm (revolutions per minute). After a couple of years it was upgraded with an electronic variable speed controller and a 2hp 3 phase motor . Theoretically, the speed of the motor can be adjusted via a potentiometer between 0 and 1425. I say theoretically because the spindle does not stop when the potentiometer is set at “0”; it is probably closer to 5 rpm.(Haven’t measured it, just guessing).
It is possible to get a ‘rough’ approximation of the spindle speed if I assume that the potentiometer is actually varying the speed in a linear manner such that when set at “5” (the half way mark) the motor shaft speed is actually 50% of the maximum motor rpm or 1425 ÷2 = 712.5rpm. That can then be multiplied by the ratio of the 2 pulleys (1.210526315789 at maximum speed setting of 3000 rpm) to give a spindle speed of 1500 rpm. Or more simply multiply maximum speed of the pulleys selected by the percentage set by the potentiometer i.e. 3000 x 50% = 725. That is what I have been doing for the last 15 years.
The weak link in this method is that carbon potentiometer , and to a lesser extent wire wound potentiometers, is that they are notoriously inaccurate and get worse over time with continual use. The carbon tends to wear away unevenly and eventually there will no longer be a smooth linear variation in resistance as the knob is rotated so that a setting of “5” on the knob no longer equates to 50%. In fact, the potentiometer that I recently replaced had very little change between “0” and “3”, a consistent change as the knob was rotated from “3” to “7” and then very little change from “7” to “10”.
Since replacing the potentiometer, I have ben considering making a digital tachometer with an LCD readout .(1)
There are a number of ways to achieve this but essentially all that is required is to count the number of times that the spindle rotate through 3600 in a given time and then equate this to the number of revolutions that would happen if this rotation continued for 1 minute. For example, if there were 10 rotations counted in 10 seconds and the spindle continued to rotate for another 50 seconds at the same speed, there would be a total of 60 rotations (10 rotations for each of the 6 x 10 second periods).
In my considerations, I am concerned with 3 aspects –
1. Accuracy
2. Resolution
3. Responsiveness

1. Accuracy
The problem with the present analogue setup is that the accuracy is not able to be determined and varies over time.
It would be possible to derive a signal from the electronic controller which could be measured, but this applies to the motor shaft speed not the lathe spindle speed. Variations in the load can and do affect the spindle speed as does other factors such as belt slip.
345813Probably the most simplest method of obtaining a digital signal which corresponds to the spindle speed is to count the number of times that a magnet ‘mounted on the spindle’ passed a sensor which produces an electrical current whenever it comes in close contact with the magnet. This could be a mechanical sensor such as a reed switch which closes when in close contact with the magnet, but is otherwise open or it could be an electronic sensor such as a Hall Effect sensor . Image 1 illustrates the signal created at the output of the sensor. This is a digital signal which can be feed directly into the microcontroller and counted.
In terms of accuracy the concern with the mechanical switch is the effect of ‘contact bounce’.
Image 2 is an actual oscilloscope image of a switch bounce. It all happens in less that 250 micro seconds, but the processor is capable of counting each of these false spikes. In this case the count would be increased by 4 instead of 1.
It is possible to filter out these false spikes in hardware or software, but the problem is more easily overcome by the use of a Hall Effect sensor . The filtering takes p345814lace within the sensor so it does not require additional hardware or software.
Laser technology is another option which could be explored, but I am not considering it at this stage. I suspect it would be more expensive and not as easy to implement as the magnet / Hall Effect sensor solution.

2. Resolution
Resolution and responsiveness are closely related – changing one effects the other. If we want our readout to display the revolutions per minute with an accuracy of 1 then it would imply that we have to count every revolution for a period of 1 minute. If we use a shorter period for the count then we have to extrapolate the equivalent number of revolutions that would occur in one minute, e.g. if we count 2 revolutions in 30 seconds, we could multiply by 2 and say that the spindle speed was equivalent to 4 rpm. This would be pretty accurate in most cases as the speed is unlikely to fluctuate greatly. But what would the answer be if the spindle only rotated 3000 ? There would be no count as the magnet had not rotated past the sensor – the readout would be “0”. At slow speed the accuracy may not be a problem, but is having to wait 30 seconds for the readout to update acceptable?

Consider this scenario – switch on the lathe and set to potentiometer to the 50% mark. On the highest pulley ratio this should be 1500 rpm. You wait 30 seconds for the readout to update and it is in fact 1200 rpm. Twiddle the knob and wait another 30 seconds only to see that you overshot the mark and now have 1650rpm. Are you going to wait another 30 seconds to twiddle the knob again to see if you get closer to the 1500rpm? I think not.

We will discuss the response consideration in the next section, but let us look further at the effect on the resolution. The shorter we make the count time in order to improve the response time, the less precise our answer becomes. Say we reduce the count time to 1 second during which time we count 20 revolutions. To extrapolate the equivalent rpm we have to multiply by 60 (60 seconds in 1 minute) and we arrive at an RPM of 1200. If the count was 19 revolutions, we would have an equivalent RPM of 1140. There is no way that we could resolve the readout to any value between 1140 and 1200 using only 1 magnet.

Reducing the count time even further to get better response time makes the matter even worse. At 1/10th of a second (100 milliseconds) to extrapolate the equivalent RPM we have to multiply by 600 (10 times for each 1/10th of a second and 60 times for the number of seconds in a minute). At 3000rpm the spindle would only rotate through 3600 five times and rotating through 3600 four times would result in a readout of 2400 rpm. While the response time might be good, the resolution is not that much better than useless.
The solution is relatively simple – add more magnets so that we are able to count fractions of a revolution. Using the last example, if we increased the number of magnets to 10, our count would increase from 5 to 50 we still have to multiple the count by 600 (number of 1/10th second periods in a 1 minute) and if there was exactly 5 x 3600 rotations the answer would be the same, but there was 4 full rotations (count = 4 x 10 = 40) plus a further rotation of 2400 (10 x 240/360 = 6.67) our count would be equal to 46 divided by 10 and multiplied by 600 = 2760 rpm , as compared with 2400 rpm with only 1 magnet. You will notice that the additional count for the 2400 was 6 because the count time expired 2/3rds of the way between the 6th and 7th magnet.

There is a physical limitation as to how many magnets can be used. The size of the disc which must be attached to the spindle must have a circumference that is firstly limited by the physical space available on your lathe and also the need for a space between each pair of magnets to ensure an adequate on/off signal from the sensor.
Given a disc of 125mm diameter, it should be possible to have a ‘mounting diameter’ of 110mm for 30 x 3mm diameter magnets spaced at 120 and allow about 8.5 mm separation between the magnets.

3. Responsiveness.
In the previous section we saw that if we reduced the count time we could reduce the time that it took to display the spindle speed on the readout, but that it came at a cost. Decreasing the count time increased the coarseness of the result. So the question is, what is the optimum count time?

One factor is the time it takes to refresh the display and to update the RPM value. This will vary from manufacturer to manufacturer and to an extent is also affected by the choice of microcontroller chip. The display will need to be refreshed at regular intervals to ensure that there is a ‘steady’ display. Too long between refreshing will result in a jittering display.

Further we have to be aware of the time required to process the data from the sensor and output this to the display. This must happen during the count time. There is very little processing to be done, so this should not present a problem. If it becomes a problem, the solution is to refine the processing logic and / or use a more powerful processor.
In the previous section, we used a count time of 1/10th of a second. In reality I think ˝ of a second would probably be adequate. Coupled with using 30 magnets our resolution has markedly improved while still providing and acceptable response time.

Using 10 magnets and a count time of 1/10th second, the smallest increment is 1/10th of a revolution (360) of the spindle in 1/10th of a second = 1÷10×600 = 60 rpm.
Using 30 magnets and a count time of ˝ of a second, the smallest increment is 1/30th of a rotation (120) of the spindle in ˝ of a second = 1÷30×120 = 4 rpm.

Recommendation:

Sensor - 30 off 3mm∅ x 3mm rare earth magnets set on a radius of 110 mm at 120 centres.
Hall Effect sensor feeding an enhanced mid-range PIC microcontroller .
Display – 2 lines x 20 character LCD
Power supply – 5vDC


(1) I obtained my Diploma in Computer Electronics in 1980 and have been upgrading my skills with further studies in electrical engineering mathematics and microprocessor control systems using PIC microcontrollers

pommyphil
28th April 2015, 05:36 PM
Maybe I'm missing something..... but eBay have handheld digital rev counters for $20. :no: ? Phil

Oldgreybeard
28th April 2015, 05:56 PM
Maybe I'm missing something..... but eBay have handheld digital rev counters for $20. :no: ? Phil

That is true, but the purpose of this excercise was to design an embedded component not a standard handheld component. This could be thought of as an addition to the EVS controller and in a different application would provide the input / feedback. As I mentioned the EVS speed controller only affects the motor shaft speed whereas this project is to take into account external factors, pulleys, belt slip, load requirements. etc.

Bob

yowie
28th April 2015, 10:37 PM
Just putting a digital shaft encoder on it might be easier...

Oldgreybeard
29th April 2015, 09:47 AM
Just putting a digital shaft encoder on it might be easier...
As I stated at the outset, this was written for a specific purpose as part of my studies. You are correct in saying there are other, perhaps better, alternatives, but that was not part of this exercise. The task was to use the components and techniques that we have been studying at this point. As the study progresses other components and techniques will be discussed and thier application and performance evaluated against previous experience.

Bob