File Exchange

image thumbnail

Servo motors controller

version 1.0 (9.88 KB) by

A GUI to control six servo motors.

12 Downloads

Updated

View License

It's a servo controller for six servo motors. It can be used to control a antropomorphic arm with six motors. For a correct execution, it must select the motors following this table:
#servo - char to use for the motor selection
1 a
2 b
3 c
4 d
5 e
6 f
The microcontroller must use the same char. It uses a serial communication via RS232 protocol.

Comments and Ratings (12)

Hi! The problem is, how to move the servo according to the byte sent? I mean, how to setup the PWM vs MCU clock and make a source code in order to obtain a servo movement same as the slide bar value (1 degree precision). Anyone could help me please?

pooja sheth

nice work

Hindash Asad

Hi Andrea,
Thank you for the great effort. I tried your matlab code and the simple fix for the Arduino from last comments and still having problems.
Your Additional support would be most appreciated. Keeping in mind I'm using the Arduino UNO board / USB serial port. Could that be the problem? Do you have code for the USB port? Thank you

Andrea Cirillo

Andrea Cirillo (view profile)

Hi Harris,
I think that a simple Arduino solution like the following one should be work fine! Let me know if you need for further help.

int incomingByte = 0; // for incoming serial data
char selectedMotor;

void setup() {
Serial.begin(115200);
}

void loop() {
if (Serial.available() > 0) {
// read the incoming byte:
selectedMotor = Serial.read();
incomingByte = Serial.read();

if (selectedMotor == 'a') {
// active first motor
}
else if (selectedMotor == 'b') {
// active second motor
}
/* And so on... */
}
}

Harris Ko

The gui is similar to what i would like to use. The problem i have is what code to write for the arduino. Could you please post a sample of code for the arduino?( i am new to arduino and matlab interaction)

Carlos Moran

gracias por esta ayuda es de mucha utilidad

animati

Thanks, for this good serial port code.

Andrea Cirillo

Andrea Cirillo (view profile)

Yes. It is a very simple algorithm.

Paulo

Paulo (view profile)

is it like this:

PIC microcontroller:
if motorSelection == a
then activate motor1
else if motorSelection == b
then activate motor2
.............................................................................
else if motorSelection == f
then activate motor6?

thanks!

Andrea Cirillo

Andrea Cirillo (view profile)

The software needs a simple circuit microcontroller based.

Paulo

Paulo (view profile)

how will this work? SERVO to PC? no need for microcontroller?

Bhuvan

Bhuvan (view profile)

cheers

MATLAB Release
MATLAB 7.11 (R2010b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video