Maker Pro
Maker Pro

Do I need to put resistors between Arduino outputs and H-bridge + some theory

Alchemist_Anonymous

Nov 7, 2014
3
Joined
Nov 7, 2014
Messages
3
Do I need to place resistors between Arduino outputs and H-bridge + current protection theory

Hello to All.

I’m currently building a motor driver circuit based on the L293B. I have a few questions regarding this circuit. While all these questions stem from a practical application, I’m also trying to understand the underlying theory. I am a hobbyst/beginner, so please be patient if some of my questions seem very basic/stupid to you. I’ve been googling for a week about this stuff, but could not find clear answers for my questions. Here is my circuit:




1. Is it a good idea to place resistors between a microcontroller and some other IC?

I can understand simple circuits consisting of a single voltage source and a few resistors/transistors connected in series and parallel. What puzzles me is how these things work when you add a microcontroller and another IC. What are the levels of current involved in communication between an Arduino and my motor driver IC? I’ve looked into CMOS and TTL, read the datasheet for the driver, but could not find specific information about typical current sink/source levels only about voltage levels and the corresponding logic. I know that the Arduino’s limit is 40mA per output pin, and resistor’s of 470 or 1K Ohms are recommended to protect the outputs, that’s why I’m using R1, R2, R8 and R9 in this circuit. Do I really need these? What happens to the inputs if a motor driver IC fails due to overcurrent? Does it fail short or does it fail open? Would these resistors add to the power consumption of my circuit, and if yes, is their impact significant?

2. What happens if the current through a resistor is lower than the calculated value for a given voltage?

In a simple battery+resistor circuit with a fixed voltage the resistance determines the current. But what happens if the current is lower than this calculated value for the resistor (can this happen)? (Example: a 1K resistor would allow through 5mA of current in a simple 5V circuit, but what happens if it is placed between two ICs which use a lower level of current for communication, like 1mA or less?) Does the resistor have any effect on currents lower than the current calculated for the given voltage level? Is there any power dissipation (wasted energy) when a resistor is in the path of a current lower than the resistor’s current calculated from voltage?

3. How can I (do I really need to) calculate the correct resistor values for R3 and R4 (for the transistor which is used as a NOT gate)?

I’ve chosen 1K for R3 as a general value that limits the current through T1 to a safe level of 5mA. The base resistor is again picked as a very general approximation. Minimum Hfe for T1 is 110, so theoretically I do not need more base current than 0.05 mA. The calculated R for the base resistor is 100K, but it seemed a rather high value, so I’m using 10K. Are these values OK? Do these values have an impact on the input on the motor driver IC, or if I give enough base current for the transistor to saturate, the base/collector resistors do not really matter?

4. Adding a capacitor between the motor terminals.

I’ve omitted a small (100 nF) capacitor usually placed between the motor terminals, because if I understand correctly, it should be placed as close to the motor as possible. However, I have some motors which are inside a mechanism I cannot open without breaking, so I do not know, if they have a capacitor between their terminals, or not. Does it make sense to add a capacitor on the motor output pins of this circuit? What happens, if later I connect a motor which already has a parallel capacitor? Could this cause problems, or an extra capacitor does not matter?

Thank you all for your patience, I know this is a long post. Your input is much appreciated.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Is it a good idea to place resistors between a microcontroller and some other IC?

If the impedance of the "other IC" is high (as is typical for logic inputs) then you typically would not. If you are connecting to something of low impedance (such as a transistor or a LED) then you typically use a resistor to limit the current. If you are using something that requires a lot of current (e.g. a motor) then you typically use a transistor or similar to provide the required power.

In your case R1, R2, R8 and R9 are not needed.

2. What happens if the current through a resistor is lower than the calculated value for a given voltage?

Then you have violated Ohms Law and will have to go to jail, go directly to jail, do not pass GO, do not collect $200.

Seriously, the current through a resistor is determined by the voltage across it and the resistance. Things get complex if the resistance is significantly non-linear, but in that case we would say that the resistance has changed.

In your example, the voltage across the resistor is no longer 5V, so the current is proportionately less.

3. How can I (do I really need to) calculate the correct resistor values for R3 and R4 (for the transistor which is used as a NOT gate)?

You need to know the input current required and the input voltage and ensure that the resistor (R3 for example) will correctly work as a pullup. The base resistor needs to be chosen such that the transistor can pull down against this resistor and sink sufficient current to get the input to a low logic level. Looking at the input specs for this device, you're looking at currents typically less than 0.1mA, so choosing a resistor for R3 that would allow 1mA at 5V (say 4k7) and a resistor 10 times that (47k) for R4 seems reasonable.

Lower values will generally allow the device to operate faster.

4. Adding a capacitor between the motor terminals.

Put the capacitor as close as practicable. If that means on your board, then that's where it is. If it's on the terminals of the motor, even better. You can only do what you can do. An extra 0.1uF will not matter.
 

Alchemist_Anonymous

Nov 7, 2014
3
Joined
Nov 7, 2014
Messages
3
Thanks (*steve*)!

Re 1+3+4 - That solves all my practical needs, thanks a lot.
Re 2+3:

3.1. You refer to the datasheet of the device. Am I correct in assuming, that the value I should be looking at for determining input current is the one stated as "High Voltage Input Current"?

2.1 One last detail to clarify: How could I imagine/represent a typical IC in terms of simple circuit elements? Could I approximate an input as a very large resistor, while an output would be a voltage source? (Obviously in a very simplified way).

Further blabla:
After reading your answer I've done what I should have done before asking: I've measured the input voltage on the IC using different resistors, and indeed the voltage drops whit increasing resistance - Ohm's law is respected even by ICs.

What got me confused is that digital signals are supposed to be 1 or 0, that is 5V or 0V. However they only should be, they are not guaranteed to be if you put a resistor in their way. The other thing that confused me is the hydraulic analogy - I've imagined a resistor as a bottleneck - when low current flows, the rate of flow (=I) is low. However I did not take into account that the "pressure" also drops (V becomes lower).

Impedance still seems a somewhat mysterious concept to me, however I gather that in practical terms in a DC circuit it basically means the total resistance of the given circuit at the input. This high impedance/resistance limits the current, this is why there is no need for external resistors.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Both the high input current and the low input current could be important. But, you are not likely to find a logic input that requires anything near the current that your Arduino can put out.

Digital signals are 1 or 0 if they are within pre-defined boundaries defined by the logic family. For example TTL requires a voltage of < 0.8V to be interpreted as low and a voltage > 2V to be interpreted as high. Any voltage in between causes undetermined behavior.

An input can be (simplistically) characterized as a resistor in parallel with a capacitor. The capacitor comes into play when you put a resistor in series with the input. It will create a delay when the signal changes, the higher the resistance, the longer the delay.

An output can be (simplistically) characterized as a voltage and a series resistance.

Bob
 
Top