Electronics - Geek went Freak!

# Using 74HCxx with 3.3v

Atmega processors in Arduino boards are powered by 5V power supplies. It makes it easier to work with other ICs that accept 5v Vcc.

But most recent processors including ARM cortex-M operate at 3.3v Vcc. Would the tried and tested 74HCxx series work with 3.3v Vcc? Or should we pick a different low voltage logic series.

The answers, as usual, are in the data sheets.

The characteristics we are interested in are:

1. Allowed Vcc range
2. Vih, input voltage high threshold
3. Vil, input voltage low threshold

## Allowed Vcc range

The data sheet says, allowed Vcc range is -0.5v to 7v. That is great! So, 74HCxx series can be powered from 3.3v.

## Input thresholds at 5v

First lets look at Vih and Vil at 5v Vcc.

1. Vih: 3.5v
2. Vil: 1.5v

## Input thresholds at 3.3v

1. Vih: 2.31
2. Vil: 0.99

That is great! This would work perfectly.

# Introduction

Trimpot or preset resistor is a variable resistor whose resistance can be adjusted using a screw driver.

# Trimpot vs potentiometer

Trimpots are not meant to be tinkered with very often. This is the difference that sets it apart from potentiometers. Although both of them do the same thing, potentiometers offer more change cycles.

# Pinout

Trimpots have three terminals:

1. In1 ( A )
2. In2 ( B )
3. Out or Wiper ( C )
Trimpot pinout

Terminals A and B are the two ends of the voltage divider. Terminal C is the output where the voltage is divided.

Trimpot pinout schematic

# Circuit symbol

Trimpot schematic

# Connection

Lets build a small circuit to control the brightness of the LED with the help of a trim pot.

Trimpot schematic

# Introduction

74244 is a non-inverting octal buffer. Its output can be disabled in groups of four if they are not being used.

## Stats

Lines #: 8
Groups #: 2
Output type: CMOS push-pull
Tristate-able: Yes
ESD protection: Yes
Propagation delay @ 5V: 11ns

Vcc

1. Min: 4.5V
2. Max: 5.5V

Vih @ 5V

1. Typical: 1.6V
2. Minimum: 2.0V Io Max.: 35mA

## Special features

An unique feature about 74HCT245 that is not present in other similar buffers is that, the 8 lines can be split into two buses with up to 4 lines in each bus. The groups are:

1. Group1: 1A0, 1A1, 1A2, 1A3
2. Group2: 1A0, 2A1, 2A2, 2A3

Each of the groups can be separately tristate-ed using respective output enable lines. Thats right, each of these groups have their own output enable lines unlike other similar octal buffer ICs.

# Application

## Buffer

74HCT245 can output a maximum current of 35mA. This can be used to drive heavier loads that microcontroller i/o pins cannot drive directly.

## 3.3V -> 5V Level shifter

Typical Vih for 74HCT244 is 2V which is way below 3.3V. 74HCT244 can be used as 3.3V -> 5V level shifter. 74HCT244 is better than 74HC244 in 3.3V to 5V level shifting because 74HCT series is compatible with TTL logic rather than CMOS logic.

## 5V -> 3.3V level shifter

Maximum input voltage for 74HCT245 cannot be greater than Vcc according to the specification.

But it can be tricked into accepting voltages greater than Vcc. 74HCT245 has ESD protection diodes on input pins. These diodes come into play when input voltage is greater than Vcc. These clamping diodes can take maximum current of 20mA. This means that a current limiting resister can be used to keep the current below 20mA at 5V. Current limiting resistor of 500ohms would work.

The problem with this trick is, it increases the propagation delay. It is fairly useful for low speed circuits. The lower the resistor the better.

For high speed circuits, use 74ACT244, 74ACT245, 74HCT244, 74HCT245.

# Buffers: 74244 vs 74245

74244 is an octal unidirectional buffer. The 8 lines can be split into two groups and each group can be individually disabled.

74245 is an octal bidirectional buffer. The direction of all the lines are controlled using the same line, DIR.

Bidirectional bus can be built using 74244 by

1. Complementing the output enable lines
2. Connecting outputs and inputs together
Bidirectional bus using 74244

But this only gives 4 bidirectional lines. If bidirectional lines are required, it is better to use 74245.

# Introduction

74244 is a non-inverting octal buffer. Its output can be disabled in groups of four if they are not being used.

## Stats

Lines #: 8
Groups #: 2
Output type: CMOS push-pull
Tristate-able: Yes
ESD protection: Yes
Propagation delay @ 5V: 9ns

