Matlab & Raspberry pi : Need to control a servo motor with output from matlab.

Thread Starter

Siv77

Joined Jul 17, 2021
13
I need to control the rotation of a servo motor with the output from matlab.
I need to have 4 output pins when 1 is high it should move in a particular direction.
Any one who knows how to control servo motor with matlab please respond.

Also can a servo motor run in both direction?
 

MrChips

Joined Oct 2, 2009
30,712
You can run a motor in either direction.
You cannot run a motor in both direction.

You can control output pins from MATLAB if you hang a device off your computer.
Since parallel ports are virtually extinct, the simplest way is to hang a device off a USB port.
An Arduino or rPi would do it.
 

Thread Starter

Siv77

Joined Jul 17, 2021
13
You can run a motor in either direction.
You cannot run a motor in both direction.

You can control output pins from MATLAB if you hang a device off your computer.
Since parallel ports are virtually extinct, the simplest way is to hang a device off a USB port.
An Arduino or rPi would do it.
I'm using rpi here i need to move it in either directions according to the output from matlab.
But i dont know the code for that. Can you please give me any codes related to that.
 

MrChips

Joined Oct 2, 2009
30,712
Code for what?
Code for rPi or code for MATLAB.

Can you plug the rPi into your computer?
Can you get MATLAB to communicate with rPi?
 

Thread Starter

Siv77

Joined Jul 17, 2021
13
Code for what?
Code for rPi or code for MATLAB.

Can you plug the rPi into your computer?
Can you get MATLAB to communicate with rPi?
I'm sending the matlab code to rpi. I need to control 2 motors.
I'm providing an image,here if hr is 1 need to run my motor in one direction and if hl is 1 it should run in the opposite direction.
Step angle can be 18 to 25 degrees
 

Attachments

MrChips

Joined Oct 2, 2009
30,712
So let's get this straight.

1) Do you want a stand alone rPi running MATLAB code?
2) Or you want a PC running MATLAB to communicate with an rPi running who knows what?

1) You can run Octave on an rPi to run MATLAB code.

2) You can use Simulink in MATLAB to generate code which runs on an rPi.
 

Thread Starter

Siv77

Joined Jul 17, 2021
13
So let's get this straight.

1) Do you want a stand alone rPi running MATLAB code?
2) Or you want a PC running MATLAB to communicate with an rPi running who knows what?

1) You can run Octave on an rPi to run MATLAB code.

2) You can use Simulink in MATLAB to generate code which runs on an rPi.
I want to implement my matlab script to rpi and i got it.
Thanks for responding.
 
Top