DesignSpark Electrical Logolinkedin
  • Brought to you by
  • RS Components
  • Allied Electronics

November 12, 2015 17:44


Simple Motor Control

Hey Everyone,

Thought I would share with you my very simple motor control design.  It can control the speed of a small toy 12V DC motor or it can be used to simply turn on and off the motor.

Here is video showing it working!



Silicon Labs EFM8 Sleepy Bee starter kit

12V DC motor

motorcycle battery

500ohm potientiometer


Below is the circuit.  The MOSFET acts as a switch that either lets the current flow or not depending on the input from the MCU.  I am using a pulse width modulation or PWM to control the MOSFET.  From this I can get a rough speed control by altering the duty cycle of the PWM.  Alternatively, I can toggle a GPIO to just turn the motor on or off, full speed or stopped.  



The code is very simple and just adjusts the overflow of the Programmable Counter Array(PCA) to control the switching period of the PWM.  The PCA0CPH0 is the register that controls this overflow.  Either increase or decrease it to change the duty cycle when a button is checked.  You also have to be sure to check if you are at the max of 100% or min of 0%.


Let me know if you have any questions or suggestions.  My next step is to add a transceiver I have to the board and make this a wireless motor control project!

TxBeech has not written a bio yet…

November 12, 2015 17:44