Hacker News new | ask | show | jobs
by tdeck 48 days ago
This is a super cool project.

In general I would not recommend driving a motor (even a small one) directly with a microcontroller GPIO pin. Those pins aren't designed to sink much current and you'll at best get a very weak response, because although the MCU is 3V that's only going to be maintained with negligible load on the pin. At worst flyback may destroy your microcontroller because the motor is an inductor and will cause a reverse voltage spike when turned off.

A slightly more robust approach that costs just a few pennies more is to use a BJT (i.e. an NPN transistor) to drive the motor and add a flyback diode (a reverse biased diode across the motor's windings) and a little .1uf capacitor.

You could also use a FET to drive it. Just be aware most common ones don't fully turn on at 3V gate voltage and will still present a significant resistance in the circuit which is why I would probably use a BJT.

1 comments

I completely agree. if you're going to produce these, do real power management, . However, if you're doing this as one off experiment, driving one tiny eccentric motor at a time for short pulses via a XIAO (ESP32) or RP2040/2350 was fine (we had over a year of use without an issue). YMMV.
I actually built a wearable that used these motors a long time ago, which is why I was particularly interested. What i found is that connecting the 3.3V rail directly to the motor gave a much easier-to-feel vibration than the GPIO pin, which is what caused me to learn about their really low current limits. However the current sunk also varies by microcontroller.