Menu

L298P 2A possible?

2018-03-04
2018-04-07
1 2 > >> (Page 1 of 2)
  • Kevin Snedden

    Kevin Snedden - 2018-03-04

    I would like to use a L298P 2A shields to drive a PG27 steppper.
    Would I follow the pdf (generally) for the L298N driver?
    Thanks

     
  • brownrb

    brownrb - 2018-03-05

    I am not up to speed with L298P driver - no harm in trying L298N in mean time

     
  • brownrb

    brownrb - 2018-03-05

    Is this the motor shield version?
    If it is motor shield - then answer is no, will not work, conflicts with just about everything

    Do you have a purchase link?

     

    Last edit: brownrb 2018-03-05
  • brownrb

    brownrb - 2018-03-05

    Hi Kevin
    It uses
    D12
    D13
    D11
    D9
    D8
    D3
    A0
    A1

    So this excludes fitting home position switch, Bluetooth, pushbuttons, blue led,

    So in firmware for L298N- Focuserv264_L298N - you need to do this
    //#define PUSHBUTTONS 1
    //#define INOUTLEDS 1

    and

    #define IN1   3       // define L298N inputs
    #define IN2   12
    #define IN3   11
    #define IN4   13
    

    I do not know if it will work.

     
  • Kevin Snedden

    Kevin Snedden - 2018-03-06

    Thank you so much for the suggested code changes.
    I'll give them a try and let you know how it goes.

     
  • Kevin Snedden

    Kevin Snedden - 2018-03-06

    B- and A- leds light up and moving one step at a time seems to walk through them. Motor just hums when connected and commanded to move. However, I think it may be in 2 channel mode (2 DC servo drivers). I need to examine any docs on this board and review motor wiring for the PG27 and B- B+ A- A+ terminals. Looks promising.

     
  • brownrb

    brownrb - 2018-03-06

    The docs seemed to indicate DC motors, not steppers.
    It might be the wiring of the stepper, you only have a limited number of combinations to try.

     
  • Kevin Snedden

    Kevin Snedden - 2018-03-07

    I am having trouble finding any docs for this particular board. It doesn't help that there are two different designs using the same name. The shield I bought is switchable from 2 DC motors to 1 stepper (but I can't find that switch!) The Adafruit version has a jumper to set this. I am trying to eventually stuff a focuser, rotator, dew controller and USB hub into a single enclosure.

     
  • brownrb

    brownrb - 2018-03-07

    Hi Kevin
    I found this on Amazon

    I found this to be an excellent motor shield. The hardest part was figuring out how to use it with a stepper motor and what the jumper did.
    I did find some documentation (pdf) when I searched for: L298p motor shield datasheet
    The document is not great, but it is a start: Here are some tips to help you, if you have the same problems that I did:

    To run a stepper motor using the Stepper.h module:
    You need you use the two pin stepper interface with pins 12 and 13. and force 9, 10 always HIGH (at least this worked for me).
    Stepper myStepper( stepsPerRevolution,13,12);
    digitalWrite(10, HIGH);
    digitalWrite(11,HIGH);
    myStepper.setSpeed(speed);
    myStepper.step(stepCount);

    I found that the jumper isolates the Vin on the Arduino from the motor power. If you are supplying power to the shield that exceeds the Arduino limit (7-12v), then pull the jumper so that you do not overdrive the Vin pin on the Arduino.

    Not sure if that helps

     
  • Kevin Snedden

    Kevin Snedden - 2018-03-08

    There are two very different shields called L298P 2A
    I think the one you researched above id the more popular (actual) version.
    I may have actually found the schematic for this weird shield. Nano pins are...
    D4 - Direction A
    D5 - PWM A
    D6 - PWM B
    D7 - Direction B
    I am not quite sure how to map them to IN1,IN2,IN3,IN4, etc.

    documents found at :
    https://www.robotshop.com/en/arduino-nano-7-12v-2a-dual-motor-controller.html

     

    Last edit: Kevin Snedden 2018-03-08
  • Kevin Snedden

    Kevin Snedden - 2018-03-08

    It looks like this schematic does not match the shields that I bought. I could not get any led or motor action using the new pin assignments. I may need to abandon these and try a new compact shield. What model did you find on Amazon?

     
  • brownrb

    brownrb - 2018-03-08

    I would probably assume something line
    in1 d4
    in2 d5
    in3 d7
    in4 d6

     
  • Kevin Snedden

    Kevin Snedden - 2018-03-09

    trying to use your sugestion to tie 10,11 high but I don't understand where to put this text.

    "
    Stepper myStepper( stepsPerRevolution,13,12);
    digitalWrite(10, HIGH);
    digitalWrite(11,HIGH);
    myStepper.setSpeed(speed);
    myStepper.step(stepCount);
    "
    It keeps failing to compile. "mystepper" is not declared

     
  • brownrb

    brownrb - 2018-03-09

    Hi Kevin
    Above will not work for your sheild as its wrong one. It is for an amazon shield which has different pins to the shield you have.

    Suggest you go right back to a strip down test program like that attached.
    Wire up the stepper coils one pair to A- and A- and other pair to B- and B+
    Program nano
    Disconnect USB cable
    Be sure to have 9-12V applied else motor will not move.
    if motor does not move
    1. turn off power
    2. Swap over A- and A+ stepper coil wires
    3. try again

    If motor still does not move
    1. turn off power
    2. Swap over B- and B+ stepper coil wires
    3. try again

    If motor still does not move
    1. turn off power
    2. Swap over A- and A+ stepper coil wires
    3. try again

    That way you work through all possible stepper motor wire combinations. Remember to wait 10s or so each test as there are 2s delays in the program.

    If none of that works, I would probably use a multimeter set to resistance, Remove power and any cables and stepper

    Look at datasheet for L298P chip and determine pins for PWMA/B and DIRA/B and then check with meter as to what pins on Nano each of these goto. Then look at test program to see if that is correct in the program and change if necessary, then repeat all above tests

     
  • Kevin Snedden

    Kevin Snedden - 2018-03-11

    Mr. Brown,
    Thank you so much for your advice. You have been the most helpful and generous person I've run across in getting these types of DIY projects together and working. Even more informative and responsive than the companies that sell these circuit blocks. I will try out your test and let you know what I find.

     
  • Kevin Snedden

    Kevin Snedden - 2018-03-11

    After more searching I found pinouts for the actual board that I have. which is at this web page
    https://www.aliexpress.com/item/NANO-L298P-L298P-2A-Dual-Channel-DC-Stepper-Motor-Driver-Shield-Module-5V-12V-PWM-DC/32820838638.html?spm=2114.search0104.3.142.62f4185fr5AOmE&ws_ab_test=searchweb0_0,searchweb201602_3_10152_10065_10151_10344_10068_10130_10324_10342_10547_10325_10343_10546_10340_10548_10341_10545_10084_10083_10618_10307_5711212_10313_10059_10534_100031_10103_10627_10626_10624_10623_10622_5711315_10621_10620_10810_10811_5722415,searchweb201603_2,ppcSwitch_3&algo_expid=75e4020b-06fd-432b-a79e-8e08ca39abaf-20&algo_pvid=75e4020b-06fd-432b-a79e-8e08ca39abaf&transAbTest=ae803_5&priceBeautifyAB=0

    DIRA D12 DIRB D13
    PWMA D3 PWMB D11
    BRKA D9 BRKB D8
    Current Sensing A0 A1

    I used an ohmeter to trace out and verified the above pinout.
    I am using 17NEMA PG27

    The brakes are not disabled (jumpered) should they be?
    Also, the current sensing is not enabled (jumpered)

    I put a (clockhand) on the motor but cannot make it move using the test program. I think I went through all iterations of wiring. I'm wondering now if I should disable the brakes.

     

    Last edit: Kevin Snedden 2018-03-11
  • brownrb

    brownrb - 2018-03-11

    Yes, you might need to set the brake pins (D8 and D9) to LOW (they might be floating high and if that is the case then the motors would not move)

    Looking at that schematic though, the brake pins are driven via an EXNOR 4077B gate, with one input tied to gnd via a pull down resistor. If the other pin was 0 then the output of the gate wouldbe 1 meaning brake is on, which is opposite of what to expect.

    It means you might have to send 1 to the BRK pins in order to disable braking.

     

    Last edit: brownrb 2018-03-11
  • Kevin Snedden

    Kevin Snedden - 2018-03-11

    I've tried it with the brake disable jumpers soldered. It makes no difference. The motor just hums according to motor speed but nothing rotates.

     
  • brownrb

    brownrb - 2018-03-11

    According to the schematic, the brake disable jumpers appear to do nothing.

    Use a multimeter to check the actual logic level on the L298P chip for BRK

    I believe these are ENA and ENB, pins 6 and 11 of the L298. They need to be HIGH for the motor to step.

     

    Last edit: brownrb 2018-03-11
  • Kevin Snedden

    Kevin Snedden - 2018-03-11

    I've got ~11V on pin 6 and pin 11 is labelled ground so zero volts there. I think you are referencing a different L298P 2A package than the one I am using..

    I just found a better image of the L298P 2A circuit that I'm using which I'll attach. This is not a NANO implementtaion but the driver is right. Trying now to figure out which pins are the "EN" pins. Looks like the "brake" jumpers may be involved? They go to pins 9 and 15.

     
  • Kevin Snedden

    Kevin Snedden - 2018-03-12

    Ithink that I need to hold Arduino pins D8 and D9 high (or low?) to enable stepping.These are inputs for braking. Trying to figure how to do that now.

     
  • Kevin Snedden

    Kevin Snedden - 2018-03-12

    Settingthe brakes high kills any activity (makes sense). But I did get the motor moving. I increased the steps per revolution to 10000 and now it moves very roughly when using the slow speed setting. the medium and high speeds only generate a tone at the driver. Not sure what to do but will continue experimenting.It will be cool to get this nailed as these driver boards are very small an only $5.

     
  • brownrb

    brownrb - 2018-03-12

    If you got the motor moving (roughly) on slow but not medium/high, try lowering the 10000 to like 500 or 1000.

    I would then concentrate on trying to get it running on FAST speed first at this point.

    Try changing the value of stepontime from 5 to 10 (about line 222) but not much more (max 20)
    #define stepontime 10

    try changing the value of motorSpeedDelay to 10 (about line 218) but not more than this
    #define motorSpeedDelay 10

    try changing the RPM value in lines 215-217 (first try half and then double the value)
    #define motorSpeedSlowRPM 10
    #define motorSpeedMedRPM 30
    #define motorSpeedFastRPM 50

    Once it appears to be moving at fast then I would go back and change the steps per revolution to the correct value.

     
1 2 > >> (Page 1 of 2)

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.