0

enter image description hereI have a L298 motor controller connected to a motor with a 6 volt power sources. the motor however isn't spinning any ideas I'm using a esp 8266 node mcu board. I would like to use pwm but for right now I'm just trying to get it to work so I disabled the pwm.

//int d0 = 16;
const int d0 = 16;
const int d4 = 2;


//=======================================================================
//                    Power on setup
//=======================================================================
void setup() {
  Serial.begin(115200);
  pinMode(d0,OUTPUT);
  //pinMode(d1,OUTPUT);
  pinMode(d4,OUTPUT);
}

//=======================================================================
//                    Main Program Loop
//=======================================================================
void loop() {
  //PWM Value varries from 0 to 1023  
  Serial.println("10 % PWM");
  //analogWrite(d0,102);
  digitalWrite(d0,HIGH);
  digitalWrite(d4,LOW);
  delay(2000);

  Serial.println("20 % PWM");
  //analogWrite(d0,205);
  digitalWrite(d0,HIGH);
  digitalWrite(d4,LOW);
  delay(2000);

  Serial.println("40 % PWM");
  //analogWrite(d0,410);
  digitalWrite(d0,HIGH);
  digitalWrite(d4,LOW);
  delay(2000);

  Serial.println("70 % PWM");
  //analogWrite(d0,714);
  digitalWrite(d0,HIGH);
  digitalWrite(d4,LOW);
  delay(2000);

  Serial.println("100 % PWM");
  //analogWrite(d0,1024);
  digitalWrite(d0,HIGH);
  digitalWrite(d4,LOW);
  delay(2000);

}
  • 1
    Did you remembet to supply power to the controller itself? – AnT May 6 at 1:22
  • I did connect 9v to the controller in the is there something else im missing? – thesonyman101 May 6 at 3:17
  • 1
    Um... The controller itself needs ~5V logic supply voltage (7V max). Where do you connect your 9V supply to? If you have that popular pre-assembled L298N motor board with a built-in linear regulator, and you connect 9V to VCC, you will also have to install the jumper to enable the linear regulator to produce 5V for the logic supply. Or, alternatively, you can connect the "5V" pin to some other 5V supply. Either way, you have to provide a 5V for the logic to work. – AnT May 6 at 3:48
  • That's a picture of how I have the motor controller setup does it look right? – thesonyman101 May 6 at 8:35
2

You need two supply voltages for this board to work: motor supply, which goes directly to your motor (up to 35V for this L298N board, depends on what your motor needs), and logic supply of 5V, which powers the board's logic chips. If the motor supply voltage is between 7V and 12V, you can derive 5V logic supply from motor supply by enabling this board's built-in linear regulator.

  • The actual motor power supply should be connected to the VCC terminal of the L298N board you have in your picture. This is the leftmost terminal in the block of 3 in the picture (sometimes it is labeled +12V instead of VCC). In your case it is not connected to anything at all. This is already wrong.

  • It is not clear what the purpose of the red wire is in your picture.

    In your comments you mention different voltages of motor power supply (6V in one place, 9V in another...). If you are feeding this board 9V through the red wire, you are doing it wrong. The rightmost terminal in the block of 3 is the 5V pin. Don't attempt to feed more than 5V to that pin.

    If you'll be using the red wire to supply 5V logic power to the L298N board from an external source, then you need to disable this board's own linear regulator - remove the jumper that is shown above the 3-terminal block.

    If you'll decide to use it to supply 5V logic power from the L298N board (e.g. to your Arduino), then you have to keep the jumper.

    In any case, the leftmost terminal has to be connected to motor power supply.

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.