L298 not totally working - Page 1
Forum section: electronics / beginners

author: digitalundernet
author_rank: Contributor
timestamp: November 01, 2013, 09:32:27 pm
content: So I'm built a sumo robot for a competition in 10 days and the L298 is giving me some fits. Motor one (X-1) is working properly and no issues while Motor two (X-2) only works in reverse. I have no idea why. I want to say its the back EMF diodes but that shouldn't stop the motors from turning. I've probed the micro pins going to the L298 and they work as intended. Here's the schematic and board layout (Warning PDF)http://digitalundernet.com/wp-content/uploads/2013/11/SumoBotSch.pdfhttp://digitalundernet.com/wp-content/uploads/2013/11/SumoBot.pdfI've also applied power to both motors out of the circuit and they work in both directions.

author: kizzap
author_rank: Unknown
timestamp: November 01, 2013, 10:33:28 pm
content: Things I would be checking.Polarity of the diodes for Motor X2Inspect the board for any shortsTest the second motor on the first channel (just completely removes any thought the motor is the issue)Write a piece of sample code, to only put motor X2 into reverse.-kizzap

author: Whales
author_rank: Super Contributor
timestamp: November 01, 2013, 10:35:30 pm
content: Assuming no wiring faults, dead silicon? Have you tried replacing the part?It happens more often than you think. Every single component you use has a level of damage applied to it by the time it is in place. Sometimes this pushes them over the edge.Also: could you share pictures of the robot

author: fcb
author_rank: Super Contributor
timestamp: November 01, 2013, 10:39:13 pm
content: L298's are notoriously easy to blow.LMD18200T's are pretty robust in comparison.

author: digitalundernet
author_rank: Contributor
timestamp: November 01, 2013, 10:44:13 pm
content: Kizzap: we meet again.Polarity for the diodes looks fine and they passed my meter test.I see no shorts and again, continuity on my meter agrees there are none.I've wired the motor by it's self and it works forwards and back no issues.Just tried it and the motor did nothing.Looks like I'll be sucking that chip off the board and trying another. Good thing I bought multiple.Whales: Its not pretty to look at but sure

author: Andy Watson
author_rank: Super Contributor
timestamp: November 01, 2013, 10:50:49 pm
content: If I'm reading your circuit correctly (and you've not exactly made it easy), the motor and logic supply pins on the L298 appear to be reversed. (Pins 4 and 9).

author: digitalundernet
author_rank: Contributor
timestamp: November 01, 2013, 11:13:02 pm
content: Andy: Well that's annoying, I do. I also exceded the max input by a few volts so I'll bend those pins and wire them properly when I fix it. Damn I feel stupid.I'm still pretty new to schematic making so what could I have done to make it easier to read? Keep in mind I'm using free eagle so there aren't multi page options

author: Andy Watson
author_rank: Super Contributor
timestamp: November 01, 2013, 11:45:54 pm
content: Quote from: digitalundernet on November 01, 2013, 11:13:02 pmDon't! Simple mistake - learn from itIt'll be better next time - and easier.QuoteSince you ask:Basically, the idea of a schematic/circuit diagram is to convey "what is happening" in a form that is easy for humans to comprehend (there was a thread about this recently). It is more than putting the individual components on the same sheet of paper and labelling "nets". Connecting absolutely everything to everything elsewillcreate a mess, but,connectingparts of the circuit that are functionally linked, will make it easier to read the circuit.For example: Take the L298 and the major components the it uses - the output terminals could easily be connected to the chip (X2 to U1). Or the diodes (D1-D8), what do these do? There's plenty of space on the page -connect them. Also, (possibly an over sight) what do the cathodes of D5-8 connect to? - just a line on your diagram. These might appear to be minor issues, but remember the point of the diagram is to convey information - as a reader, I should not be having to guess where wires go!Like the PCB, pity about the "typo" on the pinsEdit: another typo!

author: Whales
author_rank: Super Contributor
timestamp: November 01, 2013, 11:52:26 pm
content: Quote from: digitalundernet on November 01, 2013, 10:44:13 pmAlways good practice to buy more than you need. Then you have leftovers for other projectsQuote from: digitalundernet on November 01, 2013, 10:44:13 pmOn the contrary: you have gotten your own board properly fabbed and use what looks like a dedicated host. This contrasts greatly with my last robotic project to make a line follower: I made almost everything myself except the MC. Check it out!http://members.optusnet.com.au/amerricka1/projects/maurice/front.jpeghttp://members.optusnet.com.au/amerricka1/projects/maurice/rear_guts.jpeghttp://members.optusnet.com.au/amerricka1/projects/maurice/bottom.jpeghttp://members.optusnet.com.au/amerricka1/projects/maurice/motor_drive.jpeghttp://members.optusnet.com.au/amerricka1/projects/maurice/IRboard.jpeg@your schematic, it is a little messy. More logical visual connections, rather than just broken links with net names, will make it easier to read.I would recommend you have a look at Kicad -- free & open source, no limitations. A few days ago CERN merged changes which make it MANY times nicer to use as well (OpenGL rendering FTW!).

