Handout

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Basic Electronics Handout

RoboCamp 09 IRC, IIIT Hyderabad 1


Contents

1. Basic Logic Gates

2. Op-amps

3. Ripple Counter IC

4. BCD to 7 segment display driver

5. 555 Timer IC

6. H-bridge

7. AVR Microcontroller

RoboCamp 09 IRC, IIIT Hyderabad 2


1) Basic Logic ICs

● There are several families of logic ICs numbered from 74xx00 onwards with
letters (xx) in the middle of the number to indicate the type of circuitry, eg
74LS00 and 74HC00.

a) 74LS family TTL characteristics:

● Supply:

○ 5V ±0.25V, it must be very smooth, a regulated supply is best.


○ In addition to the normal supply smoothing, a 0.1µF capacitor should be
connected across the supply near the IC to remove the 'spikes' generated as it
switches state, one capacitor is needed for every 4 ICs.

● Inputs:

○ They 'float' high to logic 1 if unconnected, but do not rely on this in a


permanent (soldered) circuit because the inputs may pick up electrical noise.
1mA must be drawn out to hold inputs at logic 0.
○ In a permanent circuit it is wise to connect any unused inputs to +Vs to ensure
good immunity to noise.

● Outputs:

○ They can sink up to 16mA (enough to light an LED), but they can source only
about 2mA.
○ To switch larger currents you can connect a transistor.

● Fan-out: one output can drive up to 10 74LS inputs, but many more 74HCT inputs.

● Gate propagation time: about 10ns for a signal to travel through a gate.

● Frequency: up to about 35MHz (under the right conditions).

● Power consumption (of the IC itself) is a few mW.

RoboCamp 09 IRC, IIIT Hyderabad 3


b) 74LS00

● This is a Quad 2-input nand gates IC and the pin configuration is follows

c) 74LS02

● This is a Quad 2-input nor gate IC and the pin configuration is as follows

RoboCamp 09 IRC, IIIT Hyderabad 4


d) 74LS04

● This is a Hex inverter IC and the pin configuration is as follows

e) 74LS08 and 74LS32

● 74LS08 is a Quad 2-input AND gates IC and 74Ls32 is a Quad 2-input OR gates
IC and the Pin configurations of both ICs is as follows

RoboCamp 09 IRC, IIIT Hyderabad 5


2) Op-Amps

● The following two op-amps are widely used


○ LM741
○ Lm324

● The PIN configuration of LM741 IC is as follows

● The PIN configuration of LM324 IC is as follows

RoboCamp 09 IRC, IIIT Hyderabad 6


3) 7493 4-bit (0-15) ripple counter

● These are ripple counters so beware that glitches may occur in any logic gate
systems connected to their outputs due to the slight delay before the later
counter outputs respond to a clock pulse.

● The count advances as the clock input becomes low (on the falling-edge), this is
indicated by the bar over the clock label. This is the usual clock behaviour of
ripple counters and it means a counter output can directly drive the clock input of
the next counter in a chain.

● The counter is in two sections :


○ clockA-QA and clockB-QB-QC-QD.
○ For normal use connect QA to clockB to link the two sections, and connect the
external clock signal to clockA.

● For normal operation at least one reset0 input should be low, making both high
resets the counter to zero (0000, QA-QD low).

● Counting to less than the maximum (9 or 15) can be achieved by connecting the
appropriate output(s) to the two reset0 inputs. If only one reset input is required
the two inputs can be connected together. For example: to count 0 to 8 connect
QA (1) and QD (8) to the reset inputs.

RoboCamp 09 IRC, IIIT Hyderabad 7


4)7447BCD to 7-segment display driver

● The appropriate outputs a-g become low to display the BCD (binary coded decimal)
number supplied on inputs A-D. The 7447 has open collector outputs a-g which can
sink up to 40mA. The 7-segment display segments must be connected between +Vs
and the outputs with a resistor in series (330Ω with a 5V supply).A common anode
display is required.

● Display test and blank input are active-low so they should be high for normal
operation. When display test is low all the display segments should light (showing
number 8).

● If the blank input is low the display will be blank when the count input is zero
(0000). This can be used to blank leading zeros when there are several display
digits driven by a chain of counters. To achieve this blank output should be
connected to blank input of the next display down the chain (the next most
significant digit).

● The 7447 is intended for BCD (binary coded decimal) which is input values 0 to 9
(0000 to 1001 in binary). Inputs from 10 to 15 (1010 to 1111 in binary) will light odd
display segments but will do no harm.

RoboCamp 09 IRC, IIIT Hyderabad 8


5) 555 Timer IC

