Now that I’ve been successfully using this actuator and wanting to take it further, I hate that I’m running blind on lost steps. If we could control the power to the stepper motor, meaning decrease it to a very weak power, and watch when it loses steps, we’d have edge detection on objects. This would let you push the arm up against stuff, wait until a lost step, and then know you’re touching it.
The challenge has been how to some kind of encoder. There’s magnetic ones, but they all seem to only apply to the shaft. I think we need to measure the reduced output instead. I’ve explored how calipers do it and think that’s a possibility still, but perhaps a 3D printed optical encoder does it?
Here’s a new design I’m trying. I don’t know if it will work. I added 92 slots around the top of the actuator.
The bottom of the actuator has a new slot to receive the top slots. There’s room for two 0805 SMD LED’s. One generates light, while the other receives the light. The receiver LED should generate enough voltage to be detected by the ESP32 when the slot is pass-through, and a lower voltage when the solid plastic is blocking the light path.
Bottom of actuator with slot
I went with 92 slots based on this math. The stepper motor has a 7.5 degree angle, thus 48 steps per rotation. The planetary gear is a 38.4:1 reduction, so 48 * 38.4 = 1843.2 steps for full rotation. Divide by 20 = 92.16. So, each optical high/low represents 20 full steps. I’m running these actuators at 4 microsteps, so 80 microsteps = 1 optical high/low. That means I’d have to lose 20 full steps (or 80 microsteps) before I can really detect slippage, but I think that’s workable.
With the 0.16 shift each rotation I also end up with an error shift the more full rotations that occur, but in practice, I presume I won’t be rotating more than 360 degrees on an ongoing basis, so that error may not matter in practice.
Here’s the mini PCB with the LED. I may not need the resistor if I run this using the LEDC hardware on ESP32 where you get to control the brightness of the LED via freq/duty. For the input LED I’ll try to feed into the pulse counter hardware on ESP32 so I have barely any load on the CPU.
The PCB’s slide into the bottom of the bottom like in this shot.
Doing the 3D prints today and the mini PCB’s. Let’s see how it goes.