Hello all, it is now all working
First issue solved :
Having a 12v source, I was using the L298N to power the Arduino (via the 5v out of L298N) and the Motor. But as you know, L298N can take up to 30v, if you remove a Jumper, and in this case the 5v becomes “in”, and L298N must be powered by the Arduino itself.
That’s one of the stupid things about the L298N. Its pin labelling or usage is not really intuitive. I think it catches many users out - not necessarily the fault of the user. It’s really more to do with the lack of really easy to understand information about what we’re supposed to do with the “5V” pin.
Also… a quote from a L298N instructions source says:
“Note that the 5V regulated power on pin 5 above is an output when the 5V_EN jumper is in place. Otherwise you must input 5V regulated power at pin 5 so that the circuit can operate properly. Do not enable the onboard 5V regulator if you are supplying more than 16V to motors on the VMS (motor supply) pin, or the regulator will burn out.”
The above is semi-clear. But what they really should say is something like:
The “5V” pin can EITHER be an output pin or an input pin - DEPENDING on whether or not the JUMPER (written as “5V_EN” aka ‘5 Volt ENABLE’) is connected or removed. If this jumper is connected, then this will enable an onboard 5V voltage regulator circuit, and the “5V” pin will be an OUTPUT pin having an output voltage of 5V (which could be used to power an arduino). The voltage regulator (when it is enabled ONLY) will also power the L298N logic circuitry. Do not enable the onboard 5V regulator if you are supplying more than 16V to motors on the VMS (motor supply) pin. That is, if supplying more than 16V to the motors, then the 5V_EN jumper needs to be removed, otherwise the regulator can be damaged.
If the 5V_EN jumper is removed, then the onboard voltage regulator becomes disabled, and the L298N logic circuitry will be unpowered. In this case (with jumper disconnected), the “5V” pin becomes an INPUT pin, and an EXTERNAL regulated 5V supply must then be connected to this “5V” pin in order to power the L298N logic circuitry.
Too many manuals, instructions, teaching guides, text books, papers etc out there are too vague. If only they put in that little bit of extra effort to get the message across properly, then everybody would be better off.