● The 8-pin 555 timer must be one of the most useful ICs ever made and it is used
in many projects. With just a few external components it can be used to build
many circuits, not all of them involve timing!

● Standard 555 ICs create a significant 'glitch' on the supply when their output
changes state. This is rarely a problem in simple circuits with no other ICs, but in
more complex circuits a smoothing capacitor (eg 100µF) should be connected
across the +Vs and 0V supply near the 555

● The PIN diagram of the 555 timer IC is as follows

● The circuit symbol for a 555 is a box with the pins arranged to suit the circuit
diagram is as shown below

● This 555 timer IC is used to generate the following waveforms


○ Astable : square wave
○ Monostable : a single pulse
○ Bistable : a simple memory which can be set and reset
○ Buffer : an inverting buffer (Schmitt trigger)

RoboCamp 09 IRC, IIIT Hyderabad 9


a) Pin Functionalities

● Trigger input : when < 1/3 Vs ('active low') this makes the output high (+Vs). It
monitors the discharging of the timing capacitor in an astable circuit. It has a
high input impedance > 2MΩ.

● Threshold input : when > 2/3 Vs ('active high') this makes the output low (0V)*.
It monitors the charging of the timing capacitor in astable and monostable
circuits. It has a high input impedance > 10MΩ.
* providing the trigger input is > 1/3 Vs, otherwise the trigger input will override
the threshold input and hold the output high (+Vs).

● Reset input : when less than about 0.7V ('active low') this makes the output low
(0V), overriding other inputs. When not required it should be connected to +Vs. It
has an input impedance of about 10kΩ.

● Control input : this can be used to adjust the threshold voltage which is set
internally to be 2/3 Vs. Usually this function is not required and the control input
is connected to 0V with a 0.01µF capacitor to eliminate electrical noise. It can be
left unconnected if noise is not a problem.

● Discharge pin : this is connected to 0V when the timer output is low and is used
to discharge the timing capacitor in astable and monostable circuits.

● Output pin :

○ this can sink and source up to 200mA. It is sufficient to supply many output
transducers directly, including LEDs (with a resistor in series), low current
lamps, loudspeakers (with a capacitor in series), relay coils (with diode
protection) and some motors (with diode protection).

○ The output voltage does not quite reach 0V and +Vs, especially if a large
current is flowing.To switch larger currents you can connect a transistor.

○ The ability to both sink and source current means that two devices can be
connected to the output so that one is on when the output is low and the other
is on when the output is high. The diagram below shows two LEDs connected in
this way.

RoboCamp 09 IRC, IIIT Hyderabad 10


b) 555 Astable Mutlivibrator

● An astable circuit produces a 'square wave', this is a digital waveform with sharp
transitions between low (0V) and high (+Vs). Note that the durations of the low
and high states may be different.

● The above circuit is called an astable because it is not stable in any state: the
output is continually changing between 'low' and 'high'.

● The time period (T) of the square wave is the time for one complete cycle, but it
is usually better to consider frequency (f) which is the number of cycles per
second.

. 1.4 .
T = 0.7×(R1+2R2)×C1 and f =
(R1+2R2)×C1

RoboCamp 09 IRC, IIIT Hyderabad 11


T = time period in seconds (s)
f = frequency in hertz (Hz)
R1 = resistance in ohms (Ω)
R2 = resistance in ohms (Ω)
C1 = capacitance in farads (F)

● The time period can be split into two parts: T = Th + Tl


High time (output high): Th = 0.7 × (R1 + R2) × C1
Low time (output low): Tl = 0.7 × R2 × C1

● Many circuits require Th and Tl to be almost equal and this is achieved if R2 is


much larger than R1.

● For a standard astable circuit Th cannot be less than Tl, but this is not too
restricting because the output can both sink and source current.

● For example an LED can be made to flash briefly with long gaps by connecting it
(with its resistor) between +Vs and the output. This way the LED is on during Tl,
so brief flashes are achieved with R1 larger than R2, making Tl short and Th long.

● If Th must be less than Tl, a diode can be added to the circuit as explained under
duty cycle below.

c) Choosing R1, R2 and C1

● R1 and R2 should be in the range 1kΩto 1MΩ. It is best to choose C1 first


because capacitors are available in just a few values.

● Choose C1 to suit the frequency range you require (use the table as a guide).

● Choose R2 to give the frequency (f) you require. Assume that R1 is much smaller
than R2 (so that Tm and Ts are almost equal), then you can use:

RoboCamp 09 IRC, IIIT Hyderabad 12


● Choose R1 to be about a tenth of R2 (1kΩ min.) unless you want the mark time Tm
to be significantly longer than the space time Ts.

