Implemented a single direction DC motor speed controller using a rotary encoder and a 128×64 OLED display for user feedback. The rotary encoder switch was used to turn on/off motor speed control. A CW rotation increased the motor speed by 10% while a CCW rotation decreased the motor speed by 10%. The OLED display provided feedback of the current motor speed/state using text and a progress bar.
A PWM signal was used to control a 2N2222 transistor. The transistor was used as a switch that allowed current flow (<800mA) through the motor when the base is high. A flyback diode was connected across the motor to eliminate back EMF.
The OLED display was attached to the I2C bus and programmed using the Adafruit GFX and SSD1306 libraries. The rotary encoder switch was connected to an interrupt pin on the Arduino Nano to toggle from OFF-ON or ON-OFF. Turning the motor speed controller OFF also set the motor speed back to 0%. While OFF the rotary encoder inputs are ignored.


