Arduino Forum

Using Arduino => Motors, Mechanics, and Power => Topic started by: drewdavis on Jul 26, 2013, 10:09 pm

Title: BTN7970 Motor Driver
Post by: drewdavis on Jul 26, 2013, 10:09 pm
Hello,

I would like to build a dual motor driver based off of the BTN7970. I looked at the data sheet, and it gives a schematic on how to make a dual motor driver, however, I hardly understand it. Does anybody know what parts I need (besides 2 BTN7970's) to make an Arduino compatible motor driver? Also, any good books that would teach me how to read a schematic?


Thanks!

http://www.infineon.com/dgdl/BTN7970_DS_11.pdf?folderId=db3a3043156fd5730116144c5d101c30&fileId=db3a304316f66ee80117642373746a89&sId=db3a30443ff79439014017f2d616338c
Title: Re: BTN7970
Post by: dc42 on Jul 26, 2013, 10:31 pm
In view of your lack of knowledge, and because you have to be careful with layout when building high-current motor drivers, it might be better for you to buy ready-made motor driver boards based on that chip. I found a few on ebay, such as http://www.ebay.co.uk/itm/BTS7970B-BTN7970B-power-motor-driver-Controller-module-70A-A2630-78M05-5V-25V-/300921027008?pt=Intercoms_Access_Controls&hash=item46104a79c0 (http://www.ebay.co.uk/itm/BTS7970B-BTN7970B-power-motor-driver-Controller-module-70A-A2630-78M05-5V-25V-/300921027008?pt=Intercoms_Access_Controls&hash=item46104a79c0).
Title: Re: BTN7970
Post by: drewdavis on Jul 26, 2013, 11:15 pm
I found some good pre-built ones two. But I figured the best way for me to learn was by experience. To be honest I would rather have to re-buy parts because I failed at a design then to buy a motor driver that is working and gain no experience. Do you know of any resources that show you how to read a schematic? I don't mind buying a few books if you know of any that would help! I really would like to build this project my self so any info would be awesome :)


Thanks!
Title: Re: BTN7970 Motor Driver
Post by: drewdavis on Jul 27, 2013, 09:09 pm
I'm muddling my way through the data sheet, and I have a question will one BTN7970 per motor be able to control the direction? Or do I need two for each motor?


Thanks!
Title: Re: BTN7970 Motor Driver
Post by: dc42 on Jul 28, 2013, 09:26 am
That chip is a half bridge, so you need 2 for each motor.
Title: Re: BTN7970 Motor Driver
Post by: drewdavis on Jul 31, 2013, 10:08 pm
I got the parts in I need but the Pin spacing on the chip is much smaller then what would fit into a breadboard… something I did not expect! Does anybody know how to overcome this? I have wanted to make a PCB board through one of those online places for a long time, but for this project it would take to long for me to learn how to make a PCB design on eagle. Do they sell standard breakout boards? Any Ideas would be awesome!



Thanks!
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 01, 2013, 10:47 am
Well, you did say you wanted to learn! I don't know of any breakout boards for that chip, also good layout and short wiring is important for high-current switching ICs. So you can either download Eagle and design your own pcb, or buy a ready made BTN7970-based module via eBay, Or perhaps both - start with the eBay module, and later on design your own pcb, perhaps with the microcontroller integrated so you don't need an Arduino.
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 01, 2013, 02:45 pm
Well as it appears that their is no easy way I will take your suggestion, and buy one from eBay while working on my own PCB design.

Thanks for the help!
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 02, 2013, 02:17 pm
I started working on the design but I have looked all over and can't find a library that has a  BTN7970 driver in it. I also could not find anything that has the same pinout (TO263). Any ideas?



Thanks!
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 02, 2013, 02:45 pm
It should be straightforward to drive a bridge made from two BTS7970s from an Arduino. Connect the IN pin of each BTS7970 to an Arduino output pin with PWM capability (two separate pins) and a 10K resistor to ground. Connect the two INH pins to Vcc if you want the bridge to be active all the time; alternatively, connect it to a digital output pin (one pin can drive both INH inputs) and a 10K resistor to ground.

To drive the motor in one direction, digitalWrite LOW to the first IN pin, analogWrite to the second IN pin, and set the INH pin high. To brake the motor, digitalWrite LOW to both pins. To run the motor in the other direction, write LOW to the second IN pin and PWM the first. To let the motor coast, write LOW to the INH pins.

Optionally, connect a current sense resistor between each IS pin and ground, and feed it to an Arduino analog input via an R-C filter.
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 02, 2013, 03:20 pm
Thank you for the info, but  I have gotten through the data sheet and I understand how to hook it up. I'm trying to make a PCB on eagle but according to the youtube videos i'm watching I should make the schematic on eagle first. The problem is I can't find anything to represent the BTS7970.  Should I start with the PCB instead?


Thank you so much for helping me! Your info has always been very accurate and I would trust your opinion over the youtube videos…
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 02, 2013, 03:50 pm
OK, I thought you meant an Arduino library, but you meant an Eagle library. If it's the pad outline for the SMD version you want, try searching for "to263-7 eagle library".
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 02, 2013, 05:48 pm
I have been looking all day but I'm unable to find a library that has the driver or the TO263-7 package . Is there any way to make the schematic/PCB without it?


Thanks!
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 02, 2013, 07:03 pm
You didn't try hard enough then - I just found one at http://sparkle.tribbeck.com/eaglesearch/packinfo.php?id=4328 (http://sparkle.tribbeck.com/eaglesearch/packinfo.php?id=4328).
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 02, 2013, 08:37 pm
Thank you so much! I have stared working on my design.
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 03, 2013, 12:26 am
How does this schematic look… it's my first one!
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 03, 2013, 11:22 am
You appear to have the wrong pin numbers in your schematic. According to the datasheet:

1 GND - Ground
2 IN I Input Defines whether high- or lowside switch is activated
3 INH I Inhibit When set to low device goes in sleep mode
4,8 OUT O Power output of the bridge
5 SR I Slew RateThe slew rate of the power switches can be adjusted by connecting a resistor between SR and GND
6 IS O Current Sense and Diagnostics
7 VS - Supply
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 04, 2013, 03:09 pm
The pins on eagle don't match the pins of the motor driver since it was a different component. I just ignored the pin names, and went by the shape of the component. Sorry for not explaining that. I have attached the diagram provided by Infineon Technologies.
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 04, 2013, 03:37 pm
I wasn't looking at the pin names (which I realized were for a different component), I was looking at the pin numbers on your schematic and comparing them with the pin numbers from the datasheet.

After correcting the pin numbers, I recommend you add a pulldown resistor from the Arduino pin 4 input (which is the pin that I assume you intend to use to drive both INH pins) and ground. This is to ensure that the bridges don't activate their outputs before the Arduino has initialized that pin to be an output.
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 04, 2013, 05:13 pm
I believe that I fixed all the problems you mentioned. Thank you so much... this would be impossible without your help!
Title: Re: BTN7970 Motor Driver [Update]
Post by: MarkT on Aug 05, 2013, 01:07 pm
The chip has current sinks on logic inputs so pull-down resistors are redundant, they
read LOW if disconnected.

Although the datasheet claims good to 25kHz PWM, its clear it'll perform very poorly at that
speed due to the large switching times of the output stages.  I'd limit to 4kHz.
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 05, 2013, 01:16 pm

The chip has current sinks on logic inputs so pull-down resistors are redundant, they
read LOW if disconnected.


Mark it correct. When I read the datasheet, I assumed the low-level input current of 25uA typical was current that the device driving it had to sink; but on closer reading, I see that the measurement is taken at 0.4V input and the pin itself is sinking current.
Title: Re: BTN7970 Motor Driver [Update]
Post by: MarkT on Aug 05, 2013, 01:34 pm


The chip has current sinks on logic inputs so pull-down resistors are redundant, they
read LOW if disconnected.


Mark it correct. When I read the datasheet, I assumed the low-level input current of 25uA typical was current that the device driving it had to sink; but on closer reading, I see that the measurement is taken at 0.4V input and the pin itself is sinking current.


That and the schematic of the device showing current sinks on IN and INH  :)

