The Start

Hi, What and Why

Plug it in

Rule number 1

Water Sensor

Sound Sensor


Tri Colour LED

RTC (Real Time Clock) DS1302

RTC (Real Time Clock) DS3231

Matrix LED step 1


Stepper Motor

LCD revisited with PCF8574T

Humidity Sensor

Shift Register

RFID tags (RC-522)

7 Segment display

Ultrasonic distance sensor

5V regulator

analogRead and analogWrite

Wiring an Array of Switches

The next step

Other things I have bought

Infra red and Processing

Programming a separate arduino chip

Creating your own PCB

L293D for a DC motor

4 digit 7 segment display

Starting with motors

RF433 Wireless Comms

Sort a character array

More stuff

I2C devices (SDA,SCL)

I2C scanner

SPI devices (MOSI,MISO)

HMC5883L Compass

MMA7361 Accelerometer

Added projects

Message Display System

4WD robot car
4WD robot car II

4WD robot car COMPLETE

MP3 Player

Shift Register

A shift register IC. Labelled SN74HC595N. Humidity sensor

A shift register (under a magnifying glass !). The dimple cut in one end indicates the top of the IC. Hold it vertically, dimple at the top, and Pin 1 is at the top, on the left.

A shift register has 8 digital outputs, and only 3 (also digital) inputs. This means it is excellent to use when you run out of digital I/O pins on your arduino.

Shift register pins. The 8 outputs (in blue) are labelled 0 to 7. The 3 inputs are in green; Data, Latch and Clock. Shift register
It's also surprisingly easy to use.
In summary :
- Connect 3 wires (called Latch, Clock and Data) to your arduino.
- Set the latch pin low using digitalWrite(pin, LOW);
- send a number between 0 and 255 to the data pin using the shiftOut function;
- then set the latch pin high using digitalWrite(pin, HIGH).

The number you send (0 - 255) is, in binary, an 8 digit number of 0's and 1's. These appear at the 8 output pins.

The easiest way to send the number is like this :

// Send an array of 8 integers (each integer is 0 or 1) to a shift register
// Paul Goodliffe May 2014

int dataPin = 2;        //Define which pins will be used for the Shift Register control
int latchPin = 3;
int clockPin = 4;

int Array[8];           // Declare an arrary of 8 integers. Each value will be either 0 or 1.

void setup()
    pinMode(dataPin, OUTPUT);       //Configure the 3 Pins needed
    pinMode(latchPin, OUTPUT);
    pinMode(clockPin, OUTPUT);

void loop()
  resetArray();    // Ensure each value in the array is set to 0 at the start.
  // Here, your additional code will set an array value to 1 as you require
  // eg. :
	Array[0] = 1;
	Array[1] = 0;
	Array[2] = 0;
	Array[3] = 1;
	Array[4] = 1;
	Array[5] = 1;
	Array[6] = 0;
	Array[7] = 1;
  sendArray();		 // Send the 8 digit array to the shift register

// resetArray - ensure each integer is 0. Use at the start of the program, and
//              any time you want or need.
void resetArray()
for (int i = 0; i<8; i++)
    Array[i] = 0;

// sendArray
// Calculate the vaalue to send (will be between 0 and 255), then send it to the shift
// register
// This is not the fastest code (!) to achieve the goal, but it's highly readable for
// understanding how to control a shift register
void sendArray()
  int valueSent;
  valueSent = Array[0] +        
              Array[1] * 2 +    
              Array[2] * 4 +    
              Array[3] * 8 + 
              Array[4] * 16 + 
              Array[5] * 32 + 
              Array[6] * 64 + 
              Array[7] * 128;
  digitalWrite(latchPin, LOW);                       // Set latch LOW to start sending data
  shiftOut(dataPin, clockPin, MSBFIRST, valueSent);  // Send the data
  digitalWrite(latchPin, HIGH);                      // Set latch HIGH to end.
  Serial.print("Wrote ");


The overflow pin is used to add yet another shift register, so you can have 16 digital outputs, all controlled through the same 3 arduino pins; clock, latch and data.
Connect the overflow pin (on the first shift register) to the data pin (on the second shift register). The clock and latch pins on the second are connected to the clock and latch pins on the first.
When you send the array to the first shift register, the current contents of the first are shifted to the second as the new array is written to the first.
You can continue wiring up more shift registers in sequence, giving you 24 data pins (for 3 shift registers) and so on.

How to use a shift register is one of the most commonly searched things for arduino. If you like this method of demonstrating it, a comment below would be appreciated.

Shift register pins again. Shift register