2 Bit Motor Controller Weirdness

 

Hello,

I was wondering if some of you guru's could provide some insight as to why (what I thought was simple) motor controller is not preforming correctly.

The problem is, the direction bit is failing.  Or one motor's direction bit... the other is working fine.  I switched direction lines to data pins and now it's all crappy (damaged BBB now?)

I'm wondering if its a problem of not enough current from the BBB board, which leads me to another question....    Anyone have experience on over-sourcing the pins of a BBB board?  Is it now all burned up?

Unfortunately, it will take time to unpack it all and do a decent amount of diagnostics.. 

Here's another question ... How do I determine the maximum amount of current the BBB data pin can source, AFTER I have possibly damaged it, without damaging it further (obvious answers like RTFM will not be accepted at this time) ;D

 

2 bit F&#(@ ! -  just switched them back and now both direction control lines will not work - both motors will go forward but now (since I switched the bad (right side) with the good (left side)) and now switched them back - they both will not go reverse... only forward..   It appears that it is contagious (yarg) !

 

3_elect.jpg

 

 

 

Motor Driver Schematic

 

Something wrong with the pic

Something wrong with the pic links, I can’t see them…

I really need to see how the lines are connected from the micro to the H-bridge and the way your code tries to tell the H-bridge what to do.

On my boards, I’m using the SN754410 H-bridge. I have the Enable lines tied to 5V, then one of the input pins is connected to the direction pin and the other input pin is connected to the PWM pin of the microcontroller. On the microcontroller, in Arduino I set all motor pins to Output.

The digital truth table is like this:

DirPin:      PWMpin:   Enable:      Motor:

Low          High          High          Forward
High         Low           High          Reverse
High         High          High          Braked
Low          Low          High          Braked
X              X              Low           Coast

(X means any state) 

If the DirPin is Low, a PWM signal of 255 will be equivalent to a digital High, so the motor will turn Forward. If the DirPin is High, a PWM signal of 0 will be the equivalent to a digital Low, so the motor will turn in Reverse.

 

If you have used an inverter (transistor or gate) to invert the direction signal for the second input pin and the first input pin receives the non-inverted signal and you PWM the Enable pin, then the motor should turn one way for a High direction signal and turn the other way for a Low direction signal. Also, the motor will turn when the Enable line is High, so for a PWM signal of 255 (255 for Timer0 and Timer2 and 1023 for Timer1) it will turn with the max speed and for a PWM signal of 0, the motor will coast (not breaked). 

To troubleshoot, you need to set the pins in software (to Output, the High and Low) and use a DMM or O-scope to check the signal at the H-bridge pins. Use a Digital signal first, if it works properly, then use a PWM signal. If an inverter is used, check to see if it does it’s job and really inverts the signal. 

Good luck and let us know what was wrong!

Pictures should work now…

Here’s a link to the schematic https://www.robotshop.com/letsmakerobots/files/userpics/u152/ska_3_png.jpg 

I “thought” it was really simple, and the setup would prevent shoot-through.  I am PWM’ing the enable lines.

Hmmm you must have different components set up on your board.  

Wow, you hooked it up completely different (I think) … uh my head is spinning…   

To me the simplest idea I can digest is… you have 1 bit for direction and 1 bit to PWM … the truth table is like this

DirPin:      PWMPin (Enable)   Motor
High         High                       Forward
High         Low                        Coast
Low          High                       Reverse
Low          Low                        Coast

No? 

 

 

Mixing GND and +6V ?

The board positive voltage comes off 4 1.5V Batteries (6V)

The Arduino clone uses the same battery pack - so it regulates its control lines to 5V … but your saying I probably fed 6V back onto the control lines through the transistors/resistors I was using for direction?

Your truth table is good.

Your truth table is good. You don’t have braking capabilities, but you might not need them, as the robot will stop anyway. Now that I see your schematic, I can give you the same advice the others already gave you. Tie the Vcc2 to 6V and Vcc1 to 5V (regulated). Transistors should also be tied to 5V. Also swap the base and collector resistors. Other than that, it should be good. But there is another schematic on LMR that allows you to use braking by setting the 2 control bits to input (tristate) - see this: http://www.societyofrobots.com/member_tutorials/node/161

Update

Thanks you elite hardware guru’s !