● If you wish to use a variable resistor it is best to make it R2.

● If R1 is variable it must have a fixed resistor of at least 1kΩ in series


(this is not required for R2 if it is variable).

d) Astable Operation

● With the output high (+Vs) the capacitor C1 is charged by current flowing through
R1 and R2. The threshold and trigger inputs monitor the capacitor voltage and
when it reaches 2/3Vs (threshold voltage) the output becomes low and the
discharge pin is connected to 0V.

● The capacitor now discharges with current flowing through R2 into the discharge
pin. When the voltage falls to1/3Vs (trigger voltage) the output becomes high
again and the discharge pin is disconnected, allowing the capacitor to start
charging again.

● This cycle repeats continuously unless the reset input is connected to 0V which
forces the output low while reset is 0V.

● An astable can be used to provide the clock signal for circuits such as counters.

RoboCamp 09 IRC, IIIT Hyderabad 13


e) Duty cycle

● The duty cycle of an astable circuit is the proportion of the complete cycle for
which the output is high (the high time). It is usually given as a percentage.

● For a standard 555 astable circuit the mark time (Th) must be greater than the
space time (Tl), so the duty cycle must be at least 50%:

. Th . .R1+R2.
Duty cycle = =
Th+Tl R1+2R2

● To achieve a duty cycle of less than 50% a diode can be added in parallel with R2
as shown in the diagram. This bypasses R2 during the charging (mark) part of the
cycle so that Tm depends only on R1 and C1:
Th = 0.7 × R1 × C1 (ignoring 0.7V across diode)
Tl = 0.7 × R2 × C1 (unchanged)

Tm R1
Duty cycle with diode = =
Tm+Ts R1+R2

● Use a signal diode such as 1N4148.

● The following diagram shows the 555 astable circuit with diode across R2

RoboCamp 09 IRC, IIIT Hyderabad 14


f) 555 Monostable Multivbrator

● A monostable circuit produces a single output pulse when triggered. It is called a


monostable because it is stable in just one state: 'output low'. The 'output high'
state is temporary. The monostable cirucit is follows

● The duration of the pulse is called the time period (T) and this is determined by
resistor R1 and capacitor C1:

time period, T = 1.1 × R1 × C1

T = time period in seconds (s)


R1 = resistance in ohms (Ω)
C1 = capacitance in farads (F)

RoboCamp 09 IRC, IIIT Hyderabad 15


● The maximum reliable time period is about 10 minutes.

● Why 1.1? The capacitor charges to 2/3 = 67% so it is a bit longer than the time
constant (R1×C1) which is the time taken to charge to 63%.

● Choose C1 first (there are relatively few values available).

● Choose R1 to give the time period you need. R1 should be in the range 1kΩ to
1MΩ, so use a fixed resistor of at least 1kΩ in series if R1 is variable.

● Beware that electrolytic capacitor values are not accurate, errors of at least 20%
are common.

● Beware that electrolytic capacitors leak charge which substantially increases the
time period if you are using a high value resistor - use the formula as only a very
rough guide!

g) Monostable Operation

● The timing period is triggered (started) when the trigger input (555 pin 2) is less
than 1/3 Vs, this makes the output high (+Vs) and the capacitor C1 starts to
charge through resistor R1. Once the time period has started further trigger
pulses are ignored.

● The threshold input (555 pin 6) monitors the voltage across C1 and when this
reaches 2/3 Vs the time period is over and the output becomes low. At the same
time discharge (555 pin 7) is connected to 0V, discharging the capacitor ready for
the next trigger.

● The reset input (555 pin 4) overrides all other inputs and the timing may be
cancelled at any time by connecting reset to 0V, this instantly makes the output
low and discharges the capacitor. If the reset function is not required the reset
pin should be connected to +Vs.

RoboCamp 09 IRC, IIIT Hyderabad 16


h) Power-ON reset or trigger

● It may be useful to ensure that a monostable circuit is reset or triggered


automatically when the power supply is connected or switched on. This is achieved
by using a capacitor instead of (or in addition to) a push switch as shown in the
diagram below

● The capacitor takes a short time to charge, briefly holding the input close to 0V
when the circuit is switched on. A switch may be connected in parallel with the
capacitor if manual operation is also required.

i) Edge-triggering

● If the trigger input is still less than 1/3 Vs at the end of the time period the
output will remain high until the trigger is greater than 1/3 Vs. This situation can
occur if the input signal is from an on-off switch or sensor as shown below

RoboCamp 09 IRC, IIIT Hyderabad 17