author: digitalundernet
author_rank: Contributor
timestamp: November 02, 2013, 04:45:10 am
content: So I fixed the VLC,VCC mixup on my sumo and put my last l298 in. Now rather than one wheel working and one only working in reverse. I now have two motors that dont work in either direction.. I have NO idea what the problem is.

author: kizzap
author_rank: Unknown
timestamp: November 02, 2013, 09:21:37 am
content: you are not shorting out the bottom sitting the thing on the motors?-kizzap

author: Bryan
author_rank: Frequent Contributor
timestamp: November 02, 2013, 09:29:33 am
content: I find it much easier to use a L297 in combination with the L298. Let the L297 do all the work. All you need to do is feed it pulses if using a stepper motor and you can set jumpers for the pins to fwd/rev,step, or do it with code from the MCU.

author: amyk
author_rank: Super Contributor
timestamp: November 02, 2013, 10:52:00 am
content: Do you have a scope, or at least a multimeter?Check voltages and signals to ensure that they're what you expect...

author: digitalundernet
author_rank: Contributor
timestamp: November 03, 2013, 01:50:21 am
content: Quote from: amyk on November 02, 2013, 10:52:00 amI've checked and rechecked the voltages/signals and they all seem ok until it hits the L298. If its dead I'm SOL. My mind keeps going to the diodes being bad but out1 and out 2 have 0 volts so I don't think its the diodes.

author: Whales
author_rank: Super Contributor
timestamp: November 03, 2013, 08:36:23 am
content: Quote from: digitalundernet on November 03, 2013, 01:50:21 amNever!Make your own. 4 N-Fets (or 2 NPN + 2 PNP) will make a H-bridge. If you don't have the parts, either find a brick and mortar store to purchase them from (it should be less than several dollars, even at their premium rates) or find someone who has the parts. If you know nobody and don't go to an institution where other EEs lurk, shoot off emails to your nearest educational institution's staff in electronics related teaching. There are many more nice people in the world than nasty ones, even at a few day's noticeSeriously: don't give up. You have many pathways available to you to solve any problem, even if a deadline is mere days away. Try multiple at once, and be polite to anyone who helps you

author: MrAureliusR
author_rank: Unknown
timestamp: November 03, 2013, 09:04:55 am
content: Hey I'm actually curious about building an H-bridge from discrete components. The schematics I've seen online so far seem more complicated than I think it needs to be. If it's not being interfaced to a uC does it need any logic or can you just wire up 4 fets? And it's 2 NPN and 2 PNP correct? I heard you can also use BJTs but that seems kinda pointless as they can't handle the same kind of current (or have I been terribly misinformed?)Any pointers are greatly appreciated and I'm sure the OP could use them tooTyped using Hacker's Keyboard for Android

author: Whales
author_rank: Super Contributor
timestamp: November 03, 2013, 10:33:18 am
content: Making a quick H-bridge is easy. The complexity comes from making it fool-proof and most of all, efficient.Check out the attached hbridge_fets.jpeg. You need four switches of some description -- here N-channel mosfets -- to generate AC current from DC, and they ALL must be capable of the rated current. Use PWM on the control wires to vary speed. Keep in mind using exactly what I show here will result in a few problems:There is no flyback protection in this designWhen you switch off power to an inductor (like a motor) it will try and keep the current moving In effect, it will ramp up the voltage across itself. If it goes high enough it will fry your FETs. Your mileage will vary depending on your motor, choice of FETs, etc etcIf you signal power to both forward and backward pairs, you effectively short power to groundIndeed! Make sure your micro does not try and power the motors both backward AND forward at the same timeMosfets do not achieve their lowest resistance unless driven on the gate by a high voltageThis leads to greater power wastage through heat.For most FETs, to reach the datasheet's stated ON-resistance they need to be driven by about 12V or more. Check your datasheet. My second picture shows a solution to this problem: use another couple of FETs to level shift your micro's low voltage output to driving 12V signals.Unless your FETs are designed for switching, PWMing them will waste a lot of power"Gate transition" from on to off requires power, but you will probably just have to live with this. Same problem as above, especially since (most?) micros output PWM at very high frequencies.I have successfully driven motors in the past using a circuit identical to what is shown in the first diagram. It was inefficient, and the FETs desoldered themselves within a minute. They were however cheap, not designed for fast switching, in tiny SMD SOT packages and not heatsunk in any way beyond the copper tracks they lay on.BJT transistors are available for this level of current draw -- and for a long time were better in switching duties than available FETs. In low voltage applications like this however their voltage drop tends to waste more power than a FET's resistance does.If you were to make a BJT H-bridge, remember a few things:You will lose voltage going through two BJTs ala two diodesYou must calculate resistor values for powering the BJTsMy thoughts were to use two NPNs and two PNPs so that the control current completely avoids the motor (a varying load). That way the resistor values would be easier to calculate -- remember that you can practically sink an infinite amount of current into the base of a BJT if the right end of it is grounded/powered, turning it into vapour within an oh-no-second or two. You will need to measure the BJT's beta (gain), so a cheap multimeter will be useful.On second thoughts, perhaps using two NPNs and PNPs to intentionally force current through the motor would allow you to omit the resistorscouldwork. You would have to think more about this -- I have to go to bed right now, sorry. I recommend N channel MOSFETS anyway