Menu

Problem since updating - everything looks ok but the motor doesn't move

Adrian K-B
2024-06-02
2024-07-20
  • Adrian K-B

    Adrian K-B - 2024-06-02

    Hi, I've had a problem since updating to v334. My build previously worked fine (I guess there's a lesson there about "if it ain't broke..."

    The board is a DRV8825-HW203 (M-MT-F-BT configuration).
    Anyway, since updating the firmware everything looks okay when I connect to my focuser using the INDI driver, and it reports step changes, but the motor doesn't move. When updating I only touched the firmware, no hardware changes (except for unplugging to put on my desk, and I've checked all the cables are secure and the motor resistances are correct at 27 ohms per coil). I've updated all the modified libraries in my Arduino/libraries folder, and I've checked the settings in config.h are correct, but nothing makes a difference.

    I'm a bit baffled. Just after suggestions for any other things to check that I've got correct when doing the update.

     
    • brownrb

      brownrb - 2024-06-09

      I would look at the TimerOne library if I were you.

      Find it and delete it

      then replace it with the TimerOne library supplied in the Firmware.
      When you unzip the firmware, it creates a sub folder called Libraries_To_Install
      You will find the TimeOne library in that folder.

      Regards
      Robert

       
  • PyB

    PyB - 2024-06-02

    Hi Adrian,
    Did you check the coils are powered ?
    By default, the firmware set coil power to 0 (.ino, line 186 -> myfocuser.coilpower = 0;)
    Power can be enabled in INDI configuration
    Pierre-Yves

     
  • Adrian K-B

    Adrian K-B - 2024-06-02

    Thanks - yes, coil power is enabled in the INDI config. The oled display also says CPwr = 1 which I assume is coil power.

     
  • PyB

    PyB - 2024-06-02

    Ok, strange...
    One clue: CPwr = 1 if coil power enabled but that doesn't mean 12 V is applied to the DRV8825. Did you try to manually rotate the motor axis to judge if current is present in the coils ?

     
  • Adrian K-B

    Adrian K-B - 2024-06-02

    No - I can't really rotate it manually anyway, as I'm using the recommended stepper with a pretty hefty gearing ratio in the gearbox. But when you say judge if current is present in the coils, do you mean there should always be a voltage across the coils even when they aren't moving? I could check that with a voltmeter across the relevant pins on the DRV8825 board. (I don't have an oscilloscope, so it's harder for me to check voltages during movement as I assume the pulses are pretty short and won't show up properly on a voltmeter, but I could check DC voltages much more easily.)

     
  • PyB

    PyB - 2024-06-02

    Ok, in my case, the stepping motor is directly linked to the focuser axis via pulleys and belt so that I can make the test I proposed. Obviously, it is not possible with a geared motor.
    To answer your question : yes, on a stepping motor the coils are permanently energized. The moving of one step to the following results from current polarity commutations (and also intensity if using micro-stepping). Thus you should have a DC voltage between the pins of the coils if they are fed, even if the motor do not move.
    PY

     

    Last edit: PyB 2024-06-02
  • Adrian K-B

    Adrian K-B - 2024-06-02

    I have 0V across the pins of my coils (and changing between coil power off and coil power on doesn't alter it). I can measure 12V across pins 15 and 16 of the DRV8825, but nothing across the coil pins.

    I just remembered there is a test program, so I compiled and ran that and it successfully rotates the stepper motor. At least it rules out a hardware issue, so there's definitely something up with the config I guess.

    This is the user-editable part of my config.h:

    //-----------------------------------------------------------------------
    // myFocuserPro2 Focuser Config File DRV8825HW203
    // (c) R Brown, 2014-2024, All rights reserved.
    //-----------------------------------------------------------------------
    #if !defined(config_h)
    #define config_h
    
    #include <Arduino.h>
    #include "myBoardDefs.h"
    #include "defines.h"
    
    
    //-----------------------------------------------------------------------
    // WARNING: SKETCH AND GLOBAL VARIABLE SIZE LIMITS
    //-----------------------------------------------------------------------
    // When enabling options in this file, you will need to try and keep the 
    // Arduino sketch and Global variables to allow the Arduino chip to 
    // work without running out of space, which results in random reboots and 
    // the Serial interface not working.
    // 
    // When the sketch is compiled, these messages are found in the Output 
    // Window and looks like
    //      Sketch uses 26548 bytes (86%) of program storage space. Maximum is 30720 bytes.
    //      Global variables use 973 bytes (47%) of dynamic memory
    //
    // The sketch usage should be less that 83% most of the time (varies on 
    // what is enabled.) Higher sketch usage will result in errors and 
    // unexpected values being returned.
    //
    // The Global variables should be less than 60-70% (if debugging is enabled
    // then the Global variable usage will exceed the safety limit and make 
    // the sketch unusable). 
    // 
    // If either these are too high, you will need to disable an option to 
    // decrease the Sketch size and Global var size to recommended levels
    // 
    // Refer to the spreadsheet Options Program Size for more information
    
    
    //-----------------------------------------------------------------------
    // BOARDS SUPPORTED
    //-----------------------------------------------------------------------
    // PCB  DRV8825HW203_FIRBT
    // BT.BUZ.LEDs.LCD.OLED.HPSW.PB.SPWR.TMP.IR
    
    // PCB  DRV8825HW203_FRE
    // BUZ.LEDs.LCD.OLED.HPSW.SPWR.TMP.RE
    
    // PCB DRV8825HW203_M_MT_F_BT 
    // BT.BUZ.LEDs.LCD.OLED.HPSW.PB.SPWR.TMP
    
    // Stripboard DRV8825_HW203_FIR
    // BUZ.LEDs.TMP.IR
    
    // Stripboard DRV8825_HW203_FRE_S
    // BUZ.LEDs.TMP.RE
    
    // Stripboard DRV8825_HW203_MT
    // BUZ.LEDs.TMP
    
    // Stripboard DRV8825_HW203_TFT2_2
    // BUZ.LEDs.TMP.TFT
    
    
    //-----------------------------------------------------------------------
    // SPECIFY DRIVER BOARD HERE
    //-----------------------------------------------------------------------
    //#define DRVBRD     DRV8825HW203_FIRBT
    // PCB: BT.BUZ.LEDs.LCD.OLED.HPSW.PB.SPWR.TMP.IR
    
    //#define DRVBRD     DRV8825HW203_FRE
    // PCB: BUZ.LEDs.LCD.OLED.HPSW.SPWR.TMP.RE
    
    #define DRVBRD   DRV8825HW203_M_MT_F_BT
    // PCB: BT.BUZ.LEDs.LCD.OLED.HPSW.PB.SPWR.TMP
    
    //#define DRVBRD  DRV8825_HW203_FIR
    // Stripboard: BUZ.LEDs.TMP.IR
    
    //#define DRVBRD  DRV8825_HW203_FRE
    // Stripboard: BUZ.LEDs.LCD.OLED.TMP.RE
    
    //#define DRVBRD  DRV8825_HW203_MT
    // Stripboard: BUZ.LEDs.TMP
    
    
    //-----------------------------------------------------------------------
    // INPUT DEVICES
    // HOME POSITION SWITCH, STEPPER POWER DETECT, TEMPERATURE PROBE, PUSH BUTTONS
    //-----------------------------------------------------------------------
    // do NOT uncomment HOMEPOSITIONSWITCH if you do not have the switch fitted
    // To enable the HOMEPOSITION SWITCH, uncomment the nextline
    //#define HOMEPOSITIONSWITCH 1
    
    // This prevents the stepper motor moving when 12V to the stepper is OFF
    // and needs special circuitry or has no effect. To enable the 12V power
    // detect to the stepper motor, uncomment the next line (only available on some boards)
    //#define STEPPERPWRDETECT 1
    
    // To enable the temperature probe, uncomment next line
    #define TEMPERATURE_PROBE 1
    
    // To enable a Rotary encoder. uncomment the next line (only available on some boards)
    //#define ROTARYENCODER 1
    
    // To enable an Infra-red Remote, uncomment the next line (only available on some boards)
    //#define INFRARED 1
    
    // To enable the Push Buttons for manual focusing, uncomment the next line
    #define PUSHBUTTONS 1
    
    // To specify the number of motor steps to move for 1 push button press
    // change the 1 value for PB_STEPS below. The max value should be 1/2 the
    // focuser step size, [1-255 is the range]. If you set PB_STEPS to 0
    // then the push buttons will not move the focuser.
    #define PB_STEPS 1
    
    
    //-----------------------------------------------------------------------
    // OUTPUT DEVICES
    // BUZZER AND LEDS
    //-----------------------------------------------------------------------
    // Buzzer is used as a power on boot test, and with push-buttons as a
    // feedback for push button operation
    // To enable the buzzer, uncomment the next line
    #define BUZZER 1
    
    // To enable the IN-OUT LEDS, uncomment the next line
    #define INOUTLEDS 1
    
    
    //-----------------------------------------------------------------------
    // CONTROLLER CONNECTION OPTIONS: BLUETOOTH, CONTROLLERISAMICRO
    //-----------------------------------------------------------------------
    // To enable bluetooth, uncomment the next line  (only available on some boards)
    //#define BLUETOOTH 1
    
    // provided by IL, enables the serialEventRun function for a Micro
    // To enable support when usng a Micro instead of a Nano, uncomment the next line
    //#define CONTROLLERISAMICRO 1
    
    
    //-----------------------------------------------------------------------
    // SOFTWARE OPTIONS
    //-----------------------------------------------------------------------
    // To enable the super slow jogging, uncomment the next line
    //#define SUPERSLOWJOG 1
    
    // To enable the start boot screen showing startup messages, uncomment the next line
    #define SHOWBOOTMSGS 1
    
    
    //-----------------------------------------------------------------------
    // LCD LIQUID CRYSTAL DISPLAY, I2C
    // Uncomment one of the following LCDxxxx lines depending upon your lcd type
    //-----------------------------------------------------------------------
    //#define DISPLAYTYPE  DISPLAY_LCD1602 // 16 character, 2 lines
    //#define DISPLAYTYPE  DISPLAY_LCD1604 // 16 character, 4 lines
    //#define DISPLAYTYPE  DISPLAY_LCD2004 // 20 character, 4 lines
    
    
    //-----------------------------------------------------------------------
    // OLED DISPLAY I2C
    //-----------------------------------------------------------------------
    #define DISPLAYTYPE DISPLAY_OLED12864 // 128x64, 0.96" 16 character, 8 lines
    //
    // Select the correct driver chip for the OLED
    #define USE_SSD1306 1  // For the OLED 128x64 0.96" display and SSD1306 driver
    //#define USE_SSH1106 2 // For the OLED 128x64 1.3" display and SSH1106 driver
    
     

    Last edit: Adrian K-B 2024-06-02
    • brownrb

      brownrb - 2024-07-20

      This issue was fixed in firmware 335

       
  • Adrian K-B

    Adrian K-B - 2024-06-02

    @brownrb I found a bug in myBoards.cpp...

    //-----------------------------------------------------------------------
    // SET MOTOR POWER
    // turn coil power on, turn coil power off
    //-----------------------------------------------------------------------
    void DriverBoard::set_motorpower(byte state) {
      if (state == true) {
        // power on
        digitalWrite(DRV8825ENABLE, HIGH);
        delay(1);  // need to wait 1ms before driver chip is ready for stepping
      } else {
        // power off
        digitalWrite(DRV8825ENABLE, HIGH);
      }
    }
    

    The power on and power off lines do the same thing. The DRV8825 uses an inverted enable pin so the power on line should be:

    digitalWrite(DRV8825ENABLE, LOW);
    

    Making that change fixes the problem for me, my stepper motor once again powers up and works properly.

     

    Last edit: Adrian K-B 2024-06-02
  • PyB

    PyB - 2024-06-03

    Bingo! Classic forgetting when copying/pasting ;-)

     
  • Adrian K-B

    Adrian K-B - 2024-06-03

    Thanks for the pointers along the way @pyb :) you definitely helped me narrow it down.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.