Steppers start rotating after homing when DMX signal not available

Toutes les questions sur les cartes By arpschuino
Questions about arpschuino boards
Répondre
Micropuller
Messages : 47
Enregistré le : dim. 1 janv. 2023 15:55

Steppers start rotating after homing when DMX signal not available

Message 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?
Jacques
Messages : 278
Enregistré le : dim. 31 oct. 2021 19:37

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

Message par Jacques »

uhuh!
Maybe you can add

Code : Tout sélectionner

m_stepper[0].refresh(255, 0);
after the while loop
Micropuller
Messages : 47
Enregistré le : dim. 1 janv. 2023 15:55

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

Message 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.
Modifié en dernier par Micropuller le jeu. 19 janv. 2023 21:54, modifié 1 fois.
Jacques
Messages : 278
Enregistré le : dim. 31 oct. 2021 19:37

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

Message 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...
Jacques
Messages : 278
Enregistré le : dim. 31 oct. 2021 19:37

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

Message par Jacques »

Try :

Code : Tout sélectionner

m_stepper[i].refresh(0, 0);
This is the default value in the standard code (without homing)
Micropuller
Messages : 47
Enregistré le : dim. 1 janv. 2023 15:55

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

Message 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!");
Répondre