All three of you were right.

I added fresh batteries and viola - it began working again perfectly.  

Now, I believe that since the direction line is not running off of the regulator, as the batteries dropped voltage, the direction would get stuck in a low state.

But of course I still have questions.

I hooked a measuring thingy up to the direction line - and in its “working” state I can see

Arduino pin 7 Low  -> attached > JP3 - pin 4 in schematic - 0.58 V measured -> will make the motor go forward
Arduino pin 7 High -> attached > JP3 - pin 4 in schematic - 1.58 V measured -> will make the motor go reverse 

So, why is the voltage at this point so low?

I will split the VCC and regulated off

Thanks for the help

Your motor driver should

Your motor driver should have no influence of the voltage, if you measure between JP3, pin 4 and GND. How is the high/low state of your Arduino defined?

0 to 5v

Have a bad feeling about this.

The Arduino gives 0 to 5v on pin 7 unconnected

Connected the measurement at this point is (as mentioned above) 0.58V (when Arduino is 0) and 1.58V (when Arduino is 5v) 

The right side is not functioning again too…

Is it time to make another Motor Controller with VCC2 only connected to battery?  

Do I need a separate 5V regulator - or would the BBB’s be sufficient ?   I was trying to do this with the minimum amount of components… I’m asking as I’m reading … it has a TO-92 250 ma regulator, I was planning to do servos too so … no way :stuck_out_tongue: … time to get a regulator…

Alright I guess the only questions I have at this point is:

  • Is strange voltages at the input a common sign of a bad controller?
  • I plan to put together another motor-controller board - but slice the trace to VCC2 and solder on another jumper pin - Is this what one of you hardware guru’s would do?

It is time

I would say your L293D has a problem, get a new one. The voltage drop is not normal, a sign for too high current on the motor driver input. Your Arduino can handle a few mA, if the current is too high, the voltage drops. Additonal you can test the output of your Arduino. Connect to a LED with a resistor (220R) and check if you can switch the LED still on and off in setting the pin high and low. If yes, lucky, if not, get a new one.

And yes, simplest method would be to slice the trace to VCC2, drill a small whole and add another jumper pin.

Rather than de-solder

I put together another 754410 board.  And I changed out the atmel chip of the BBB.  Now, the motor “sticks” at first PWM sent.  YARGG !   

OK,  I believe 1 chip H-bridges and myself DO NOT get along for some reason.  In the past, I’ve built many small and even large (60 amp) H-bridges… but these little 1 chip deals are giving me nothing but grief.

Instead of giving up, I’m making a PCB for a “mini boa” h-bridge which uses a DPDT mini relay and a Tip 122.  I would appreciate any comments or opinions on the new design.  I know a diode is often used on the coil of the relay, but is that necessary for this little bitty thing?

 

mini_boa_schematic.png

mini_boa_jpg.png

 

Without studying your design in detail…

I’d like to share a wise lesson from my frustrating days with LD293. Pull all your inputs down or up as appropriate. Floating inputs will present you a slew of mind puzzles. As will removing one of the two power supplies.

Don’t give up!

Have you changed the values of R1, R2, R3 and R4?

Have you checked if the transistors are connected in the right way?

PS: Protection diode is necessary. The relay coil can create voltage spikes of a few hundered volts which can destroy your relay driver transistor. Just use a 1N4148 or a 1N4001.

Nothing was left floating…

Nothing was left floating… Nothing disconnected…
I think me and the one chip wonders just don’t get along… 

Less is More !

I am soooooo done with 754410 and other 1 chip motor drivers (at the moment).   You guys with good hardware karma can have them ! 

Made a mini-boa driver, and it would seem that at a comparable price of the 754410 I can get 5A out of this puppy !   I toner-transfered, populated, and solder these guys, and guess what ?   THEY WORK !  Oooh, notice the hacked-in protection diode too.  I may not have good hardware karma, but I want good hardware karma :slight_smile:

So 5Amps … for such a little guy.  The 5A is for the TIP 122, but I don’t think the relay has that high of rating, but I am guessing that the rating for the relay is for switching when loaded.  If the software makes sure there is no current running through the relay when direction is changed I “think” I’m good !

boa__1_.jpg

Looking good!

Just remember that those TIP-babies will eat a whole lot of voltage!