Redditor and indie game designer “Critters,” unhappy with the price of free-spinning optical encoders on the market, decided on a simple, but novel solution: use a DC motor as an encoder. As you might know, DC generates an electrical current, so the idea behind this project was to calibrate the voltage generated with how fast the motor is turning.
This makes sense on some level, but before seeing this I wouldn’t have thought that you could get any sort of accuracy out of this method. In the video below, a 3.3V motor is hooked up to a voltmeter, where positive voltage is generated when spun in one direction and negative voltage in the other. As Critters puts it, this method is “Accurate enough for some projects, but not enough for others.” Probably a good reminder not to over-engineer things, since most of us don’t have an unlimited supply of money!
After the voltmeter, the motor was hooked up to an Arduino to test out. This setup isn’t capable of reading negative voltages, but the solution to this was accomplished by using pull-up resistors to set the analog pin voltage to a nominal value. The motor would then add or subtract voltage from this.
To compliment this, Critters came up with a knob to allow for easier spinning. He notes that he’s not a professional, and though it’s probably safe with very small motors, if a larger one is used, a method for limiting the current should probably be examined so as not to cause any damage.
Seeing this, I’m reminded of how cool I thought the spinner — with its knurled metal outside and what seemed to be one or more ball bearings on this inside — on Arkanoid arcade games was growing up. Though video games have improved exponentially since the 80s, I still miss some of the custom controller schemes of that era!
[via Reddit]
ADVERTISEMENT