Vcc

1. Min: 2V
2. Max: 6V

Vih @ 5V

1. Typical: 2.65
2. Minimum: 3.5 Io Max.: 35mA

## Special features

An unique feature about 74HC244 that is not present in other similar buffers is that, the 8 lines can be split into two buses with up to 4 lines in each bus. The groups are:

1. Group1: 1A0, 1A1, 1A2, 1A3
2. Group2: 1A0, 2A1, 2A2, 2A3

Each of the groups can be separately tristate-ed using respective output enable lines. Thats right, each of these groups have their own output enable lines unlike other similar octal buffer ICs.

# Application

## Buffer

74HC244 can output a maximum current of 35mA. This can be used to drive heavier loads that microcontroller i/o pins cannot drive directly.

## 3.3V -> 5V Level shifter

NOTE: Although this might work at room temperatures, this is not recommended. Use 74HCT244, 74HCT245, 74ACT244, 74ACT245.

Typical Vih for 74HC244 at room temperature is 2.65V which is way below 3.3V. 74HC244 can be used as 3.3V -> 5V level shifter.

But important thing to note is, the minimum guaranteed worst case Vih is 3.5V. A 3.3V device will never be able to reach this level. So using 74HC244 as 3.3V to 5V level shifter is very bad idea.

## 5V -> 3.3V level shifter

Maximum input voltage for 74HC244 cannot be greater than Vcc according to the specification.

But it can be tricked into accepting voltages greater than Vcc. 74HC244 has ESD protection diodes on input pins. These diodes come into play when input voltage is greater than Vcc. These clamping diodes can take maximum current of 20mA. This means that a current limiting resister can be used to keep the current below 20mA at 5V. Current limiting resistor of 500ohms would work.

The problem with this trick is, it increases the propagation delay. It is fairly useful for low speed circuits. The lower the resistor the better.

For high speed circuits, use 74ACT244, 74ACT245, 74HCT244, 74HCT245.

# Introduction

74245 is a non-inverting bidirectional octal buffer.

## Stats

Lines #: 8
Output type: CMOS push-pull
Tristate-able: Yes
ESD protection: Yes
Propagation delay @ 5V: 10ns

Vcc

1. Min: 2V
2. Max: 6V

Vih @ 5V

1. Typical: 2.65
2. Minimum: 3.5 Io Max.: 35mA

## Special features

74245 is a bidirectional buffer. The direction of all the lines together can be controlled using the direction pin, DIR.

# Application

## 3.3V -> 5V Level shifter

NOTE: Although this might work at room temperatures, this is not recommended. Use 74HCT244, 74HCT245, 74ACT244, 74ACT245.

Typical Vih for 74HC245 at room temperature is 2.65V which is way below 3.3V. 74HC245 can be used as 3.3V -> 5V level shifter.

But important thing to note is, the minimum guaranteed worst case Vih is 3.5V. A 3.3V device will never be able to reach this level. So using 74HC245 as 3.3V to 5V level shifter is very bad idea.

## 5V -> 3.3V level shifter

Maximum input voltage for 74HC245 cannot be greater than Vcc according to the specification.

But it can be tricked into accepting voltages greater than Vcc. 74HC245 has ESD protection diodes on input pins. These diodes come into play when input voltage is greater than Vcc. These clamping diodes can take maximum current of 20mA. This means that a current limiting resister can be used to keep the current below 20mA at 5V. Current limiting resistor of 500ohms would work.

The problem with this trick is, it increases the propagation delay. It is fairly useful for low speed circuits. The lower the resistor the better.

For high speed circuits, use 74ACT244, 74ACT245, 74HCT244, 74HCT245.

# 74XX164

74XX164 is a serial-in parallel-out shift register.

Unlike 74XX594 and 74XX595, it doesn’t have a front-end with latch or flip-flop.

74HC164 block diagram

## Clock input

CP pin is used as clock to the shift registers. The data is shifted on the positive edge of clock signal.

## Output enable

74XX164 doesn’t have an output enable pin. However, master reset (MR) pin can be used to clear all shift registers and drive all outputs low.

## Master reset

A low on the MR pin clears all the registers and all the outputs are driven low.

Q7 of first 74XX164 can be connected to the serial input of the second 74XX164 to cascade them into 16-bit serial register.

# Zener diode voltage regulator

Zener diode has a very useful property of dropping a constant voltage (equal to its Zener voltage) across its terminals when it is reverse biased at voltages above its Zener voltage.

