Arduino Nano - Mosfet - L298N - Dc Motor protoboad fails

Discussion in 'Embedded Systems and Microcontrollers' started by quique123, Jan 11, 2019.

  1. quique123

    Thread Starter Member

    May 15, 2015
    342
    5
    Hey guys, Im back with trouble here. I had a project where a Nano would momentarily set a pin HIGH to turn on a Mosfet and feed an L298N in order to make a dc motor vibrate and shut back down to repeat the cycle later and it worked fine. I moved over from breadboard to through hole but I cant seem to make the motor run anymore. The same setup worked on the breadboard but now fails to run the motor.

    I know the code is fine because it worked before (on the breadboard). Here is the diagram:
    l298Fet.png
    I read the voltage between the D5 pin on the nano and GND and I get 5V on the multimeter, so I know the pin on the nano is being set to HIGH as expected.

    I read the voltage between 12V of the L298 and the GND of L298 and I get 0 when nano-D5 goes high.

    I read the voltage between GND and Mosfet Gate and I get 5V when nano-D5 goes high.

    So it must be something else. Here are the images of my board: 6063F66F-9C03-4B57-B067-E7EBFED06689.jpeg
     
    Last edited: Jan 11, 2019
  2. Dodgydave

    AAC Fanatic!

    Jun 22, 2012
    8,250
    1,436
    Clearly there is a short or wrong connection then...
     
  3. bertus

    Administrator

    Apr 5, 2008
    19,887
    4,135
    Hello,

    Why are you switching the ground connection of the L298?
    The L298 has enable inputs.
    What is the voltage on VCC?
    That should be the logic voltage.

    See this image for all pin functions:

    L298_pin_function.png

    Bertus
     
  4. dendad

    Distinguished Member

    Feb 20, 2016
    2,921
    810
    Switching the GND like that is not a good idea.
    You then end up with a "resistor" (the L298) connecting 9V to the Arduino pins.
    As mentioned above, use the enables.
    I can't quite follow why you want to switch the GND anyway. Already the inputs switch the motor on and off.
     
  5. quique123

    Thread Starter Member

    May 15, 2015
    342
    5
    The voltage is about 9v, it has worked before. What do you mean why am I switching ground?

    ---Do you mean I should connect the drain to the VCC of the L298 instead of connecting drain to GND?

    I'm using a mosfet to switch so that the l298 doesn't drain my battery as it otherwise would.

    ---So you suggest I skip the mosfet and connect EnA to nano pin 5 and leave In1 to Nano pin 6 and In2 to Nano pin 7?

    I took this example from an online project a long time ago.
     
    Last edited: Jan 11, 2019
  6. dendad

    Distinguished Member

    Feb 20, 2016
    2,921
    810
    Are you wanting the motor to reverse? Or is it just a vibrator motor?
    The L298 chip is pretty old and is quite lossy. If you want good battery life, I'd look at another.
    If your motor current is below 800mA, maybe these?
    https://www.jaycar.com.au/l9110-bridge-motor-driver-ic-dip-8/p/ZK8882 They too are old and may be hard to get.
    If you don't need speed control, a couple of DPST relays can do it and then there is no power consumed when they are off.
     
  7. quique123

    Thread Starter Member

    May 15, 2015
    342
    5
    Just vibrating. I know about the relays but I wanted to keep the package as small as possible.

    So do I wire the Drain to Vcc instead?

    What about the enable pins suggestion?

    Thanks again
     
  8. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    7,815
    3,716
  9. dendad

    Distinguished Member

    Feb 20, 2016
    2,921
    810
    On the circuit you have, is Vcc, Enable_A and Enable_B all hooked to +5V? If not, That is possibly why it is not going.

    You could try Enable_A and Enable_B hooked to pin 7 and the L298 GND directly to GND (remove the FET) then see what the current is when the L298 is disabled too.
    The FET you have cannot easily be used to switch the power. There are ways to do it but get it running then check what the current consumption is with the L298 off to start with.
     
  10. quique123

    Thread Starter Member

    May 15, 2015
    342
    5
    OK,

    EnA is jumped which means there is no need to set it to high to make the motor run according to the datasheet of l298.

    I just figured out the R was 220Ω instead of 1kΩ. Replaced it and it works again.

    However I want to get back to 2 points I consider important that you guys mentioned:

    1. I should switch the VCC instead of the the GND, which means I should do this:

    Screen Shot 2019-01-11 at 6.13.32 PM.png

    2. I should skip the fet and simply do this:

    Screen Shot 2019-01-11 at 6.15.26 PM.png
     
  11. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    7,815
    3,716
    So you are using the Ardunio module? It would have be nice if you mentioned that from the beginning. There are many, many articles on how to use this module posted on the internet.
     
  12. quique123

    Thread Starter Member

    May 15, 2015
    342
    5
    I thought I did. I mentioned I was using a Nano.
     
  13. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    7,815
    3,716
    You mentioned you are using a L298N which is a chip. You are using the Arduino L298N which could be very different.
     
  14. ScottWang

    Moderator

    Aug 23, 2012
    6,754
    1,047
    I think you choose the wrong MOSFET, because it was designed for the high voltage, so its Vgs =±14 and the Rds=2Ω, it's very bad for the low voltage as +5V uC, you should choose a Vgs = 4.5V logic level voltage or less.

    BSS97 -- Nch, 200V, 1.5A, Vgs=±14V, Rds=2Ω.
     
  15. Alec_t

    Expert

    Sep 17, 2013
    10,212
    2,495
    The drain and source of the FET are shorted together in your schematic. Where is the motor connected?
    That's the rated maximum Vgs. Vgs(thr) is < 2V; so it's a logic=level FET.
     
  16. ScottWang

    Moderator

    Aug 23, 2012
    6,754
    1,047
    Thanks.
    I only found the Rds(on), Vgs=10V, Id=1A.
    Do you have another datasheet talking about Rds(on)=2Ω, Vgs=4.5V?
     
  17. quique123

    Thread Starter Member

    May 15, 2015
    342
    5
    Could someone answer #10 please

    Thanks
     
  18. Alec_t

    Expert

    Sep 17, 2013
    10,212
    2,495
    You can't use an N-channel MOSFET (like a BSS97) to switch Vcc.
     
  19. Alec_t

    Expert

    Sep 17, 2013
    10,212
    2,495
    I was looking at this datasheet.
     
  20. ScottWang

    Moderator

    Aug 23, 2012
    6,754
    1,047
    We were all saw the same datasheet, so could you tell me which data can prove this MOSFET is a logic level Vgs=4.5V?
     
Loading...