Having said that, pulldowns can't hurt (and if a very noisy environment might help).   When laying out
the driver keep the high current paths away from the logic circuitry as much as possible to reduce
interference.
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 05, 2013, 02:30 pm
I'm glad I did it right! I will start working on the PCB.  Thanks for all the help. I will try and keep the traces for the motor away from the other traces.


Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 05, 2013, 05:46 pm
What do you think of the PCB?  If I did it right what place should I order it from?

Thanks!
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 05, 2013, 06:16 pm
I haven't time to check the wiring of your PCB, however I have the following comments:

1. You should make the whole of the bottom layer a ground plane, except for short traces that you need to cross under traces on the top layer.

2. Connect the tab of the ICs to the output terminal as well as to pin 4.

3. I suggest using one, high current, 4-pin connector (or 2 x 2-pin connectors) for the motor power supply and outputs, and a separate low-current connector for the signal wires. Both terminals should have a ground connection. For the 4-pin connector, you might want to use screw terminals so that you can easily connect thick wires. Put the signal connector at the opposite end of the board from the power/motor connector(s).

4. Use thicker traces to connect the IC power, ground and output terminals, so as to better handle the current. Also use thick traces to the decoupling capacitor(s).

5. The decoupling capacitor C1 should be very close to the ICs and the traces between it and the ICs should be short and thick, instead of the long traces you currently have. Consider using 2 capacitors, one per IC.