Constant Voltage drop
Constant Voltage drop plot

The voltage across the zener diode follows the source V1 until it reaches 8.2V (Zener voltage). Any further increase of source voltage doesn’t change voltage across the Zener diode.

Until the Zener voltage is reached, the Zener diode is open, so there is no current flowing through the circuit. After Zener voltage is reached, the current is,

$$tex I_{R1} = \frac{V_{V1} - V_{ZV}}{R_{R1}} tex$$

This property can be used to build voltage regulators. Voltage regulators are used when the input voltage is higher than the required voltage. But placing the Zener diode across the load, a constant required voltage can be dropped across the load if the input voltage is above this desired voltage.

Zener diodes with various Zener voltage are available in the market. Lets consider a case where we have 24V input voltage and have circuit that operates at 8.2V.

We have chosen the Zener diode BZX84C8V2L which has required Zener voltage of 8.2V.

Voltage regulator

The resistor Rs has two uses

1. To limit current flowing through the Zener diode when Vin is greater than Zener voltage. This sets the minimum limit on the Resistor Rs.
2. It should drop as less voltage as possible so that most of Vin is dropped across the load (Rl) when Vin < Zener voltage. This sets the maximum limit on the resistor Rs.

# GPIO input pins: Interface higher voltage

Note: This also applies to other ICs like comparators, etc.

Interfacing a GPIO input pin to an external voltage is always tricky.

Generally, uC use 3.3v or 5v. This means that the internal circuitry is not designed to operate with voltages greater than these voltages. Usually, we would like to interface voltages in the range of 0v to 24v. Voltages greater than 24V or 30V are seldom used with uCs.

Let us consider STM32F407VG for this analysis.

For STM32F407VG, the reference manual mentions that input voltage on pins should be in the range of Vss-0.3 to 4.0v.

## Clamping diodes

For uCs without internal voltage clamping diodes, supplying voltage higher than the recommended voltages could damage the uC.

At the voltage range we are considering, it is not so much the voltage itself that might be hazardous usually. It is the current!

Consider the following circuit:

Circuit 1

For voltage V1 = 5V, if R1 = 100Ohm, a current of 50mA will flow through the LED. Usually maximum current ratings for LED is 20mA. A current of 50mA will fry the LED.

We can fix this by using appropriately high resistance. A resistance of 1kOhm would mean that a current of 5mA will flow through the LED. This resistance is called current limiting resistor.

Similarly, there are multiple current sensitive components connected to GPIO circuitry. The processor manufacturer would have used current limiting resistor assuming the maximum input voltage would be kept inside the recommended voltage range.

There could also be a few components sensitive to voltage in the region of our operation.

So to safely interface rouge voltages, clamping diodes are recommended.

External clamping diodes

The upper diode starts conducting when the interface voltage goes above Vdd. The lower diode starts conducting when the interface voltage goes below Vss.

The good news is most of the uCs in the market today come with internal clamping diodes.

## Current limiting resistor

One last thing to consider is the current flowing into the GPIO input pin. GPIO input pins have maximum rating on current injected into it. For STM32F407VG, it is 5mA.

It is necessary to make sure that less than 5mA flows into the GPIO input pin even when the maximum voltage we desire is interfaced to it.

Also, when the voltage is greater than Vdd, the upper clamping diode starts to conduct. If current flowing through the diode is too high, it might be damaged.

In our case, the voltage is 24v. A series current limiting resistor of 6kOhm will keep the current at 4mA. Typically 10kOhm resistors are used.

Current limiting resistor

# GPIO: Why do we need a current limiting resistor?

I was pretty confused for a very long time about “Why do we need a current limiting resistor on a GPIO input”.

Shouldn’t inputs have really high input impedance? Something like this:

GPIO model

Why would we need a current limiting resistor like this:

With current limiting resistor

Isn’t the current already very low when there is no current limiting resistor:

No current limiting resistor

Iin = 5/10M = 5uA

The thing is, we actually don’t need a current limiting resistors on the inputs if the input voltage never exceeds Vcc.

So, why do we have current limiting resistors on the inputs?

The clamping diodes or ESD protection diodes!

Input pins usually have clamping diodes to protect the input circuit when the input voltages greater than Vcc or less than Vss is applied.

Clamping diodes

The clamping diodes start conducting when the input voltages go out of the accepted voltage range. In this case, we are interested in condition where Vin exceeds Vcc. The upper zener diode starts conducting. If there is no current limiting resistor, this would introduce a short circuit and a lot of smoke.

Current limiting resistor with clamping diodes