again L293 and Arduino

Hi,
After interfacing L293 and Arduino the datasheet way, I went for something better and I found this schematic from ebay:

What I like in it is that it uses only four LED as diods to avoid back EMF (right?). In my previous experiences, for every output of L293 I put a diod from GND to the line and from there to VS. So I used 8 diods and now with 4 LEDs, I considered having light that signals the direction when using a red one for CW and a green on CCW turning.

It didn't happen for me :frowning:

Before going for CNC-ing the PCB I assembled on the breadboard and connected one side of the L293. I enabled pin 1 and passed high to input 1 and low to input 2, then reversed. The interesting thing is that in one way, both LEDs are ON, and the other way both OFF, while I expected that they must alternate for different directions.

Now two questions:

  1. Please tell me if I am wrong in something or I must change the schematic somehow (how?)
  2. If it is ok to simply change the NAND there to a simple sn54ac04 hex inventor?

Thank you :smiley:

  1. If it is ok to simply change the NAND there to a simple sn54ac04 hex inventor?

Yes.

What I like in it is that it uses only four LED as diods to avoid back EMF (right?).

No that is just a direction indicator it provides no back EMF protection, that appears to be missing.

Thank you Mike, I thought they won't miss protection components on a commercial shield (naive ideas).

So any explain on why both LEDs go on for 1 dir. and then when reversing, both go off?

Could you please tell me if the schematic is at least right on implementing direction LEDs theoretically? (then I can be sure my breadboard circuit has a problem).

So any explain on why both LEDs go on for 1 dir. and then when reversing, both go off?

I would but I couldn't follow how you wired it up, can you post a schematic of it.

Apart from the protection it looks OK. It is just that you are not going to get any flywheel breaking when you turn the motors off.

