I have a gear box that can be manually shifted by turning an axle CW or CCW by around 20 degrees for each gear. The shifting axle can be turned around 300 degrees from the minimum to the maximum gear. This means that any device capable of a single full-turn of 360 degrees is sufficient for the following task. The force that's required to switch between gears is guesstimated at around 0.5Nm.
The axle has mechanical engagement points at the correct turns, meaning that the axle will stay at the correct position once a gear has been properly engaged,
Regarding the speed of switching or turning the axle, I have no requirements besides that it should happen in a reasonable time, i.e. 1-2 seconds, to get from the lowest to the highest gear and vice versa.
I want to turn the axle by means of a DC motor. I have only limited voltage and current available, 5V and 500mA. Also, I'm quite constrained in regards to the available space: there's only around 4x5x2cm for the motor, encoder and gear.
Additionally, I want the device to be stateless, meaning that the microcontroller should not store any state (e.g. "last gear" or "current gear"), but should query this information from a sensor that can discover the rotational position of the gear shifting axle.
So essentially there's:
constrained space (approx. 4x5x2cm)
constrained electrical power (5V, 500mA)
needs to be suitable for an outdoor environment, "rain water proof"
Also and unfortunately, the gear shifting axle is orthogonal to the 4x5cm area, meaning that I can not e.g. place a stepper or servo motor just on top of the axle.
I thought that for such a common task - knowing the rotational position of a rod and turning it by some degree - there'd be a cheap and reliable device that does just that.
But it turned out that there is apparently no such device.
Servo Motor:
Electronics already included; Voltage, PWM signal and you're ready to go
Quite bulky, difficult to use in constrained space
Affordable servo motors can not return the turning position of the axle to the microcontroller
Brushed DC Motor and some gear:
Cheap
Small variants available
Graphite dust
Gear required; I don't know what kind of gear I could use. Worm drive/worm gear?
Absolute Position not returned
Brushless DC Motor and some gear:
Low Maintenance, no graphite dust
difficult to obtain a small 5V BLDC motor
matching driver IC required
Gear required
Absolute Position not returned
Stepper Motor:
Low Maintenance, no graphite dust
Reasonably cheap
Stepper motor driver IC required/recommended but readily available
models I've found were either too weak (0.5Nm requirement) or too power hungry / inefficient, so I'd also need a gear
Absolute Position not returned
Do you know of any off-the-shelf solution? Like, a small, low-maintenance 5V motor and controller that can just efficiently drive to a fixed position by means of a PWM or I2C communication, within a turn's range?
You mention "rotating a precise degree" with a motor. I just do not see that happening especially less positional feedback. You do not want to use a servo motor which would normally be the first choice. Using a motor with a gearbox, a high ratio gearbox, you will need some form of positional feedback just to know where your shaft actually is verse where it started. You also need to consider backlash in your gearbox.
That's what I think is the best solution.
I wonder what kind of motor is appropriate. As the motor is only required for shifting the gears every now and then, the total runtime during the life of the motor will probably be within the range of a few dozen hours.
Do you think a micro-sized, brushed DC motor, driven by a H-bridge IC, will be sufficient? I have no idea how long the brushes last approximately.
Common solutions would be a servo or stepper motor.
A servo is an "angle motor". They rotate less than 360 degrees and they have a built-in driver circuit. In general, they have to be continuously "told" to hold a certain angle.
Servos are commonly used in RC cars and planes.
A standard stepper motor is 1.8 degrees per step (200 steps per revolution). They can be geared-down for more precision.
Like DC motors they need a driver circuit, and they need at least one "home" sensor so the software knows where you are starting from. Then the software can count the steps to go to a certain position and to keep track of where it is.
Steppers are commonly used in CNC milling machines.
I hope so. The "encoder" is what you call the sensor that's used to detect the gear.
As mentioned in my first post, gears are currently manually switched by turning a small axle by around 20 degrees per gear (rotary motion!).
I have only little more than 2cm in front of the axle, so if I was to use a servo or stepper motor, I'd have to rotate the torque by 90 degrees by means of a worm drive.
Think of a small box of cigarettes or a small smartphone. If you stick the tip of your index finger right into the back camera: the finger is the axle that has to be turned, and half a box of cigarettes is about the space I got for the device that needs to turn it.
Both common servos and stepper motors are either too large or too weak, when in micro format, to properly turn the axle.
Perhaps you are locked into something you are imagining is true. Is there some reason you want to DIRECTLY attach a motor to the shaft? Has the device ALWAYS been moved by hand? You can likely mount a gear on the shaft or mount a pulley and use a rubber belt to rotate the shaft.
Right now, if you walked up to the device, could you tell what gear position is was in?
I've drawn a schematic to better illustrate what I want to achieve.
The position of the axle can vary e.g. after maintenance work. Upon installation of the electronic gear switcher, a reference gear and angle will have to be set.
The rubber band is a great idea, but I'd still have to turn the motion of the motor by 90 degree, since most micro dc motors seem to be too long to fit sideways into the encasing.
So, you do not know, by looking, what gear is in play. Combine your gear and a position indicator by drilling a hole in the gear for each needed location. Use a sensor to indicate a hole and not a hole. A hole will let light through and tell your program a gear is properly engaged.