Shop OBEX P1 Docs P2 Docs Learn Events
NJM2670 Dual H-Bridge Chip — Parallax Forums

NJM2670 Dual H-Bridge Chip

GManGMan Posts: 19
edited 2006-08-13 13:34 in BASIC Stamp
Has anyone used the NJM2670 dual H-Bridge chip with a stamp 2 to run bipolar steppers?· I've ordered a number of these since they seemed to be exactly what I needed.· I was wondering if there's any hidden gotchas.· These would also see to be a pretty good solution for running two brushed motors.
«1

Comments

  • GManGMan Posts: 19
    edited 2006-08-11 03:51
    Ok, these dual H-Brigde chips just arrived.· So I slapped one in the breadboard and wired it up using the sugested wiring diagram on the fifth page of the datasheet linked in my previous post.· I wrote a simple program that did nothing more than fire the pins in the proper order to cause the chip to output·the proper bipolar stepping sequence.·

    In short I was less than impressed.· Nothing happened.· So I double checked the wiring.· There were no missed connections.· Then I hooked some LED's up to the BS2's output pins to make sure it was functioning as expected and sure enough, it was switching the pins as anticipated.· I then pulled the stepper motor and replaced it's windings in the circuit with bipolar (two color) LED's and current limiting resistors and fired the circuit up again... There wasn't a glimmer of life to be seen.· So I replaced the chip with another only to get the same result.·

    What is this datasheet telling me that I'm not smart enough to catch?·

    I've wired the H-Bridge chip's input pins (INA1, INA2, EnableA, INB1, INB2 & EnableB) directly to the stamp's pins as indicated in the schematic.· Is there some interface circuitry needed beyond that perhaps?

    I've attached the schematic for your reference.· Any help would be greatly appreciated!
    702 x 478 - 37K
  • Robert KubichekRobert Kubichek Posts: 343
    edited 2006-08-11 04:18
    Have you tried to force the bipolar steps by using jumpers across the enable inputs as per the logic chart???
    Inable A/B have to be at a high state at all times.
    By using jumpers, you take the stamp out of the loop for trouble shooting.
    You can put leds on control pins to check your program logic on the stamp.
    Also the bipolar phasing has to be correct, or the stepper will just vibrate, or not do anything..

    Bob
  • T ChapT Chap Posts: 4,223
    edited 2006-08-11 04:25
    What is your Vsb, Vsa, VCC on the IC? GNDS connected if using multiple supplies?

    All Enables High?

    Any readings on the OUTS without the motor pressent?

    What is TSD(shut down pin maybe ?) set at?
  • T ChapT Chap Posts: 4,223
    edited 2006-08-11 04:28
    Forgot to ask what your available current is to the Vsa, Vsb
  • GManGMan Posts: 19
    edited 2006-08-11 04:46
    I can get the stepper to go using a prebuilt dual H-Bridge board using both full step (+0,0+,-0,0-) and half step phasing (+0,++,0+,-+,-0,--,0-,+-).·

    The VCC & TSD pins are used for feedback of a thermal shutdown condition. TSD will go high (i.e. show VCC) in the event of a thermal shutdown (if I'm reading the atasheet correctly that is).

    VSA & VSB are connected to a 12 V Supply, & the stamp is connected to a 9V supply & the grounds of both of these supplies are common.

    I've not attempted jumpering the HBridge's inputs (yet, thanks for the idea)·but I'm not reading any voltage from the outputs, even with the stamp in a static output configuration.

    The enables however should not be high in all cases.· If the winding is to be unpowered (i.e. 0 in the phasing), I've pulled the enable low, otherwise the H-Bridge would be in a shorted (braking) or active configuration on that winding (per the truth table) causing the stepper not to step.

    EDIT:

    Available current to VSA & B is·1.5 Amps (a fully charged 1500mAH 12v lead acid battery).

    Post Edited (GMan) : 8/11/2006 4:59:30 AM GMT
  • T ChapT Chap Posts: 4,223
    edited 2006-08-11 05:14
    Well, if you tried putting a solid 5 volts at the INA1, and GND at INA2 and that didn't produce an output on OUTA, then I am at a loss. If you could take a closeup shot with clearly shown wiring then maybe someone could notice something. From your notes it all seems right. I'd try another +V source as well just for the heck of it.
  • GManGMan Posts: 19
    edited 2006-08-11 06:39
    Ok, I splapped an LM7805 onto the breadboard and using jumpers I was able to manually access all the H-Bridge modes from both H-Bridges on the chip...

    Here's a question (sorry if it's a dumb one but I am still rather new to the stamp) When you set one of the stamp's pins to "low" is it actually set to ground potential (VSS) or does it just float?

    I ask this because if I allowed an H-Bridge input to just float (i.e. just didn't hook it to anything). I didn't get any output from the H-Bridge. If I grounded the inputs that were supposed to be at logic 0 rather than leaving them float, the output appeared as anticipated.

    Was I incorrect in thinking that setting a stamp pin to "low" actually presented VSS at the pin?
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-08-11 06:55
    GMan -

    Are you just setting the pin low or using the LOW command? The latter will probably resolve your problem. If you use the former, it's your responsibility to make sure the pin is set to OUTPUT mode, otherwise the pin may indeed float.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • T ChapT Chap Posts: 4,223
    edited 2006-08-11 06:56
    It is at Vss when Low, floating would be a tri state condition, as you should be able to test this out sinking an LED via a 200 ohm to Vdd. I think you stated that you had the Enables high right?

    Are you saying that is still doesn't work with the Stamp or is working now?
  • T ChapT Chap Posts: 4,223
    edited 2006-08-11 06:58
    Why not post your code to confirm what Bruce said as a possible problem.
  • GManGMan Posts: 19
    edited 2006-08-12 03:29
    Ok, here's the code:

    'VERY Simple bipolar Stepper/Dual H-Bridge Test
    '
    'H-Bridge Truth Table
    'InA1/B1···· InA2/B2···· EnA/EnB···· OutA1/B1···· OutA2/B2
    '· L··········· L········· H············ L··········· L
    '· L··········· H········· H············ L··········· H
    '· H··········· L········· H············ H··········· L
    '· H··········· H··········H············ H··········· H
    '
    'H-Bridge to BS2 Pin Mappings
    'INA1· INA2· EnA· INB1· INB2· EnB
    ' 3···· 4·····5··· 6···· 7···· 8
    '

    'Set our pins to outputs
    OUTPUT 3·
    OUTPUT 4
    OUTPUT 5
    OUTPUT 6
    OUTPUT 7
    OUTPUT 8

    DO

    · 'Step 1 Coil A +
    · LOW 3
    · HIGH 4
    · LOW 6
    · LOW 7
    · 'Set Enables·
    ··HIGH 5
    · LOW 8
    · PAUSE 20

    · Step 2 Coil B +
    · LOW 3
    ··LOW 4
    · LOW 6
    ··HIGH 7
    · 'Set Enables·
    ··LOW 5
    ··HIGH 8
    · PAUSE 20
    ·
    · Step·3 Coil·A -
    ··HIGH 3
    ··LOW 4
    · LOW 6
    ··LOW 7
    · 'Set Enables·
    ··HIGH 5
    ··LOW 8
    · PAUSE 20
    ··
    · Step·4 Coil B -
    · LOW 3
    ··LOW 4
    ··HIGH 6
    ··LOW 7
    · 'Set Enables·
    ··LOW 5
    ··HIGH 8
    · PAUSE 20

    LOOP

    So what am I doing wrong here folks?· This shouldn't be this hard!· At this point·I know the H-Brigde chip is properly wired into the circuit, because I can manually trigger the inputs.
  • T ChapT Chap Posts: 4,223
    edited 2006-08-12 04:11
    One thing you could do to tidy it up is consolidate the pins to a string as below (recheck these pinouts, most likely errors exist!)

    You want to avoid "shoot through" so maybe you should turn all outputs off before the next string, but you can try it without the commands. I would test with Leds via 200-470 ohm to GND on all 6 outs to get a visual of the sequences before trying the motor driver. Let us know if LEDS work in the correct sequence so as to rule out your program.

    Seq VAR OUTA 'pins 0, 1 , 2, 3
    Ena VAR OUTB 'use pins 4, 5 for Ena
    PauseTime VAR NIB

    DIRS = %0000000000111111 ' sets pins 0-6 to outs


    Main:
    PauseTime = 20

    Do

    Ena = %1000
    Seq = %0100 'recheck all these pins visually with leds
    Pause = PauseTime
    Seq = %0000

    Ena = %0100
    Seq = %0001
    Pause = PauseTime
    Seq = %0000

    Ena = %1000
    Seq = %1000
    Pause = PauseTime
    Seq = %0000

    Ena = %0100
    Seq = %0010
    Pause = PauseTime
    Seq = %0000

    Loop
  • GManGMan Posts: 19
    edited 2006-08-12 14:56
    I've hooked the LED's to the stamp again, completely removing the H-Bridge chip.· The LED's light in the sequence anticipated.·

    So, when seperated, each piece functions as one would expect.· That means this comes down to the connection itself between the H-Bridge & the stamp.· In some way, just wiring output to input doesn't do the trick.· Is there some rating in the H-Bridge Chip's characteristcs (attached) that the stamp doesn't meet?
    512 x 400 - 57K
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-08-12 15:46
    Gman -

    I'm not doubting your wiring ability, or your ability to read a schematic. However, that being said there is a potential nasty GOTCHA in the Typical Appilcations wiring diagram in the data sheet. I only caught it because _I_ read it WRONG at first.

    I can envision someone else also reading the schematic to show that ENB is connected to GROUND. You haven't done that have you?

    Also, do you have SENSE A and SENSE B tied to the motor ground (Vmm) as indicated?

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • GManGMan Posts: 19
    edited 2006-08-12 15:54
    Nope, ENB is connected to the stamp (pin 8) and SENSEA & SENSEB are tied to ground. Yeah the chip outline on the schematic could lead one to think that ENB is supposed to be connected to ground.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-08-12 16:16
    GMan -

    Here's another stab-in-the-dark. What DC voltages are you reading between these points:

    Vcc --> Ground

    Vmm --> Ground

    Stamp Ground --> H-Bridge Ground

    Since this has happened more than one recently with oddball LED's, your LED's are properly oriented (polarity) aren't they?

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • T ChapT Chap Posts: 4,223
    edited 2006-08-12 17:47
    Gman Are you using a battery operated Stamp? If so by chance, could you try it with an AC adapter. Beyond that, if there is some current issue that is preventing the Stamp from turning on the Hbridge(small chance), do you have any transistors around that you could buffer with? An even easier solution would be a cmos 4050. Just run those straight inline between the Stamp and the Hbridge as they will deliver more current that the Stamp, I am guessing around 200 milliamps. That would be my very next step. If no 4050s, you could try an some other gates.

    Post Edited (originator99) : 8/12/2006 5:51:19 PM GMT
  • GManGMan Posts: 19
    edited 2006-08-12 19:31
    Initially I was using a seperate 9V battery to power the stamp, but I've since just swiped my power from the same supply that I was using for the HBridge (a 1.3AH 12V battery).

    "do you have any transistors around that you could buffer with?"

    I have·a lot of the standard general transistors (i.e. 2222, 3906, 3904, 3907)· I also have mosfets (N&P CHannel IRF520 & 540's) and darlingtons & darlington arrays.

    What I don't have lots of are·the 4000 or 7400 series chips.· My selection there is pretty limited.

    So pick your poison...· What do you suggest?


    **EDIT**

    Actually after looking, I did find a few 4049's (Hex inverting buffers)· So I droped one of those on the breadboard to buffer the stamp's output along with a 7805 to provide plenty of 5V power from the motor supply for the buffer.· I then inverted the program's logic (i.e set all highs to lows and lows to highs).· Unfortunately that didn't wake this thing from it's slumber either.· I was able to trace the signal through the buffer and everything looked alright (I slowed the phasing way down), but there still wasn't any power coming off the H-Bridge to the coils.

    Post Edited (GMan) : 8/12/2006 8:15:30 PM GMT
  • T ChapT Chap Posts: 4,223
    edited 2006-08-12 21:22
    You could always just hook up two 4049's in series and leave the logic alone. Anything now is just guessing on my part. The data sheet shows what appears as its own buffering prior to it's transistors. It also shows typical input at 5 volts, which you have supplied via a straight wire and it worked right? IF you are giving it 5 volts from the Stamp and it doesn't work (assuming your program is good) , then there are only two options in my mind: not enough current to turn it on, or GND's aren't connected if using different supplies. I think you addressed the latter already. Try not using the battery, jumper the adapter back to the Stamp as well so that will eliminate the battery as a low current culprit. Try 5 volts on the bridge supplies as well for a test. Try the rail via a 7805 from the adapter as Vdd and Vss on the 4049's. I say this assuming the Stamp is on a demo board and has it's own regulator.

    Start from scratch with one test at a time, Make INA1 High from the Stamp, and INA2 LOW from the stamp and leave it there while checking both the Stamps output (read the +lead off INA1 input and -lead off INA2). Then read the hbridge outs OUT1A and B. Try a combination of ENABLES from the Stamp and from hard wires to + and GND as needed. It looks like the Enables are just inputs to an internal AND gate, so they should be HIGH to operate. Make sure all senses are at GND.

    I wonder if the Vcc should go to +5 as well, maybe there is something missing there besides just thermal. The reason I suggest it is there is some logic going on possibly in the buffering internally. Can't hurt.


    ***Data sheet shows minimum Vcc is 4.75, lets try that first if you have been letting it float**

    Post Edited (originator99) : 8/12/2006 9:26:26 PM GMT
  • GManGMan Posts: 19
    edited 2006-08-12 22:49
    Ok, I've gotten it to work. Here's the deal!

    The Vcc connection does need to be hooked up. When I connected this to the +5v supply attached to the 4049 the stepper started stepping! So then I eliminated the 4049 and hooked the H-Bridge's VCC up to the stamp's Vdd, reconnected INA1, INA2, INB1, INB2, ENA & ENB back up to the stamp (I'm usin the OEM board BTW) and downloaded the non-inverted version of the code. Guess what happened... It steps! So in short the solution goes like this. The Vcc connection needs to be connected even if the datasheet says it doesn't.

    With that small documentation problem eliminated... These appear to be some pretty good little H-Bridge chips, especially at the low low price of $4.80 each!
  • T ChapT Chap Posts: 4,223
    edited 2006-08-12 23:25
    Well thats good news, I am not sure where you got off the data sheet that it didn't need to be conected but no matter, at least it goes! Have fun. Pretty neat part to handle 1.5 amps. I wonder if you could parallel 2 and get 3 amps. Do you detect any heat?
  • GManGMan Posts: 19
    edited 2006-08-12 23:39
    "I am not sure where you got off the data sheet that it didn't need to be conected"

    It's not connected on the schematic.

    **Edit**
    After running this thing for a while, the only heat I'm finding is coming off the voltage regulator on the BS2.··So perhaps it's best if the stamp's outputs are buffered.

    Post Edited (GMan) : 8/13/2006 12:11:36 AM GMT
  • T ChapT Chap Posts: 4,223
    edited 2006-08-13 00:30
    The hbridge shouldn't be drawing any serious current at its logic input. You could stick the sreial 4049s back in though. I hope someone more experienced might chime in on whether these can be paralled for 2x current (3 amps total). That would be very nice.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-08-13 02:26
    GMan said...
    "I am not sure where you got off the data sheet that it didn't need to be conected"

    It's not connected on the schematic.

    Yes it is, it's on the one you uploaded (HBridge.jpg).· It doesn't show a "wire" coming off it, but it's labelled so (VCC).· It's not the most apparent style, but it's there.· Best of all: you found it and you did it without using a cry-baby emoticon (*****).
    The heat on the 7805 is the result of: ( VIN - VREG_OUT· ) X ILOAD.· [noparse][[/noparse] P = E X I ]·

    Post Edited (PJ Allen) : 8/13/2006 2:30:13 AM GMT
  • studysessionstudysession Posts: 66
    edited 2006-08-13 02:31
    You know this thread inspired me to go out and try some of this. I went to Radio Shack and got some bits and now trying to put it all together. A lot of people here make it all sound easier than it seems to be though. A lot of great info here and it is very helpful watching everyone help diagnose the problems here.

    Thanks for the info.
  • GManGMan Posts: 19
    edited 2006-08-13 03:30
    Just a thought here...· Could I not kill two birds with one stone?· Use optocouplers to isolate the stamp's outputs from the H-Bridge chip & motor noise and relieve the stress on the stamp's onboard voltage regulator, by using the photodarlingtons to toggle 5v provided by a 7805 on the HBridge side of the isolators.· I mean I have a whole mess of 4N29's laying around...· Any suggestions for what that circuit would look like?· Perhaps something like the attached diagram?
    373 x 288 - 10K
  • T ChapT Chap Posts: 4,223
    edited 2006-08-13 04:20
    Personally I don't think you are reducing any load by adding an LED, which would likely be more load. But yes, you could always buffer with an opto exactly as shown. Use 10k on the out to hold it low, 220-470 on the led. If you want to get fancy, put your meter in milliamp mode, put positive lead to the Stamp pin, the negative to the hbridge(with a steady signal, not a pulde) and read what it says. The put an led and note the difference. Then pick a route. You could just as easily put in a resistor between the Stamp and the Hbridge and reduce current there as well, as long as it turns on the hbridge completely and doesn't slow things down, you have spared yourself some id's and time.

    note: some meters require you change the cables to a different hole to read amps.

    note 2: it is generally understood that any Vss,Vdd,Vcc, Gnd etc are to go somewhere regardless of schematic implications, unless otherwise and specifically noted to the contrary.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-08-13 04:46
    Gents -

    As I said earlier the draftsman who drew that chip schematic should be SHOT! If you believe the drawing, Vcc is connected PHYSICALLY INSIDE THE CHIP, and not to anything EXTERNAL. The physical connection to what SHOULD be "outside", is INSIDE the outline of the chip. I can see exactly how GMan wa sucked in by that one.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • T ChapT Chap Posts: 4,223
    edited 2006-08-13 04:57
    Yes, the drawing is bad, agreed.

    I only piked it up since there is logic going on inside the chip that requires a fixed Vcc, and doubting there is a regulator inside to set a voltage derived by the bridge transistor Voltage Source, there must be some other power requirement to operate the logic.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-08-13 07:30
    Gents -

    For many reasons I can't get excited about this NJM2670 chip at all. Here are just a few of the reasons.

    For less than $3.00 US, in one-off quantities, you can purchase the L298 which is good to 4 amps, can have its outputs parallelled (per the documentation), has USABLE SENSE pins, the schematics and documentation are complete, and unambiguous, it comes with a built-in heat sink, it has a proven world-wide track record, it's available from multiple manufacturers, and it's readily available from most distributors.

    What's the point of the NJM2670, after learning all that- frustration?

    Attached, please find a data sheet for the L298.

    Regards,

    Bruce Bates
    L298.pdf 595.4K
Sign In or Register to comment.