This example project demonstrates how to control a servo and stepper motor with Vega Aries development board using CASP.

Target

Aries v2.0 development board is used in this project. However, any supported micro-controller board can be used.

Pre-Requisites

  • CASP software is installed on the host PC
  • Vega Aries BSP is installed.
  • The project files are located at CASP installed directory ‘CASP/support/examples/vega_aries_examples/hw_interface/03_servo_stepper’. These are also available for download at this link.

Connection Diagram

A variable voltage is applied to pin A0 pin of the target board through a variable resistor. A servo is connected to pin PWM0 and stepper motor driver pins are connected to the pins-GPIO12 to GPIO15 of the target board as shown in the circuit diagram. A model is created to control the servo angle and the stepper motor speed & direction by varying the voltage at pin A0. If the voltage is more than half, the stepper motor rotates in one direction else it rotates in opposite direction. Speed can be varied by varying amplitude of the voltage. Similarly, servo angle is varied by varying the input voltage. Please go through the individual block parameters used in the model along with their documentation for better understanding.

Model

Procedure

  • Connect the peripherals as shown in above connection diagram and connect the target board to the host PC.
  • Launch CASP and open the downloaded project.
  • Click ‘Setup Simulation’ to open a dialog box.
  • Select ‘Target Programmer’ to ‘Programmer0’ to upload the program to RAM or ‘Programmer1’ to upload the program to flash memory of the target board.
  • Set the ‘Target Programmer Port’ to which the board is connected.
  • Save and Close the dialog box.
  • Click Run button to build and program the board.

Related Links