Microcontroller Interfacing –  Part 2

Basic Electricity Review

  

Goal

This section covers some basics of electricity. It is assumed that the reader has a basic knowledge of electronics and this is a quick review.

Ohm’s Law  

Figure 2-1 shows the simplest circuit possible. It consists of a voltage source and a single resistor.  The voltage source is DC in this case. Unless otherwise noted, we will be dealing exclusively with DC voltage in this series.  In microcontroller circuits, the power source will usually be a power supply or battery.  In most cases the voltages we will be working with will be 12 volts or less.

With a given voltage (V) and resistor value (R), a given current (I) will flow.  A simple equation, Ohm’s Law, gives the relationship between voltage, resistance and current.

V = I * R

Simple algebra lets us manipulate the equation to solve for the unknown variable.

I = V/R      or   R = V/I  

In Figure 2-1, if we know our voltage source is 5V, and we have a 1000 ohm resistor, we can calculate the current in amperes.

I =  V/R  = 5/1000  = .005 A,  more often stated as 5 ma.

In designing circuits, we often have a given value for one parameter of V, R, or I, and a desired value for one of the other variables.  The goal is to select the remaining component to give provide the desired value.  For example, suppose we have a 12 V battery, and want 65 ma of current. What resistor value do we need?

R = V/I = 12/.065  = 184.6 ohms

Now, finding a 184.6 ohm resistor is going to be difficult, but fortunately in most cases  you do not need (and are unable) to get that sort of precision. The closest standard 5% resistor is 180 ohms.  If we use a 180 ohm resistor, and it is right on 180 ohms (it won’t be),  we will get the following current.

I = V/R = 12/180 =  .067 A, or 67 ma.  In most cases this will be close enough.  

Figure 2-1

Voltage Dividers

Figure 2-2 shows a slightly more complex circuit, one that has a voltage source and two resistors.   There are several points to illustrate with such a  circuit. The first is that resistors in series have a total resistance equal to the sum of the individual resistances. 

What would the current be in the circuit shown in Figure 2-2 be?  Since the two resistors could be substituted by a single resistor with a value equal to the sum of the two, Ohm’s Law states

I = V/(R1 + R2)

The other important point is to realize the there will be a voltage across each component in the circuit. If  you put a voltmeter across the power source you would read Vs.  Measuring across R1, you would measure voltage V1. Voltage V2 would appear across R2. 

Note the polarity of the voltages with reference to the arrow indicating current.  The ones across the resistors are opposite polarity of the voltage source. This is because the net voltage around the loop must be zero. Mathematically, the voltages follow this equation:

Vs = V1 + V2

So, what are the voltages V1 and V2?  That depends on the ratio of the values of R1 and R2. The voltage across a resistor will be proportional to the value of that resistor compared to the total. The following equations apply:

V1 = Vs* R1/(R1+R2)     V2 = Vs* R2/(R1+ R2)

If we had three resistors in the circuit, the following would apply

V1 = Vs* R1/(R1+R2+R3)

  

Suppose Vs = 12V, R1 = 1200Ω and R2 = 2400Ω. What is the voltage across each resistor?

V1 = Vs* R1/(R1+R2)     =  12* 1200/(1200 +2400) = 4 V

To calculate the voltage across R2 we could use the equation for V2 or we could apply the knowledge that the total voltage across the loop must equal 0V.

  

Vs = V1 + V2     -->  V2 = Vs - V1 =  12- 4 = 8V  

Summary

Designing interface circuits to microcontrollers requires some simple mathematics.  Understanding Ohm’s Law and voltage dividers will cover a large percentage of the situations for simple circuits.

  

Figure 2-2

© 2009 - 2022 Gary C. Sutcliffe

  

Created with the QTH.com SiteBuilder.