6

Last Day I had the below system working perfectly... the only difference was that I was using a Pi Zero and a 12v battery for the L298N motor controller.

enter image description here

Today I somehow fried my Pi... its only heating up the Pi when I connect the USB power supply and does not boot.

The only thing that I changed today was that I added a switch to ON/OFF the supply from the 12v battery to the motor controller. But, without thinking, I added the switch on the ground (-ve) connection from the battery to the motor controller... like the image below.

enter image description here

Can this fry my Pi? Is it possible that when the switch was OFF, somehow the battery discharged through the ground pin of the Pi?

Jim Jose
  • 111
  • 4

2 Answers2

2

Question

How come the L298N fries my Rpi?


Answer

For L298N newbies, anything that can go wrong will go wrong. Let me list some of the things.

Part 1 - Connecting Rpi 3V3's GPIO pins, which are not 5V tolerant to the 5V test terminals of an L298N board which is designed for 5V Arduino whose GPIO pins welcome 5V.

l298n board 1

Workaround - Do not use a L298N board with two row of jumpers, or if you have already wrongly bought one, use a cutter to remove the 5V jumper pins on the top row.


Part 2 - Does not first read the friendly user guide and schematic and start guessing and messing around with the wiring terminal and jumper, or as the OP suggests, adding unnecessary protective diodes in the wrong polarity or across the motor terminals, causing short circuits here and there.

l298n jumper


Part 3 - The above schematic shows that there are two power sources:

(a) Vcc for powering the motors, can be 4.5V to 12V.

(b) Vss for powering the logic/control/H-bridge circuit, can be (i) externally provided, or (ii) from output of the on board M78M05 5V voltage regulator, with input from approx 7V to 12V. If M7805 input is higher than 12V, too much energy will be wasted a heat and might damaged the regulator. For more details, see Reference (1) below.

l298n wiring


Part 4 - L298N Wiring, Testing, and Warning to newbies

Warning - There are two kinds of L298N boards, one with 5V In/Out terminal at the middle of the PCB, another with 5V near the mounting hole (one side of PCB), as shown below.

l298n power

/ to continue, ...


References

(1) Interface L298N DC Motor Driver Module with Arduino - LastMinuteEngineers

tlfong01
  • 4,847
  • 3
  • 12
  • 24
1

In the presented schematic it would not matter whether the switch cut the GND line or the 12V line: in both cases the switch comes in series with the battery, and the rest of the schematic is unaltered when the switch is toggled.

However, the switch can totally be responsible for the damage caused to the Pi. If you switch it off while the motors are running, the motors will switch to the generator mode, converting the remaining mechanical energy into electricity. Without battery power, the driver IC may not be able to keep motor voltage contained within the 12V part of the circuit, and could leak it into GPIO pins which would then fry the Pi.

To sum it up, it doesn't matter in which line you put the switch. What is important is NOT to use it to shut down running motors.

Dmitry Grigoryev
  • 28,277
  • 6
  • 54
  • 147