Controlling multiple servos (4-8) via Matlab

Hey!

I first want to apologize for any stupid questions, misunderstandings or errors, this is my very first post on this forum, and hope you can help me out!

I was planning on using Matlab to control motors on an Arduino, as the programming part is an OCR algorithm and very simple to implement in Matlab. I want to use the matlab result to control the motors using this approach: Matlab arduino control tutorial

My project requires me to push buttons on an external device depending on the result of the OCR. My project also required between 4 and 8 motors to be controlled (not sure on the exact number yet, just wanting to check out feasibility), and it seems the ada motor shield only lets me control 2 of them... Did I miss something there? Is there a way to control more than 2 servos using matlab?

I just want to point out that I do not own any Arduino hardware, just checking if it's doable before buying it.

Thanks for the help!! :slight_smile:

Of course there is a way to control more motors, buy more shields. The adafruit site says that the shields are stackable and the addressing system allows you to control up to 64 stepper motors. The problem becomes addressing all those motors, I don't think that's covered in the tutorial.

also check this out Embedded Coder Target for Arduino - File Exchange - MATLAB Central

Your title says "servos". You don't need any form of shield to control servos with an Arduino and an Uno can control 12 servos IIRC. You DO need power supply for the servos so they are not drawing power through the Arduino.

If you really mean that you want to control DC motors, or stepper motors, you need to tell us.

...R

Henradrie:
Of course there is a way to control more motors, buy more shields. The adafruit site says that the shields are stackable and the addressing system allows you to control up to 64 stepper motors. The problem becomes addressing all those motors, I don't think that's covered in the tutorial.

also check this out Embedded Coder Target for Arduino - File Exchange - MATLAB Central

Thanks, will check that out :slight_smile:

Robin2:
Your title says "servos". You don't need any form of shield to control servos with an Arduino and an Uno can control 12 servos IIRC. You DO need power supply for the servos so they are not drawing power through the Arduino.

If you really mean that you want to control DC motors, or stepper motors, you need to tell us.

...R

Thanks for the answer :slight_smile: I had indeed read that the uno can control 12 servos, but from what I understood from the matlab tutorial I linked, I need to have a shield to be able to control via matlab... If I've understood correctly?

I am too lazy to watch a video tutorial on a slow internet connection.

I can’t think of any reason why you need a shield to control servos with Matlab. I am not familiar with Matlab but I believe it just sends serial data to an Arduino. There is no reason for Matlab to know anything about the Arduino hardware or, indeed, for the Arduino to know that the instructions are coming from Matlab.

The examples in Serial Input Basics may be of interest.

You could get Matlab to send something like <70, 125, 20, 170> representing the angles that 4 servos should move to. If there are always 4 values in the same order the Arduino will know which servo each one is for.

…R

Basically they're overwriting the Arduino Due with their own custom firmware. This is similar to the LINX firmware except this custom firmware works with Matlab versus LabVIEW.

Summation: go talk to Mathworks. Nothing here to help.

Thanks guys! Had a look on matworks, and from what I gather, I can control the servos without the shield! :slight_smile: