Hardware setup

A project log for Motor as Encoder

Inspired by the attempts of other people around the Interwebs, I use a motor as a rotary encoder, but with a different approach.

besenyeimbesenyeim 08/18/2018 at 11:260 Comments

A few days ago I received my first Arduino compatible boards. I'm not a fan of Arduino, but that's what many people like and almost everyone have. These are cheapo "Blue Pill" STM32 based boards. The first thing I did was to flash them with STM32duino.

Previously, I made a triple half bridge from SMD FETs. Thisis ugly and underpowered, but works. (Theoretically, amplification is not needed, if the microcontroller has high current pins.)

(Please ignore the DIP chip in the breadboard, not related, but I was lazy to take it out.)

6 digital outputs are used, because we need to drive the high and low side transistors separately, the phase which is not driven should be floating, hi-Z mode is necessary.

3 analog inputs are used as feedback. The phase voltages are measured with them.

Currently everything goes from 3.3V. The chip is powered from USB, but there is a separate power supply for the motor. The analog inputs can withstand 3.3V only. If the motor's supply is higher than that, voltage dividers are needed on the feedback lines to protect the MCU. If you want to use the encoder passively, 3.3 is enough, but for haptic feedback a higher voltage is probably needed.