The first step in a robotics project is to get a motor spinning. Once you’ve done that you quickly learn that not all motors go the same speed, even if they are the same part number! There are always variations that relate to voltage, environment, and manufacturing changes. So, the second step is to figure out how fast it’s going! Turns out that’s not so easy, but the best way to get started is to add an encoder wheel and an optical or magnetic counter. As the motor turns, the attached encoder wheel spins, causing the counter to detect each passing spoke and that lets your microcontroller count and determine speed.
If you want to do one better, add a second counter, and now you can tell direction as well as speed! All this wiring is kind of a pain, so that’s why this motor is really nice! It has a magnetic wheel and two hall effect sensors already attached. Using this motor is a breeze, and it’s a nice strong motor as well
Provide 7V DC nominal to the brown and yellow wires – these connect to your motor driver, and can be PWM’d for speed adjustment and direction by using an H-bridge.
Connect the black wire to your microcontroller ground pin, and the red wire to 3-5VDC (we tried both, works fine). Then you can read the hall effect outputs on the white and green wires. We have an example sketch here for Arduino, it can be adapted to other languages – basically you just want to interrupt on one of the encoder pins, use count the time since the last interrupt, and multiply the count time by 12-counts-per-revolution and the 1:20 gear ratio.
We are angry, frustrated, and in pain because of the violence and murder of Black people by the police because of racism. We are in the fight AGAINST RACISM. George Floyd was murdered, his life stolen. The Adafruit teams have specific actions we’ve done, are doing, and will do together as a company and culture. We are asking the Adafruit community to get involved and share what you are doing. The Adafruit teams will not settle for a hash tag, a Tweet, or an icon change. We will work on real change, and that requires real action and real work together. That is what we will do each day, each month, each year – we will hold ourselves accountable and publish our collective efforts, partnerships, activism, donations, openly and publicly. Our blog and social media platforms will be utilized in actionable ways. Join us and the anti-racist efforts working to end police brutality, reform the criminal justice system, and dismantle the many other forms of systemic racism at work in this country, read more @ adafruit.com/blacklivesmatter
Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.