Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Raspistepper driver softmotion

mattiap
2022-01-31
2022-06-02
  • mattiap

    mattiap - 2022-01-31

    Hi everyone, I state that I am taking my first steps on everything that is electronic and programmable. I'm trying to move a stepper motor (nema17-200step / rev-1.5A) with a raspberry pi4 and a drv8825 driver. I followed this https://forge.codesys.com/drv/sm3raspistepper/home/Home/, and managed to spin the motor, I would like to ask you experts if there is any way I can use a home switch to reset the motor position. Following what is written in the link posted above, I read that softmotion has exclusive access to the GP I / O of the raspberry and I do not know how to connect my limit switch. Can anybody help me? Or tell me if there are other methods to reset the motor? Thanks in advance.

     
  • eschwellinger

    eschwellinger - 2022-02-05

    use smc_Moming fb from the SM3_DriveBasic.library. Connect the limit switches to this fb.

     

    Last edit: eschwellinger 2022-02-06
  • mattiap

    mattiap - 2022-02-26

    Thanks for the answer, also placed an image of the connections, I can't understand how to use SMC_homing, how can I define the switch input PIN?

     
  • eschwellinger

    eschwellinger - 2022-02-26

    A proposal would be to connect a a GPIO input to do the limit switch if the distance is not to long. It is 3.3V depends on your machine if this could work.

     

    Last edit: eschwellinger 2022-02-26
  • mattiap

    mattiap - 2022-02-28

    Thanks for the time you are dedicating to me.
    I connected the limit switch input to a GP i/o input of the Raspberry, what I can't do is define the pin in the SMC_homing fb, what I have to write to ensure that my PIN 4 is active and reads the limit switch?
    It might be trivial, but these are my first steps on codesys.

     
  • tobzi

    tobzi - 2022-03-02

    Hello eschwellinger!

    I kind of have the same issue. Running three stepper motors with help of Softmotion and Raspberry Pi 4.
    I want to use some additional outstanding GPIO's for limit switches and/or other DI/DO's. Seems like when I'm running softmotion, my whole
    GPIO bus is getting disabled (not sure if softmotion is causing this issue). The GPIO is marked with a red
    triangle in the Device Tree and have status "Bus is not running" and "GPIOs: Not Running"

    My question is: Is Softmotion blocking me to use the other outstanding GPIO's?
    Is it possible to add limitswitches (DI/DO's) while running softmotion?

    Note: I have connected one limitswitch to GPIO4 for testing and mapped the IO correctly (working when creating a blank program without softmotion).

    Se pictures attached.

    Hope you are able to help and clarify.. :-)

    Regards

     
  • mattiap

    mattiap - 2022-03-02

    Hello ,
    in fact that's what I want to do, but reading the guide of this link https://forge.codesys.com/drv/sm3raspistepper/home/Home/, it says that the GP i / o cannot be used together with softomotion, I don't know if there is an alternative way to connect other inputs / outputs besides the engines.

     
  • mattiap

    mattiap - 2022-06-02

    Hello everybody,πŸ˜€
    I am carrying out my project and continue in this discussion.
    I haven't been able to get a soft motion limit switch to work yet, but for now I can do without it.
    now I need help on controlling a DC motor through codesys, do you think if I connect a BTS7960 to a raspberry I can control it with softmotion?
    I put some photos to better understand (the motor is a 895 360w, so with a very high load).
    I trust in your precious help.πŸ™

     

Log in to post a comment.