MSP430 Launchpad Project (code and schematics): DC Motor Controller using ADC and PWM

This project demonstrates the usage of the 10-bit ADC (Analog to Digital Converter), TimerA1 module/interrupt for PWM (Pulse-Width Modulation) control, the BCSCTL registers as well as the GPIO input/output (I/O) port interrupts of the M430G2553 chip, an L293D motor controller, a 10k potentiometer, 3 different Light-Dependent Resistors (202403, 202411, 202420 Photocells), an LM317L voltage regulator, 4 de-bounced push-buttons, 4 LEDs to control a 3V DC motor using PWM (pulse width modulation) generated from the analog input of the Pot and the LDRs.

The push buttons control which analog input is used by the microcontroller. The G2553 reads the analog voltage and converts the voltage to a digital value. The digital value is then converted to a PWM duty cycle and sent to the motor controller. The motor controller takes the PWM duty cycle and bumps up the voltage and current to be able to drive the motor. The Potentiometer manually controls the speed of the motor. The 3 LDRs control the speed of the motor by the amount of light each receives.

To verify the frequencies and duty cycles of the PWM I used a PicoScope 3203D MSO (a usb oscilloscope). I programmed the M430G2553 chip using C and code composer studio 6. The program includes the interrupt routines, basic clock system initialization, analog to digital converter initialization, and data transfer controller initialization.

I've migrated this project from the Launchpad to a breadboard, created the code, and laid out the hardware. I'm using the M430G2553 chip and an L293D motor controller. I added an LM317L adjustable voltage regulator to give the G2553 power on the breadboard via a 9V battery. I added a RESET button. If you have any questions let me know and I'll try and answer them as best I can :)

Link to code and schematics:
!!!!!!!!! You will need to modify the msp430g2553.h header file or the code itself (not very hard)!!!!!!!!!


Be the first to comment