loading
This Instructable will show you step-by-step how to add 8 extra digital outputs, using only 3 of your microcontroller's digital outputs.

Step 1: Which Microcontroller Should You Use?

In order to do this Instructable with your microcontroller, you will need to make sure that it has the following:

(3x)......Available Digital Outputs (Analog/PWM Outputs will work too)
(1x)......Ground/GND Pin
(1x)......10k (or more) of programming space

Step 2: Parts

The parts needed to do this Instructable include:

(1x)......Microcontroller
(1x)......1 to 2 foot Length of Breadboard compatible wire
(1x)......74HC595 IC
(1x)......0.1uF ceramic cap (Code = 104)
(1x)......Breadboard
(8x)......20mA LEDs (of any color)
(8x)......220 Ohm resistors

Step 3: Tools


(1x)......Wire stripper
(1x)......Wire cutter
(1x)......Power supply 
(1x)......USB Cable (or relevant programming method)
(1x)......Computer with your microcontroller's programming software installed

Step 4: Wire It Up (Part 1)

Start by gathering your parts.

Step 5: Wire It Up (Part 2)

Now place the 74HC595 on the breadboard.

Step 6: Wire It Up (Part 3)

Now insert the wires as shown

Step 7: Wire It Up (Part 4)

Now add the Capacitor

Step 8: Wire It Up (Part 5)

Add the eight LEDs and eight 220 ohm resistors

Step 9: Wire It Up (Part 6)

Wire the each LED's anode to pins 15 & 1 to 7

Pin15 = Output_0 // Port_# 1
Pin1 = Output_1 // Port_# 2
Pin2 = Output_2 // Port_# 3
Pin3 = Output_3 // Port_# 4
Pin4 = Output_4 // Port_# 5
Pin5 = Output_5 // Port_# 6
Pin6 = Output_6 // Port_# 7
Pin7 = Output_7 // Port_# 8

Step 10: Wire It Up (Part 7)

Connect each of the resistors to ground
Also connect your Microcontroller's GND pin to the breadboard's ground

Step 11: Wire It Up (Part 8)

Find your 3 to 5 volt, regulated DC power supply, and connect the Positive connection of the power supply
to the Breadboard's Positive rail.
Next, connect the power supply's Negative connection to the breadboard's negative, or ground, rail.

Step 12: Wire It Up (Part 9)

Finally connect the Arduino's 3 digital pins as shown

Step 13: Code

Below is the code for use with an Arduino

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
//Pin connected to DS of 74HC595
int dataPin = 11;

void setup() {
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop() {
  for (int j = 0; j < 256; j++) {
    //ground latchPin and hold low for as long as you are transmitting
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, j);
//return the latch pin high to signal chip that it
//no longer needs to listen for information
digitalWrite(latchPin, HIGH);
delay(1000);
}
}   
<p>consider some of those 50 ct I2C LCD drivers and use them for other output/input </p><p><a href="http://www.aliexpress.com/item/15959-Free-Shipping-1602-2004-LCD-Adapter-Plate-IIC-I2C-Interface-i2c-lcd-adapter-for-arduino/32358255501.html?spm=2114.01010208.3.56.Mqm3Yd&ws_ab_test=searchweb201556_10,searchweb201602_5_10037_10017_507_10032_401,searchweb201603_1&btsid=ac79759f-293a-4f00-9e8e-a03c5611ea60">http://www.aliexpress.com/item/15959-Free-Shipping...</a></p>
<p>ok </p>
mention the controller please?
... It's an arduino.
where in the code does it actually control one of the 8 74hc595 output pins? <br> <br>if i'm reading the code right then all it's doing right now is simply making it turn on?
lets say i wanted to add more analog for sensors, what would the code look like then?
I think that instead of a pwm expander, (for analog output) you would need a mux(multiplier) to expand the number of analog inputs. Sparkfun has a $5 breakout
you would need a different chip like this: <a href="http://www.sparkfun.com/products/10136">http://www.sparkfun.com/products/10136</a>
How do you force a chip to start on the last program running after a power down?
will it work without the capacitor, if we just connect it directly to ground?
very straight forward :)
thanks

About This Instructable

15,982views

34favorites

License:

More by TECH GEEK:How to add more Outputs to your Microcontroller RUBBER BAND POWERED FOAM PLATE AIRPLANE 
Add instructable to: