For this project we used a dsPIC33FJ256GP710 microcontroller.  It was chosen because of itís high MIPS rate, and itís extremely fast A/D conversion. It also contains 8 dedicated PWM lines that can be integrated into the code with minimal overhead.

The A/D converter was set up to sample sixteen channels at 61250Khz per channel. This would allow us to read in all information about the sEMG signals we possible could.  Each time the channel was sampled, the value was stored in the a buffer for computational analysis.

Six of the eight PWM lines were used to control the servo motors.  The PWM lines on the dsPIC are set up in such a way that an A/D signal can be used to control the PWM lines in approximate 5 lines of ASM code.  This allows for rapid translation between the input controls and the output motion of the robotic arm. Essentially, a timer is set up to set up the rate of the PWM signal. We wished the servos to be updated at a rate of 20Hz and a timer was configured to do so.  Twenty times a second the PWM signal is restarted, and the duty cycle is determined by a value in the OC*RS register. This value is determined by the voltage seen at the dials.

The dsPIC also employes multiple UARTs, and in this case RS232 was used. The controller was setup to output itís status at all times, and receive input commands from external software if needed.

Figure 1. Pinout of main microcontroller unit. Gray Pins are 5V tolerant

Figure 2 : Schematic of analog control circuit.

Control Features

Initially we had decided that sEMG was the only means of controlling the robot that we would use.  As the semester progressed, we decided to create 2 other ways of controlling the robot arm:  dials and external software.  The use of analog dials was implemented first which helped to debug and configure the robot code.

Control Through External Dials

Dials were set up to control each joint of the robotic arm.  A potentiometer was placed between the power and ground pins, and the wiper was connected to input lines of the microcontroller. The input voltage level was converted in the A/D ISR and then outputted to the PWM system.

Control Through External Software

A simple program was designed in LabVIEW that allowed us to control the robot from a computer. An output string was sent to the dsPIC, buffered and parsed, and in turn controlled the joints of the robot arm.  Simultaneously, the dsPIC sent out status messages of the robot armís position, which could be viewed on the computer screen.

Figure 3 : Front Panel View of Servo Control GUI

Figure 4 : Front Panel View of Servo Control GUI

[Home] [Team] [Introduction] [Project] [Robotic Arm] [Microcontroller] [EMG] [Program] [Results] [Conclusion]