ECE476's Motors Lab
By John Stang

INTRODUCTION
BACKGROUND
SETUP
HARDWARE
SOFTWARE
RESULTS
TROUBLE- SHOOTING
CONCLUSION
APPENDIX
MORE PICS

 

Background

 

This revolves around a few simple concepts: (1) how DC motors work, (2)Pulse Width Modulation (PWM) and how microcontrollers can use this to operate motors, and (3) how Hall Effect sensors work. The race car set used in this lab has cars which use DC motors, so this became the motor of choice. The basic idea about DC motors is that there is a pair of coils wrapped around an armature- one on each end- and on either side of the armature is two magnets of opposite polarities. A current is sent through the coils, which induces magnetic fields that are opposite of each other. The induced magnetic fields are then attracted by one magnet and repelled by the other. Once the armature starts to spin, the current is reversed so that different magnetic polarities are exerted. The current is reversed in the coils by the commutator which makes contact with the two stationary brushes that are connected to the power source. This will keep the motor turning in the same direction. Alternating the the polarities of the induced magnetic fields over and over at different rates will cause the motor to spin faster or slower.

 


This picture was found at www.howstuffworks.com

Given an understanding of how DC motors work, we need a way to control the speed of the motor. Connecting a motor directly to a power source would cause the motor to never shut off, so how could a microcontroller be able to control the current supplied to the motor. One thought would be to control how strong the current is and thus how strong with the induced magnetic field is which will slow down or speed up the spinning of the motor. Unfortunately there is no easy way for a microcontroller to control the level of current sent to the motor. In factg, the microcontroller's ports can only supply a few milliamps which is much less than what a motor needs. A microcontroller would be better used as part of a control circuit that will regulate the amount of current flow to a motor. This can done by having the microcontroller pulse this control circuit which will lower the average amount of current sent over a time period and emulating a lower level of current. This would adjust the speed of the motor. The microcontroller has this feature of PWM, which sets a pin in one of the ports high for a defined porttion of a preset time period. The preset time period and the "high time" are both set by the preogrammer and can be modified during the runtime of the program. The greater "high time", the higher level of current the motor will see and vice versa.

The last piece of the puzzle necessary for controlling a race car on the track is to find a way to inform the microcontroller of where the car is on the track. Hall effect sensors work nicely for this application. A Hall Effect sensor detects a magnetic field and outputs a value. Since the motor operates by producing an induced magnetic field, the sensor would be able to detect it.

 

Copyright December 2003
For problems or questions regarding this web contact jss67@cornell.edu.
Updated: 12-15-03