6. To better heatsink the ICs, expand the copper pad that you will solder the tab to as much as reasonably possible.

7. As you are using SMD ICs, I would use SMD resistors too - but that is a personal preference. If you are planning on using a soldering iron to solder the ICs, then you had better stick to through-hole resistors.

I use Itead for making my PCBs.
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 05, 2013, 08:04 pm
Thank you so much. I will get to work on your suggestions!
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 05, 2013, 09:42 pm
I made as many changes as I could. After making the bottom ground it became finicky and would not let me run traces on the bottom. Also, it would not let me add another capacitor unless I redid the schematic and the PCB.  It would also not let me expand the pad, however, I will be using a heat sink, fan, and be using a fraction of the rated amperage under normal conditions. I hope to do most of this with a soldering iron so I would rather keep the resisters through-hole.

If you think it will work I will leave it as is. If you think the circuit will not function without additional changes I will obviously redo everything to make it perfect.

Thank you so much!


Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 05, 2013, 11:14 pm
There is a technique to creating a ground plane from unused space in Eagle, while leaving traces you routed on the bottom layer intact. This is described in several different places on the web, for example at http://www.muzique.com/schem/groundplane.pdf (http://www.muzique.com/schem/groundplane.pdf).

How are you planning to attach the heatsink, given that you are using the SMD version of the chip?
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 06, 2013, 12:25 am
I was able to fix everything you listed. Thanks for the link.  I thought I could just add a small heat sink on the top via thermal glue. I was able to extend the pad around the chip so I might not even add the heat sink in. With no load on the motor it only pules 2 amps.
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 06, 2013, 12:38 am
Well, that might work OK, but it's not how I would lay it out. I would put the power and motor connector behind the ICs, allowing you to route the output terminals direct to the pads and use really short positive supply traces. I'd keep all these traces on the top surface Then I'd put the capacitor right in front of the ICs, or possibly between them. Then I'd put the resistors in front of the ICs, using traces on the back of the board if necessary to cross the power lines to the ICs, and finally the signal connector right at the front. The aim being:

