…
With a rotary encoder solution you would probably need some sort of display to tell you what speed you have set which adds to the complexity.
Maybe, though watching the motor reveals how fast it’s turning – set it by eye! The only difference between a pot and rotary converter is the code that reads the control; the pot decides speed based on an analogue voltage, the rotary encoder by counting pulses. After that the code that drives the stepper is identical, both set the pulse rate. If a speed display is needed, it’s the same for both solutions; it reports the pulse rate, not the knob position.
I would be concerned at your centre point = off solution. You will need a decent sized dead zone at off to ensure you can hit it when you need to (possibly in a hurry). I would also be concerned that if the pot gets dirt in it or a wire disconnects and it defaults to providing zero volts, you end up with the table going (left?) at max speed. Not a good idea with a milling machine!
Agreed. Pots are simple to understand when they are working but what the software must do when they fail needs thinking about. The programmer has to cover a host of edge cases, which is tricky. The root cause is pots are analogue, i.e. everything they output is meaningful and has to be managed. In contrast, rotary encoders are digital, only outputting meaningful values when moving, which reduces the number of edge cases, making them somewhat more likely to ‘fail-safe’.
I would suggest using a simple pot for speed and a separate On – Off – On toggle switch mounted horizontally so that the direction of the lever indicates the direction of motion.
No need with a rotary encoder, though a pair of right-left LEDs might be a nice touch. Many encoders come with a push-switch that could be pressed to reset ‘centre stop’.
I would also suggest writing some no-volt code into the Arduino so that the motor won’t run until the switch has been set to off for a second or so. You don’t want the table setting off when you put the power on if you have forgotten to set the switch to off – or it got knocked while the power was off.
Yes if a pot is used. Not needed with a rotary encoder, because these are ‘off’ until moved by the operator. No need for defences like detents, dead zones, delays, NVR and whatnot.
Can’t help wondering if the forum’s enthusiasm for potentiometers is because rotary encoders aren’t well known? Encoders aren’t hard to learn, plenty of Arduino encoder examples on the web. Once understood, rotary encoders are better than pots in many applications, so always worth consideration.
Basic programmer training emphasises the need for programs to reject duff input in a cruel world where almost anything is possible. Garbage In, Garbage Out! Therefore common to find most professional code is error management, elaborately protecting a relatively simple core function from bad input. As pots and encoders have different shortcomings, how much code is needed to manage them?
I recommend nevillet mocks-up both approaches; not much code needed. Lay a motor, controller, PSU, Arduino and IDE out on a table. Experiment with a pot, using jumper leads to create fault conditions, and write code to manage them! After doing the same with a rotary encoder, decide which is best. I’m confident the rotary code will be simpler, because the hardware has fewer and safer failure modes, but nevillet is free to decide for himself.
Quite an interesting problem with workable proposals ranging from an NE555 to a Bluetooth connected GRBL. They all have pros and cons! How to decide? Shine a bright light on all suggestions, asking “what could possibly go wrong” and “what do I have to do about malfunctions?” And if nevillet wants to learn Arduino and this is just a suitable starter project, then the 555 is useless. GRBL makes sense for other reasons, but I wouldn’t recommend it to a beginner learning to code – too complicated.
Dave