I wired it exactly as the schematic, on a breadboard (if all ok I'm going to cnc-machine it) with many wires so even taking a photo won't let see clear through. I only excluded CAPs there, as long as I know they work as filters so that should not effect on direction LEDs (right?).

I suspect that my L293B chip is a damaged one, because when I simply enable it (no MCU involved) and load VS with 12v, on one side (channel) I get 12v on every output (no input high) and on the other I get a 12v on one out but on the other, 3v. I think that means the chip is not on 100% health (used one, on other projects it was heated some).

I wired the test only on one side of my chip, where voltage test appears correct (i.e. with a 12v into VS, I either get 0 or 12v, if input1_XOR_input2 = false).

If this information is not enough to get the help, I will draw the breadboard setup, may be fritzing, and upload but the result will be the same schematic (I don't suppose I have a mistake in connecting them by wire as I did it slowly with step by step and TDD).

So you are saying that the motor changed direction but both the LEDs went off or on depending on the direction?
If so you must have wired up one of the LEDs the wrong way round.

I'm really confused here, I checked for many times and in 2 days (after resting my brain) but results are the same:

  1. If I wire the schematic just as it is, it won't work as expected: LEDs are both on or off when changing directions.

  2. If I do the change you see in the following link, it works as expected, with LEDs being one on and the other off when changing directions.
    the change:
    http://i39.tinypic.com/1qfukx.png

I can't explain it why, as the original schematic seems ok, but won't work! Could you please explain the principle?

So basically 1 is right and the diagram in 2 is wrong.
But you say when you wire it up as 2 it works. This suggests that you have misidentified the anode and cathode of the LEDs.

Could you please explain the principle?

Quite simple, the output of a H-bridge is either high or low. In order to make the motor turn one output is high and the other is low. With the LEDs connected anode to cathode to one output and the other ends through a separate resistor to the other output, there will only be one LED on at any time. The LED that is on will be the one whose anode is high and cathode is low. The other will be off.
In the second diagram you have both LEDs with there anodes to the same output and both cathodes to the other output (through resistors) therefore only in one direction will they be both on and the other direction they will be both off.

You have made a wiring mistake where by you think you are wiring up diagram 1 where in fact you are doing what is in diagram 2, and vice versa. Maybe you would not make this mistake if you swapped the order of the LED and resistor for one of the LEDs so you could clearly see you were wiring anode to cathode on one end.

Thank you Mike, like always crystal-clear explained!

There is one more thing about the LEDs I'd like to ask:

I stayed some confused in the whole concept, then I used my green and red 3mm LEDs on another schematic and again strange results.

I inspected the LEDs: one of them has the flat part of head at the side of the short pin, and the other on the side of long pin! As long as I know (if right), Cathode is the shorter leg, but I was defining it by the place of flat on head...now I see I have two similar LEDs, only their color different, but one has flat at the side of Cathode, the other on Anode.

Could this be a mistake of LED production, or a standard? I read in Wikipedia that flat is at the part where Cathode is!

The picture showing flat around the head on Wikipedia:

Marking on components is not always standard, you need to see the manufacturers data sheet.

Thank you, I have one more question on this schematic:

Why 100k resistors are used on input lines from Arduino, while I don't see them on other similar schematics available online?

They are being used as very weak pull down resistors to ensure a logic zero input when there is nothing connected. However they are way too small to be effective and can be safely left out.

I machined the pcb and soldered components, I connected two 12v small motors and a 12v@7Ah battery (charged), and I see that the voltage drops around 9v and motors turn very slowly. I excluded the pcb and connected motors directly, the change in speed is big.

Also, before this with tests when connected L293 and only protection diods, these motors work enough fast. I think those lots of components (pull downs, LEDs, many caps) eat a lot (right?).

Questions:
Without losing protection and in addition to pull down resistors and LEDs+resistors, what else could be removed please? (may be too many caps of filtering there?)

(may be too many caps of filtering there?)

No.

Why the obsession with removing stuff? It is not a recognised fault finding procedure.

and I see that the voltage drops around 9v

What voltage?
Measure the voltage from ground to one end of the motor, from the ground to the other end and from the ground to the power in of your L293 chip.

What are you feeding it with in the way of signals?

Im new to the site but feeling helpfull tonight. The way I check an LED is to hold it up and look in the side of it (not always possible, but usually) the anode side is a triangular shape that resembles an A. A for anode. The cathode side is usuallys roughly twice the size of the anode side but diffrent shape. Hope that helps in the future.

Grumpy_Mike:

(may be too many caps of filtering there?)

No.

Why the obsession with removing stuff? It is not a recognised fault finding procedure.

and I see that the voltage drops around 9v

What voltage?
Measure the voltage from ground to one end of the motor, from the ground to the other end and from the ground to the power in of your L293 chip.

What are you feeding it with in the way of signals?

So caps will stay and 100k resistors will be removed. I will again connect the circuit, measure as you instructed and report the results...

What are you feeding it with in the way of signals?
I absolutely didn't understand this phrase. My English is not native and sometimes I feel really sorry for it)
Could you please rephrase?

bFORTIFIED:
Im new to the site but feeling helpfull tonight. The way I check an LED is to hold it up and look in the side of it (not always possible, but usually) the anode side is a triangular shape that resembles an A. A for anode. The cathode side is usuallys roughly twice the size of the anode side but diffrent shape. Hope that helps in the future.

I appreciate answering the post!

What are you feeding it with in the way of signals?

How are you connecting your circuit up to the arduino and what logic levels are you making the arduino produce.

Thus you are feeding signals from the arduino into your circuit.

Hi,
I paused for somedays on this and got to designing my own ATmega168 driver so I can burn bootloader and have a big family of Arduino boards) Still no success in burning booatloader :frowning:

Back to L293 driver, I checked it again and this time disconnected Arduino at all and just loaded same 5v using to drive the chip to its input of each side when testing.

The result:

  1. I used a charged battery of 12v@7Ah, and I read 10v out of each channel, from the GND of the battery
  2. I removed the L293 from my CNC-machined PCB and removed feeding 5v to all enable pins and inputs, so no input to the board. I expected that know if I measure each pin of the ic socket (a DIP16) I have to read a 5v on VSS and 12v on VS and also 0v on all other pins. To my surprise, I have 5v on VSS, and also on 2 of inputs.

I used the schematic and designed the board in Eagle and many times checked everything. Also, I used auto-router for now (being a newbie) to not to mistake. Seems anyway there are mistakes.

I will redesign this board and get the HEX inventor out, get all LEDs/resistors of them and resistors of input lines out. Next I will redesign my Arduino DIY board and put the HEX inventor there, feeding it with those digital pins that are not PWM, so I will always have this option of using 1 pin as 2, on my Arduino board, and leave the L293 as simple as possible for it is my first version.

Please if there you see any other consideration I must know tell me for machining the new L293 driver board and the Arduino DIY board. Thank you! :slight_smile: