code_dude03
Posts: 9
Joined: Wed May 22, 2019 8:13 pm

L298n frying my pi

Wed May 22, 2019 8:38 pm

Hi,
First post on this forum, just wondering if anyone can help me out

I have been building a robot using a l298n motor driver board and have managed to fry two rpis. The setup was using an external powerbank to power the pis through USB and a 3s lipo battery for the two 12v dc motors. I connected the grounds from the battery and pi to the same ground port on the l298n like i read on an online tutorial. The pi was also connected to the l298n through the four jumper cables that control the motors. The pi worked fine until i started moving the motors - i ran the python script i was using that made the motors move then the pi started smelling really bad and within a few seconds the screen went black and the pi died.
I have attached a photo of the motor board and wiring
also not sure how jumpers are meant to be ive seen different things on different websites
Attachments
20190522_212655.jpg
this is the motor board - 4 jumpers for pi and gnd shared by pi and lipo +12v for lipo and +5v not currently in use
20190522_212655.jpg (30.78 KiB) Viewed 516 times

scotty101
Posts: 3597
Joined: Fri Jun 08, 2012 6:03 pm

Re: L298n frying my pi

Thu May 23, 2019 6:39 am

Can't tell anything from your picture. The forum doesn't support uploading even slightly large photos so may I suggest you upload some better quality pictures to something like imgur and share the link.
Also a list of how you have connected GPIO pins would be helpful
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

code_dude03
Posts: 9
Joined: Wed May 22, 2019 8:13 pm

Re: L298n frying my pi

Sat Jun 08, 2019 5:27 pm

Hi,
sorry i dint reply sooner,
the pins were wired from gpio 19 , 16 , 26 , 20 (pins 35,36,37,38) to the 4 motor control pins (not the jumper pins as i have seen on some other methods)
also the GND (pin 6) was connected the the common GND terminal where the battery's gnd was connected. The motors are 100rpm 12v geared motors and the battery is a 11.1v 3s 8c lipo battery. The pi was powered by an anker 10400 powerbank through usb. I have seen on other forums about flyback current / voltage and the need for flyback diodes. Im not sure if the board im using has these. Is this a possible cause for frying my pi?

pcmanbob
Posts: 6184
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: L298n frying my pi

Sat Jun 08, 2019 5:36 pm

From your description of how you connected the pi to the L298N, I see nothing that should have damaged your pi.

So there must be some thing else causing the problem, as was asked before please post some pictures of your setup .

Upload your pictures to imgur.com and post links here.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

code_dude03
Posts: 9
Joined: Wed May 22, 2019 8:13 pm

Re: L298n frying my pi

Sat Jun 08, 2019 6:35 pm

https://imgur.com/a/lRzW6MB
this is the photo of the wiring :D

code_dude03
Posts: 9
Joined: Wed May 22, 2019 8:13 pm

Re: L298n frying my pi

Sat Jun 08, 2019 6:40 pm

just did this in paint to show where wire actually go to
https://imgur.com/a/Q1IuqiN

pcmanbob
Posts: 6184
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: L298n frying my pi

Sat Jun 08, 2019 6:50 pm

Looking at your pictures I see no problem at the pi end, assuming that the pi ground is connected to the middle terminal of the three that is marked ground and that the battery neg or ground is connected to that terminal also.

One question what have you got connected to the 3rd terminal marked 5V ?

I can't see the control terminals on the L298N clearly enough to comment on there connection.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

code_dude03
Posts: 9
Joined: Wed May 22, 2019 8:13 pm

Re: L298n frying my pi

Sat Jun 08, 2019 6:55 pm

the 5v terminal just had a jumper that i was considering using to power the pi through 5v pin but it was not in use when the pi died

pcmanbob
Posts: 6184
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: L298n frying my pi

Sat Jun 08, 2019 7:07 pm

Well as long as the end was insulted and could not come in to contact with the pi or its wiring that should not have caused a problem.

That just leaves the control wire terminations on the L298N but can't see them well enough to comment.

That leaves the motor wiring , does it go directly to the L298N without any connection to the metal chassis of you machine.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

code_dude03
Posts: 9
Joined: Wed May 22, 2019 8:13 pm

Re: L298n frying my pi

Sat Jun 08, 2019 7:14 pm

https://imgur.com/a/DgG6c6L
both wires are direct from motor to terminal on both motors and included wires on l298n

pcmanbob
Posts: 6184
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: L298n frying my pi

Sat Jun 08, 2019 7:21 pm

Well still can't see control wires clearly but as long as they are on the middle with a jumper at each end they should be correct.

As motor wires go directly to L298N there should be no problems with them.

So from what you have said and shown in your pictures I can't see any reason for you pi to have been fried by the L298N unless it is faulty, or you have a short circuit on the bottom of the circuit board due to the way it is mounted.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
joan
Posts: 13999
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: L298n frying my pi

Sat Jun 08, 2019 9:44 pm

It is not clear how the GPIO are connected to the motor driver board. What are the connected pins labelled as at the motor driver board? What is connected to the enable pins?

pcmanbob
Posts: 6184
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: L298n frying my pi

Sat Jun 08, 2019 10:05 pm

code_dude03 wrote:
Sat Jun 08, 2019 7:14 pm
https://imgur.com/a/DgG6c6L
both wires are direct from motor to terminal on both motors and included wires on l298n
Joan.

If you look at the second image ( scroll down ) in the above link you can see there are jumpers on the 2 enable pins and the wires from the gpio are connected to the 4 direction pins.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

code_dude03
Posts: 9
Joined: Wed May 22, 2019 8:13 pm

Re: L298n frying my pi

Sun Jun 09, 2019 6:10 pm

forgot to mention - it worked perfectly for a few seconds before the pi got fried - responded to controller perfectly and had enough power to run well but then pi died screen went black and pi never worked again :(

pcmanbob
Posts: 6184
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: L298n frying my pi

Sun Jun 09, 2019 7:25 pm

Well I can't see anything that might have damaged your pi, the connections between the pi and the L298N look ok and you were using a separate power supply for the motors and the pi so that should be good.

The only thing I can suggest is you check it all again and also check the power supply you were using for the pi make sure it's only outputting 5.1 to 5.2 volts maximum.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

code_dude03
Posts: 9
Joined: Wed May 22, 2019 8:13 pm

Re: L298n frying my pi

Sun Jun 09, 2019 8:19 pm

thanks just checking that i dont need flyback diodes? saw this on a different forum

pcmanbob
Posts: 6184
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: L298n frying my pi

Mon Jun 10, 2019 9:39 am

Diodes to protect the L298N will be built in to the chip or onboard electronics, if you look at your L298N board you will see the diodes 2 lines of 4 on each side of the heat sink.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

code_dude03
Posts: 9
Joined: Wed May 22, 2019 8:13 pm

Re: L298n frying my pi

Mon Jun 10, 2019 7:01 pm

hi,
just tested the system with a new pi 0 w, new l298n and it worked perfectly :)
thanks for your help :)

User avatar
Imperf3kt
Posts: 2389
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: L298n frying my pi

Mon Jun 10, 2019 10:58 pm

code_dude03 wrote:
Sat Jun 08, 2019 6:55 pm
the 5v terminal just had a jumper that i was considering using to power the pi through 5v pin but it was not in use when the pi died
For future reference, the 5v available from an L298N is not good enough to power a Pi.
Google is ubiquitous - Try it today, it's free!
https://opensource.com/life/16/10/how-ask-technical-questions

Return to “Troubleshooting”