-2
$\begingroup$

I'm using L298N motor driver to spin stepper motor (42BYGHM809). When connecting it to batteries(2*9v), the batteries heats up after few minutes and stop working, and when connecting it to power source, the power source reach it's current limit. I think the driver has not enough resistance, but from searching the web I didn't see any tutorial that recommends using a resistor with the driver. I tried to connect 100ohm resistor and it burnt and tried 450ohm resistor and the motor vibrated but didn't spin.

I saw in the web that when using high voltage it is recommended to remove the 12v connector(as seen in picture), but when removing it the driver doesn't turn on (the led remain off), like it not powered on (All the things i've tried above are with the connector).

Thanks for your help. jack

Schematic: Schematic

Arduino code:

#include <Stepper.h>
#include <SoftwareSerial.h>

// *** General ***
const bool DEBUG_MODE = true;
bool new_input = false;
bool use_bt = true;
int motorSpeed = 20;

// *** Stepper ***
const int stepsPerRevolution = 400;
Stepper myStepper(stepsPerRevolution, 4, 5, 6, 7);
float degCount = 0;

// *** communication ***
SoftwareSerial bt (11,12);
int usr_input = 0;
char sign;
const int BT_WAIT_TIME = 3, SER_WAIT_TIME = 1;

void setup() {
  if (use_bt){
    bt.begin(9600);
    //bt.listen();
  }
  Serial.begin(9600);
  myStepper.setSpeed(motorSpeed);
}

void loop() {

  // *** Get usr_input from BT or serial ***
  if (use_bt){ 
    if (bt.available()){
      Serial.println("BT");
      delay(BT_WAIT_TIME);
      sign = bt.read();
      usr_input = (int)bt.read();
      if (sign == '-'){
        usr_input = -usr_input;
      }
      new_input = true;
    }
  }else{
    if (Serial.available() > 0) { 
      usr_input = (int)Serial.parseInt();
      delay(SER_WAIT_TIME);
      while(Serial.available()) Serial.read();
      new_input = true;
    }
  }

  if (new_input){
      new_input = false;
      if (DEBUG_MODE)
        Serial.print("User input: ");Serial.println(usr_input);
      rotate(usr_input);
  }
}

// Rotate motor approximmatly x degrees and return how much degrees it really did.
float rotate(int degrees){
  int steps = round(degrees / 360.0 * stepsPerRevolution);
  if (DEBUG_MODE)
    Serial.print("Steps: ");Serial.println(steps);
  myStepper.step(steps);
  float real_degrees = steps * 360.0 / stepsPerRevolution;
  if (DEBUG_MODE)
    Serial.print("Real deg: ");Serial.println(real_degrees);
  degCount += real_degrees;
  if (DEBUG_MODE)
    Serial.print("Deg count: ");Serial.println(degCount);
  return real_degrees;
}
$\endgroup$
7
  • $\begingroup$ the module is probably defective .... it should not draw current from the batteries when it is not connected to the controller $\endgroup$ – jsotola Mar 21 '18 at 21:09
  • $\begingroup$ Yeah I came to say essentially the same thing as @jsotola - This board, by itself, doesn't do anything. You need to step the stepper motors somehow. How are you (or were you) providing inputs to drive the ENA and IN1, IN2, etc. pins? How do you have your batteries connected to the board? How do you have the batteries arranged - in series or parallel? A picture of your actual setup would be very helpful. $\endgroup$ – Chuck Mar 21 '18 at 21:12
  • $\begingroup$ I connected the power to Vcc and GND (4,5 in picture), I've shorted EN A and EN B (7, 12), connected 8-11 to the arduino and 1,2,13,14 to the motor. The motor spins, but draws to much current that overheat the batteries until they stop working. And as I said, I also short 3, because it doesn't work otherwise. $\endgroup$ – Ofri Wienner Mar 21 '18 at 22:36
  • $\begingroup$ If the controller means the arduino that gives the signal, I've connected it. The motor spins, but it overheat. Pictures(sorry for the quality) (In the photo I used just one 9v battery, it works but I don't have enough power this way) ibb.co/fspphx ibb.co/fks9hx $\endgroup$ – Ofri Wienner Mar 21 '18 at 22:54
  • $\begingroup$ i just checked to see if it's april 1st .... no it is not .... are you kidding? ... an aerial view? .... put on heavy boots and stomp on it to put it out of its misery! $\endgroup$ – jsotola Mar 21 '18 at 23:29
0
$\begingroup$

I'm going to guess that the wires from the board to the motor are not connected correctly, but you don't have a clear picture of the board or Arduino and you don't have any picture of the motor connections. What is the resistance on the A coil and B coil? What voltages are you reading if you hold the motor stationary?

What is your battery voltage? From this NI article:

If the motor moves erratically or not at all, then switch one wire from phase A with one wire from phase B.

That's my best guess at the moment. This is a troubleshooting question, so we need more information about your exact setup. Schematics of how it's supposed to be connected are less helpful.

Also, if you could link a datasheet or instructions for the board you're using, then that would be a great help, too.

$\endgroup$
1
  • $\begingroup$ Here are two photos, not the greatest quality, but I hope you could understand what happens: ibb.co/fspphx ibb.co/fks9hx. The coils are correct. The motor is able to spin (until the battery heat too much). I also tried checking the resistance and each coil has resistance of 2.3ohm. When the motor stads still, the voltage on each coil is 1.5v (when connected to 18v). $\endgroup$ – Ofri Wienner Mar 22 '18 at 19:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.