MSP430 & Servo Motor

by drselim in Circuits > Microcontrollers

3382 Views, 1 Favorites, 0 Comments

MSP430 & Servo Motor

MSP430 & Servo Motor

Hi, in this instructable, we'll see how to use a servo motor (SG90 in our example) with the MSP430G2ET launchpad. We'll be using Code Composer Studio for programming in C.

Supplies

MSP430 Launchpad, usb cable, Code Composer Studio, SG90 Servo Motor, Jumper cables, a 10 K potentiometer (optional for the second phase of the experiment), a breadboard (optional for the second phase of the experiment)

Circuit Setup - 1

msp430_servo_1.png

In this first setup, we're going to connect:

Vcc of the Servo (RED Cable) --> 5V on the MSP430 Launchpad

GND of the Servo (BROWN Cable) --> GND on the MSP430 Launchpad

PWM of the servo (ORANGE Cable) --> P1.6 on the MSP430 Launchpad

By using the following code, you can rotate the servo 180 degrees:

https://github.com/selimg76/microcontroller/blob/m...

By using the following code, you can rotate the servo in a smoother way (with a for loop)

https://github.com/selimg76/microcontroller/blob/m...

Circuit Setup - 2 (Adding Potentiometer)

msp430_servo_2_updated.png

In this setup, you have to make these additional connections:

Potentiometer VCC --> 3.3 V on the Launchpad

Potentiometer GND --> GND on the Launchpad

Potentiometer Output --> P1.3 on the Launchpad

By using the code below, you can rotate the servo by rotating the knob of the potentiometer.

https://github.com/selimg76/microcontroller/blob/m...

If you like the content please subscribe to my YouTube channel for similar tutorials and projects:

https://www.youtube.com/c/drselim

Thank you for your time and see you in another instructable.