It was dumb to use a DC motor for this project. I should have just ponied up the resources for a high speed stepper. My plan was to attach a rotary encoder to the DC motor to accurately measure the number of rotations. This is not easy....
First, I tried using a fancy (and expensive) optical encoder to measure the rotary distance. But this sensor was overkill for my project. It kept on giving me bad values, I assume because I was spinning the encoder too fast. Or because I didn't know how to properly use it!
I switched to a Hall Effect setup because I thought integrating it would be easier. This was generously lent to me by my colleague Louis (thanks bro)!
The Hall Effect sensor came with a rotary disk with 5 magnets for measuring angular velocity. But again, I had an issue with pulses being skipped. I switched to making my own rotary disk with one magnet as I thought that would give more the arduino more time to transition states on the interrupt pin. BUT STILL PULSES ARE BEING SKIPPED!
Some strategies I'll try tomorrow for stopping this are getting rid of all Serial prints and delays in code.
- Get rid of all serial prints
- Only do analog/digital write once instead of looping it
- Get rid of all delays
- Switch from monitoring change on interrupt to rising
In the mean time, enjoy these videos of the actuator zipping around!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.