- Keep the power and motor traces thick, short, and away from the input resistors and wiring
- Use short traces only on the reverse side, and only for signal connections
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 06, 2013, 05:03 am
I would like to start by saying thank you! I have learned quite a bit about PCB making because of you. Hopefully this will be my last attempt at making this PCB...
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 06, 2013, 09:22 am
That'e getting better IMO, however the trace between IC2 power and C1 should be wider. Also, try to route the power and motor lines without using the bottom side, so that you won't be passing large currents through vias. Assuming your screw terminals are insulated underneath (the ones I have used are), you can route some of the power or motor wires around the sides of and underneath the terminal block, to avoid the crossovers.

The traces that really need to be short are the ones between the positive supply pin of each IC and C1. I would go for one capacitor per IC, so that you can keep these really short.

Also you could have larger copper pads around the tabs, for better heat sinking.
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 06, 2013, 03:24 pm
I was able to do everything except keep the power from having to go through a via. I was just not able to think of a design that would work. I did add a few more vias so hopefully that will help. Also, the motor is only 12v, and i'm guessing around 5 amps. (no data sheet)


Do you think this one will work?


Thanks!
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 06, 2013, 05:12 pm
That's probably OK, however I don't see why you can't route traces underneath the screw terminals, assuming the terminal block is insulated underneath apart from where you solder it in (the ones I use are). Specifically, from terminal 4 (the leftmost one) you could route the trace up, then right, going underneath terminals 3, 2 and 1. From underneath terminal 1 it can continue to go right, then down to join up with IC1 and C2. A branch can also come down between terminals 1 and 2 to join up with IC2 and C1. It would be even simpler if you swapped the functions of terminals 1/2 with 3/4, because then the power would be on the correct side for the ICs anyway.
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 06, 2013, 05:27 pm
I get it now! How is this…
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 06, 2013, 05:46 pm
That looks good. C1 and C2 should connect direct to the ground plane, instead of through a short trace and a via. The right-hand end of R4 looks like it's not connected - I think the ground plane may be overlapping the trace you have from it. Similarly for some of the other traces on the reverse side. I would also shorten the longer traces on the reverse side - run the traces on the top side except where you actually need to perform a crossover, so as to avoid disrupting the ground plane more than necessary.
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 06, 2013, 06:07 pm
I was able to make all the changes except connecting the capacitors directly to ground. How do I do that?

Thank you so much for all of your wonderful help!
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 06, 2013, 06:59 pm
1. Remove the ground plane.

2. Route all the ground wires completely on the underside. So, where you have ground traces on the top side, tell Eagle to move them to the underside. It may be easiest to rats-nest the ground net and then turn the connections into traces on the underside.

3. Make any other changes you need to other traces on the underside.

4. Create the ground plane.
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 06, 2013, 07:16 pm
I believe that it is finished!
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 06, 2013, 07:32 pm
That looks basically sound to me, although it could be tided up. Are you sure you have left enough room for C1 and C2 - what value are they? You should probably use at least 470uF each (preferably 1000uF), which will have circular outlines and may be too big to fit in that space.
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 06, 2013, 07:45 pm
This is what I bought…

http://www.ebay.com/itm/290940423904?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

If they work I think I will leave the PCB as-is because I would be afraid I would mess something up in my effort to make it look neater.

Thank you so much for all the help you have given me! Hopefully everything I have learned in this forum will help me when I go to get a degree in Electrical Engineering next year.
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 06, 2013, 08:04 pm
Those caps are 470nF. If you look at the example on the datasheet, they have 470nF caps right at the chip, and a 470uF a bit further away. I suggest you add a 470uF or preferably 1000uF capacitor, as well as keeping the capacitors you already have. Otherwise, you will get large PWM currents in the power supply wires, which are likely to cause interference. It doesn't need to be as close to the chips as the 470nF capacitors, so I suggest you put it near the terminal block.
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 06, 2013, 08:38 pm
I added it in.


Thank you.
Title: Re: BTN7970 Motor Driver [Update]
Post by: dc42 on Aug 06, 2013, 08:58 pm
Looks good! I presume you have checked that you have a big enough space for it and the correct lead spacing. I don't think I can add any more, other than to repeat that I have not checked the signal wiring.

