Using L298 Board to drive a dc motor
I have L298N board, which I would like to use to drive a dc motor (pump).
I have teensy connected to USB.
First I tested the pump. I connect the pump to GND and +5 from teensy3 and the pump worked.
Then I used teensy3's +5 and GND to drive the board (+5 went to VCC and +5 on the board). I connected In1 to low and In2 to high (as explained here). If I measure the voltage between OUT1 and OUT2 I get 5V, which is great, but when I connect my pump to these inputs I get only 3V between OUT1 and OUT2. I understand that the load changes this voltage, but what should I do to make this work? I thought maybe I should get proper +5 power supply, but I do know that USB power was sufficient. What am I doing wrong here?
The Vin pin is a supply to the T3 from an external 3.3 to 5.5VDC power source. Any voltage at this pin will be VUSB from your PC USB port, normally 5V at a maximum of 500mA.
I note on the board you have there is a 7805 voltage regulator, there is an overhead of this device of around 2V from the supply to the regulated voltage. In order to get 5V logic supply from the motor supply, the motor supply would need to be at least 7V. Putting 5V into a 5V regulator with a 2V overhead is likely to provide you with your 3V that you found. This is 1.5V from the lowest logic supply range of the L298.
To power the L298 you need a +5V power supply & GND, then you need a power supply for your pump, 5VDC as you state in your post. The power to the H-Bridges on the L298 is completely separate to the logic supply to the L298 itself, there is only one GND pin on the L298 (multiwatt 15 package) so all GNDs need to be connected to this pin. Although, in theory the logic and motor could be from the same power supply you need to ensure that the supply to the logic pin isn't affected by the motor being activated/stopped.
The good news is that the L298 logic control lines work from voltages as low as +1.8V so they can be controlled without converters from the T3 I/O pins, the connections from the Teensy3 to the L298 will be for direction/braking, you must also take the GND from the T3 to the GND of the L298. In this mode no +DC needs to be taken to from the T3 to the L298.
Vin enables you to power the T3 from an external power source other than USB, there are instructions on the link to break between VUSB & Vin in order to power the T3 from Vin and still connect it to VUSB in the reference section of the main site.
I wouldn't suggest that you use this pin to provide power to anything other than the T3 from an external supply.
If you want to use Vin to drive the T3 from the same logic supply on the L298 then you will need to provide a connection to the Vin pin of 3.7 to 5.5VDC, e.g the 5V supply to the L298 logic. At that point, I think it would be wise to have separate power supplies one for both the L298 logic and T3, and a dedicated PSU for the motor. Unless you can split the lines and clean the logic supply to cover any potential glitches.
If you don't cut the track on the underside of the T3 and you should connect a 'self powered T3' to a USB port at the same time there is a risk of damaging your T3, your USB port or both!
You should also keep in mind that the L298 itself is quite inefficient. Depending on the load, you will have something like a 1-5V voltage drop. If you are concerned about efficiency, there are much better MOSFET-based H-bridges.
It sounds like you don't need much current, so the DRV8833/DRV8835 might be an option (Pololu has cheap boards). That will likely enable you to stick with your 5V power supply...
Thanks Legb, for the detailed explanation. It will take me some time to digest it all But I see your point. Elsewhere I found out about the overhead, but I am glad you explained how to work around it.
Can you share some detailed information about this one,I need to understand this one as I'm having a research on this topic,Any video or blog with flow chars would add an advantage.
This is info about the L298N board. Watch this tutorial if you need more info about L298N, and some more explainations here.
This is all info I know about the pump.
The board has a separate power input for the motor, called "VCC", from the power input for the chip, called "+5". The share a common ground.
I'd try using Teensy's VIN pin to drive the "+5" pin, and of course connect a ground wire between Teensy 3.0's ground and the motor board ground. Then I'd use a separate 6V power supply. To be safe, it should be an isolated power supply (a wall transformer type without the ground pin) or something like 4 AA, C or D cell batteries. The negative lead should connect to the ground pin (together with Teensy's ground), and the positive to the "VCC" pin on the motor controller.
Thanks, Paul. I tried this approach. I connected 5V supply (it gives 5.7V though) and no luck. I believe the problem is, that L298N has just enough of a voltage drop, so the pump does not run. I guess if I had a 7V supply it might have worked