Borrar filtros
Borrar filtros

Genuino Uno and servo issue on Macbook Pro

1 visualización (últimos 30 días)
Niccolò de Cesare
Niccolò de Cesare el 7 de Jul. de 2016
Respondida: Niccolò de Cesare el 8 de Jul. de 2016
Hi everybody,
i've a problem with Genuino Uno on a MacBook Pro Retina 15, i've to control a Servo Motor (Savox SC-1268SG) and after i have created an object Arduino, with the following code:
a = arduino('/dev/tty.usbmodem1421','Uno', 'Libraries', 'Servo')
i create the servo object with:
s = servo(a, 'D3', 'MinPulseDuration', 1000*10^-6, 'MaxPulseDuration', 2000*10^-6)
on digital pin 3 (PWM).
Theoretically with the command:
writePosition(s, 1)
the servo should move on the MaxPulseDuration that correspond to 100° instead MATLAB returns this message:
"The host and client connection is lost. Make sure the board is plugged in and recreate arduino and related objects."
conversely if i move the servo with pitch 0.01 from the initial position: 0.5, 0.51, 0.52, etc. with the command line, servo moves; instead if i use a for cycle:
for i=0.5:0.01:1
writePosition(s, i);
end
MATLAB returns the same error message above. Instead if i add pause(5e-5) after writePosition(s,i) seems to work.
I don't understand this issue.
Anyone know why happens? Probably issue is MacBook correlated?
Thank you in advance

Respuesta aceptada

Niccolò de Cesare
Niccolò de Cesare el 8 de Jul. de 2016
The problem was related to insufficient power supply from Arduino through the 5V pin, high voltage servo Savox needs much more current compared to current that Arduino can provide if is connected on PC USB. I've connected an external power supply setted on 7.5 V (maximum current 1000mA) using Arduino's Jack and all works well.

Más respuestas (0)

Categorías

Más información sobre MATLAB Support Package for Arduino Hardware en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by