● The monostable can be made edge triggered, responding only to changes of an
input signal, by connecting the trigger signal through a capacitor to the trigger
input.
○ The capacitor passes sudden changes (AC) but blocks a constant (DC) signal.
○ The circuit is 'negative edge triggered' because it responds to a sudden fall in
the input signal.

● The resistor between the trigger (555 pin 2) and +Vs ensures that the trigger is
normally high (+Vs).

RoboCamp 09 IRC, IIIT Hyderabad 18


6) H-Bridge

● An H-bridge is an electronic circuit which enables a voltage to be applied across a


load in either direction.

● These circuits are often used in robotics and other applications to allow DC
motors to run forwards and backwards. H-bridges are available as integrated
circuits, or can be built from discrete components.

● The basic bridge is shown in the figure below

● The key fact to note is that there are, in theory, four switching elements within
the bridge. These four elements are often called, high side left, high side right,
low side right, and low side left (when traversing in clockwise order).

● The switches are turned on in pairs, either high left and lower right, or lower left
and high right, but never both switches on the same "side" of the bridge.

● If both switches on one side of a bridge are turned on it creates a short circuit
between the battery plus and battery minus terminals. This phenomena is called
shoot through in the Switch-Mode Power Supply (SMPS) literature. If the bridge
is sufficiently powerful it will absorb that load and your batteries will simply
drain quickly. Usually however the switches in question melt.

RoboCamp 09 IRC, IIIT Hyderabad 19


High Side High Side Lower Lower Quadrant Description
Left Right Left Right
ON OFF OFF ON Motor rotates Clockwise
OFF ON ON OFF Motor rotates anti-clockwise
ON ON OFF OFF Motor “brakes” and decelerates
OFF OFF ON ON Motor “brakes” and decelerates

● One such H-bridge IC is LM293D. The PIN configurations of the IC as shown


below

● The L293D is quadruple high-current half-H drivers.

● The L293D is designed to provide bidirectional drive currents of up to 600-mA at


voltages from 4.5 V to 36 V.

● It is designed to drive inductive loads such as relays, solenoids, dc and bipolar


stepping motors, as well as other high-current/high-voltage loads in positive-
supply applications

● All inputs are TTL compatible. Each output is a complete totem-pole drive circuit,
with a Darlington transistor sink and a pseudo-Darlington source.

RoboCamp 09 IRC, IIIT Hyderabad 20


● Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3
and 4 enabled by 3,4EN.

● When an enable input is high, the associated drivers are enabled, and their
outputs are active and in phase with their inputs.

● When the enable input is low, those drivers are disabled, and their outputs are
off and in the high-impedance state.

● With the proper data inputs, each pair of drivers forms a full-H (or bridge)
reversible drive suitable for solenoid or motor applications.

RoboCamp 09 IRC, IIIT Hyderabad 21


7) Atmega 8 Microcontroller
● The ATmega8 is a low-power CMOS 8-bit microcontroller based on the AVR RISC
architecture.

a) Features

● 32 x 8 General Purpose Working Registers


● Two 8-bit Timer/Counters with Separate Prescaler, one Compare Mode
● One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture
Mode
● 8-channel ADC in TQFP and MLF package
● Eight Channels 10-bit Accuracy
● 6-channel ADC in PDIP package
● Programmable Serial USART
● Operating Voltages
○ 4.5 - 5.5V (ATmega8)
● Speed Grades
○ 0 - 16 MHz (Atmega8)

b) Pin Configuration

RoboCamp 09 IRC, IIIT Hyderabad 22


c) Ports and Port Pins

● 4 I/O ports: Port A, B, C, D also denoted as PA, PB, PC, PD and each port has 8
lines that can be independently set as H/L

● Each of the 8 lines can be configured independently as an input or an output pin

● The above feature is called True Read Modify Write Functionality

● Pin drivers are strong enough to drive LEDs directly

● All pins have voltage invariant internal pull up resistors and can be individually
pulled up as H/L

● Each port is associated with 3 registers: The data registers (PORTA), the data
direction register (DDRA) and the Input pin register (PINA) and each port pin,
PA3 for eg, is associated with 3 pins: DDa3, PORTa3, PINa3

RoboCamp 09 IRC, IIIT Hyderabad 23


IIIT-H Robotics Club is going to launch a students’ guide to robotics called RoboMAG
soon after RoboCamp 09, which will cover a wide range of robotics topics, and help
students to make a robot on their own. It will also include a CD containing all the
softwares required.

Rs: 100 /- only

The registration for RoboMAG is open. Book your copy here :

http://web.iiit.ac.in/~robotics/robocamp09/robomag.html

RoboCamp 09 IRC, IIIT Hyderabad 24

You might also like