Input Devices - Controlling my DC motor speed with a variable potentiometer

This week was a nice break from the previous one. I added a potentiometer (pot) to my Brushless DC motor circuit from Week 09 so I can adjust the speed on the fly.

image image

The pot has three inputs (Vcc, Gnd, and Signal). I had previously wired up my circuit diagram in Eagle to accomodate the pot in anticipation for this week.

<image> <image>

I first tested the functionality of the pot to see if I can use the analog input (range 0-1023) to change the blink speed of my onboard LED. Motor was Pin 0, Pot was Pin 1, and LED was Pin 3 of ATTiny84.

image image

Next I wrote code for the motor to change speeds whenever I hit different analog thresholds of the potentiometer (0-255 => speed 01, 256-511 => speed 02, 512-767 => speed 03, 768-1023 => speed 04).

<image>

Here are the pictures of motors changing speed! Notice the current change on the power supply. It goes from 0.512A at 16V to 0.558A at 16V when I change the potentiometer).

<image> <image> <image>

Special thanks and credit to Tomas for letting me borrow some Pot!