Don't forget to do a DRC (design rules check) in Eagle.
Title: Re: BTN7970 Motor Driver [Update]
Post by: drewdavis on Aug 06, 2013, 09:01 pm
I will double check the wiring and run the DRC but I believe it should be ok. Thank you so much for your help with this project… I would have been lost on my own!

Title: Re: BTN7970 Motor Driver Finished!!!
Post by: MarkT on Aug 07, 2013, 02:14 am
How much current are you expecting worst case?  The high current traces look far too small.

Also the heat spreading topside copper under the devices should be nice and large to help
dissipate heat.
Title: Re: BTN7970 Motor Driver Finished!!!
Post by: drewdavis on Aug 07, 2013, 02:24 am
I don't know. The motors have no data sheet. With no load they pull about 2amps @ 12v. They should NEVER stall.

Also, I have updated the board a little bit. I had a few traces going to the wrong place.


EDITD:

I forgot to mention I get lots of errors when I run the DEC. Most have to do with the via's not being the right size, however, I just used the default… I never changed the size. Any ideas?


Thanks!
Title: Re: BTN7970 Motor Driver Finished!!!
Post by: zoomkat on Aug 07, 2013, 05:47 am
Quote
Re: BTN7970 Motor Driver Finished!!!


So you have actually built the motor driver and it is working with the motor?
Title: Re: BTN7970 Motor Driver
Post by: drewdavis on Aug 07, 2013, 02:35 pm
No sorry. I thought the form was finished as it appeared that the PCB was right. In fact I was about to order it untill MarkT found some more problems with it. I have edited the subject line.

Do you think the PCB looks good. Now I'm afraid to order it.



Title: Re: BTN7970 Motor Driver
Post by: Mark_Grass on Oct 09, 2013, 03:12 am
Didn't want to start a new thread and this one seemed to be similar.

I have a board that I designed for the dual BTN7970.   I'm running a right angle worm gear motor with it.  Actually, the motor is being used as a very large servo.   I've mounted the feedback pot on the back of the output shaft.  It works great.   What I ultimately need is a dual servo 328P module that receives it's position information serially via RS485.   My BTN module has 3 opto isolated inputs (enable, IN1, and IN2).   I only drive IN1 with a PWM signal.   IN2 is a digital signal that controls direction.   So for reverse, IN2 is high and invert the PWM signal to IN1.   i.e.  100%DC on IN1 would be off and 0% would be full on.   By doing that I can control both servo motors with pin 9 for one and pin 10 used for the second motor.   All that being said,  I seem to have a noise problem when I'm running both servo motors.   It happens when the motor is switching directions.   While servo one is at it's correct position and stable   I have the second servo cycle about +/- 30 degrees.  When this servo hits the end of the sweep and reverses direction the second servo jumps several degrees.   Sooner or later the, servo one will jump back to the correct position.   It's a random occurrence.  The supply for the motor drive is totally separate from the 328P.     The supply for the 328P is the same as for the 328p that is sending the serial rs485 data.   I'm not sure if it's a problem with the changes in vcc for the two 328 chips or not.   I have validated that the target position data for servo one has not changed.  It's stable at  400 (0 to 1023). What has changed is that the analog reading of the feedback pot changes.   I haven't been able to isolate the glitch.   May be a problem of the VCC as the ref. voltage.  may be switching noise.   I would have thought that having the supplies separate would keep that from happening.   AS for the design of the board......The data sheet suggest having 10k resistors in series with the IN and Enable pins.  As mentioned earlier(DC42 mentioned) I also have a 1k resistor from the input pin to ground.   What I'll try doing is removing the resistors that shunt to ground and also try  playing with the slew rate resistor.   The datasheet doesn't give much info on it, but if I drop the supply voltage from 12 v to about 8v, the glitch goes away. 
Anyone have any ideas?