DCC++EX and Pololu G2 18v18 motor shield

Nick8564 Jan 29, 2021

  1. Nick8564

    Nick8564 New Member

    2
    1
    1
    I am trying to use a Pololu G2 18v18 motor shield. Per the motordrivers.h file the pins for this board and the MC33926 are the same except for the pin 2 and pin 4 which when low keep the driver in sleep mode. I jumped 5v to pin 2 but still could not get any thing to the tracks. Per my searching on Google it doesnt look like anyone has tried this board yet. I know its high current, but i am hoping the high current limit will help with autoreversers and power management. I plan to use current sensors and relays to make my own power districts and protection. Thanks.
     
    BigJake likes this.
  2. Ash

    Ash TrainBoard Member

    106
    67
    8
    I looked at how the pins were defined in the sample code from Pololu. The boards are similar; differences can likely be addressed by creating another motor shield definition.

    Here is what I would try:
    Remove the jumper you added, as pins are separately identified.

    in config.h
    comment out the existing define
    //#define MOTOR_SHIELD_TYPE STANDARD_MOTOR_SHIELD

    and add this
    // Pololu Motor Shield G2 18v18
    #define POLOLU_MOTOR_SHIELD_G2 F("POLOLU_MOTOR_SHIELD_G2"), \
    new MotorDriver( 9, 7, UNUSED_PIN, -2, A0, 244, 7000, 6), \
    new MotorDriver(10, 8, UNUSED_PIN, -4, A1, 244, 7000, 12)
    #define MOTOR_SHIELD_TYPE POLOLU_MOTOR_SHIELD_G2

    in DCCWaveform.h -- about line 125
    edit the static value if necessary.
    static const int TRIP_CURRENT_PROG=250; // read the caution
    the default value of 250 mA might trip by any noise on pin A1 with a current factor of 244. 5000 could be too low as it is a pincount of 20. Same for the 7000 mA included in the motor shield definition.

    references:
    https://dcc-ex.com/advanced-setup/motor-board-config.html#your-board-is-not-in-the-supported-list

    https://github.com/pololu/dual-g2-high-power-motor-shield/blob/master/DualG2HighPowerMotorShield.cpp
    https://github.com/pololu/dual-mc33926-motor-shield/blob/master/DualMC33926MotorShield.cpp

    DualG2HighPowerMotorShield::DualG2HighPowerMotorShield()
    {
    _M1nSLEEP = 2;
    _M1nFAULT = 6;
    _M1DIR = 7;
    _M1PWM = 9;
    _M1CS = A0;

    _M2nSLEEP = 4;
    _M2nFAULT = 12;
    _M2DIR = 8;
    _M2PWM = 10;
    _M2CS = A1;
    }

    -- a few current sense factors, based on specs
    ((Vcc/1024)/volts_per_amp) * 1000
    0.004882813
    1.627 0.00300 3.00 Standard Motor Shield
    0.525 0.00930 9.30 33926
    1.000 0.00488 4.88 MAX471
    0.020 0.24414 244.14 G2 18v18
     
  3. BadMisterFrosty

    BadMisterFrosty New Member

    1
    1
    1
    I am looking at using a Pololu G2 24v18, which is the same except it has larger MOSFETS for driving the higher voltage and current (up to 28V/18A!). I would like to use this with a Mega for DCC++, however my code base does not appear to be the same. I downloaded the base station in July 2021 and it appears to be much different.

    After looking through this code, it appears that all I needed to do was to define the following in DCCpp_Uno.h. My config.h file only had a #define for the MOTOR_SHIELD_TYPE. It did not have any macros like what was shown in the previous post. Furthermore, I do not have a DCCWaveform.h in my project and could not find any reference to TRIP_CURRENT_PROG. Did I grab the wrong code base (https://github.com/DccPlusPlus/BaseStation)?

    #elif MOTOR_SHIELD_TYPE == 2

    #define MOTOR_SHIELD_NAME "POLOLU Dual G2 High-Power Motor Driver Shield"
    // A = M1 = Main Track
    // B = M2 = Programming Track

    // Enable = PWM signals
    #define SIGNAL_ENABLE_PIN_MAIN 9
    #define SIGNAL_ENABLE_PIN_PROG 10


    // Current Sense
    #define CURRENT_MONITOR_PIN_MAIN A0
    #define CURRENT_MONITOR_PIN_PROG A1


    // Direction
    #define DIRECTION_MOTOR_CHANNEL_PIN_A 7
    #define DIRECTION_MOTOR_CHANNEL_PIN_B 8
     
    BigJake likes this.
  4. Ash

    Ash TrainBoard Member

    106
    67
    8

Share This Page