Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

variable pulses with stepper motor

Status
Not open for further replies.

Salah Reda

New Member
**broken link removed**
I build my robotics where i used stepper motor as actuator and Matlab/Simulink with arduino as controller . my control signal output in (rad/sec) and i want to send this signal to stepper motor pulse pin . the situation that my control signal output are variant depend on the sensor output so i want help to build variable pulses program where the input are control signal (rad/sec) and the output are pulses .

you can see in the attachment image my simulink program that i deploy on the arduino
 
Simulation is relatively easy. Implementing those results in real life is not easy.

What do you have so far? Do you have code that can drive the stepper motor and read position sensor? You can't expect to translate your simulation to real life with a single mouse click. You really have to work your way through all the small steps towards the solution. Simulation, testing in real life.. then comparing the results.. adjust your control algorithm.. then compare your simulation against real life tests etc. etc.

Matlab and simulink is a powerful tool, but you can't expect to create some simulation and then have a working real life system just by pushing a button.

Simulation is a cheap way to determine if a system is doable.. nothing more. It does not really solve your real life problems.

To really simulate your control algorithm, you already need to have a good understanding of the real life system you are simulating. You have to have a good model of your already working system. You have to understand the difference between a high performance PC doing simulations and an 8-bit arduino trying to do it for real. You could simulate a moon landing with matlab, but it does not mean you are going to the Moon in the near future. You can spend one weekend simulating.. but it takes ten years and millions of dollars to actually do it.
 
Last edited:
firstly , i want to implement my project . i already have Test-rig and make my mathematical model to get the plant transfer function to build my control which achieve the stability for my project.

Secondly, to understand what i do . i have USB camera which sense the object position on my workspace with my algorithm and camera calibration which i built , i get the object position in (mm) . then the actual object position compare with the desired position (which i want) then sent error position to the control (LQG) that achieved stability to the position , the control output are (rad/sec) .

i want to send the control output signal to the stepper motor through Arduino to move incline my workspace to move the object to the desired position . the situation that the control signal are variant depend on the object position so the stepper motor pulses are variable depend on control signal .

Finally , i understand that there are big difference between simulation and real life but also i think also you know that Matlab/Simulink are used in many projects to implement it in real life.
 
Ok.. so you have your system set up and the arduino is only there to do what it is told to do.. a slave which reads sensors, controls the motor and relays data to matlab and back to the arduino. The matlab program is doing all the intelligent stuff. Is that it? You should be able to transfer data between matlab and arduino through serial uart. That would be the easiest thing to do.

I know that matlab can generate code etc. that can be deployed directly to the real life system. But it takes a lot of work to get to that point where you have that luxury.
 
Last edited:
There is a saying that "image is worth thousand words". And the image in your original post is not working. Try to post that again..
 
**broken link removed** **broken link removed**
imageprocessing.jpg
imageprocessing.jpg
imageprocessing.jpg


As shown in imageprocessing picture , it's program which detect actual object position and compare it desired position , then send the error to the arduino through packet-output (USB) . the imageprocessing program are run when implement the Test

The second picture is the porgram which are deployed on the arduino . in this program the arduino received the Error value and send it to the controller block which are the output signal in (rad/sec) .
the next stage about sent the output signal to the stepper motor pulses pin through variable pulses block which contain some algorithm to convert control output signal (rad/sec) to pulses/sec .

the algorithm which i built to convert control signal (rad/sec) to pulses/sec dosen't work correctly with variable signals that came from controller . any suggestion to solve this problem?
 

Attachments

  • Simulink-Arduino.jpg
    Simulink-Arduino.jpg
    86.2 KB · Views: 264
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top