Page 1 sur 1

Steppers start rotating after homing when DMX signal not available

Posté : jeu. 19 janv. 2023 12:25
par Micropuller
When I power on the Arspchuino32, the steppermotors start homing.
This is done in the setup, so the DMX signal isn't been read yet.
When the setup is finished and the board reads the DMX signal, the motors will travel to the position which is read (usually zero).
But when there is no DMX signal available, the motors also start rotating. They will only stop when the DMX signal becomes available.

Could it be that the motors are still seeing

Code : Tout sélectionner

m_stepper[i].refresh(255, 50);
So maybe after the while loop

Code : Tout sélectionner

while (digitalRead(zeroSwitch[i]))//as long as the limit switch is not pressed ((! zeroSwitch) reverses the behavior) 
            {
                m_stepper[i].continuous();//turn !  
                delayMicroseconds(10);              
            }
The position and speed of the motors should be set to zero?

Re: Steppers start rotating after homing when DMX signal not available

Posté : jeu. 19 janv. 2023 19:19
par Jacques
uhuh!
Maybe you can add

Code : Tout sélectionner

m_stepper[0].refresh(255, 0);
after the while loop

Re: Steppers start rotating after homing when DMX signal not available

Posté : jeu. 19 janv. 2023 19:54
par Micropuller
I tried that, but when I do and I switch on the DMX signal after the motors have homed (first channel = position = @zero, second channel = speed = @max speed), this happens:
- the motor with the A4988 doesn't move.
- the motor with the external stepperdriver does half a rotation forward.
- after that, I can ontrol the motor with the external drive, but only at low speed (the motor with the A4988 doesn't react to changes in the signal).
- only after I have moved the speed sliders (eg: a new speed value has been read), I can control both motors at normal speed.

Re: Steppers start rotating after homing when DMX signal not available

Posté : jeu. 19 janv. 2023 21:46
par Jacques
It's strange, normally there is a refresh each time a DMX frame is received.
Do you use DMX or artnet?
The strangest thing is that the two drivers do not have the same behavior...

Re: Steppers start rotating after homing when DMX signal not available

Posté : jeu. 19 janv. 2023 21:50
par Jacques
Try :

Code : Tout sélectionner

m_stepper[i].refresh(0, 0);
This is the default value in the standard code (without homing)

Re: Steppers start rotating after homing when DMX signal not available

Posté : ven. 20 janv. 2023 12:15
par Micropuller
I already tried that (sorry, I forgot to mention it), but I get the same result.
Maybe I I put it in the wrong place?

Code : Tout sélectionner

Serial.println("Homing ...");

    uint8_t zeroSwitch[4]{Arp8,Arp9,Arp10,Arp11};

    for (int i=0; i < 4; ++i) 
    {           
	pinMode(zeroSwitch[i], INPUT_PULLUP);
        m_stepper[i].refresh(255, 50);//we define a direction of rotation (255, to go in the other direction : 0), and a speed (here 30 for a slow speed) 
        if (m_stp_active[i]==true && m_action[i]==0) //m_action[i]==0 mean perform mode
        {
            while (digitalRead(zeroSwitch[i]))//as long as the limit switch is not pressed ((! zeroSwitch) reverses the behavior) 
            {
                m_stepper[i].continuous();//turn !  
                delayMicroseconds(15);              
            }                
            m_stepper[i].refresh(0, 0);             
        }
    }    
    Serial.println("end of homing!");