Introduction: Arduino With CD4015B Shift Register

The CD4015B is a Dual 4 Stage Static Shift Register with Serial input and Parallel output. It is a 16 pin IC and contains two identical, 4-stage registers with independent Data, Clock, and Reset inputs.The logic level present at the input of each stage is transferred to the output of that stage at each positive going clock transition. A logic high on the Reset input resets all four stages covered by that input. It is a CMOS device with all inputs protected from static discharge.

It is possible to expand the 2 four stage registers to an 8 bit register on the one package, and further by adding more CD4015B ICs.

It has various applications, including:

  • Serial input / parallel output data queuing
  • Serial to parallel data conversion
  • General purpose register

as well as driving LEDs as I will demonstrate below.


These ICs are very cheap and at present you can buy 10 CD4015BE for less than 2 UK pounds from China on Ebay.

Step 1: Pin Out and Functional Diagrams

The CD4015B has what seems to be an unusual layout and care must be taken to correctly identify each pin. For example Q4B (pin 2) is next to Q3A (pin 3) and Q4A (pin 10) is next to Q3B (pin 11). Also Clock B is on the mainly A side of the IC and likewise Clock A is on the mainly B side.

Operation of CD4015B

To clarify the above statement

"Data is transferred from the input to the output stage of the IC on a positive transition".

i.e. the Clock pin going from low to high on its relevant stage. This is achieved on the Arduino by first setting the Clock pin low, setting the Data pin high or low and then setting the Clock pin high again. Each time this happens the data on the output pin is shifted to the next one, i.e. from Q1A to Q2A etc. The data on Q4A is either lost or if connected to Data B, is shifted into Q1B.

Nothing happens when the Clock pin goes from high to low.

When the Reset pin is set high, it sets its 4 outputs low. This allows current to flow through the LEDs and turns them on. In the set up described below, all 8 outputs are reset as Reset A and Reset B are connected.

Step 2: Connection to an Arduino

Connection to an Arduino is as follows:

  • CD4015B pin 16 to Arduino 5v
  • CD4015B pin 8 to Arduino Gnd
  • CD4015B pin 6 (Reset A) to Arduino pin 5
  • CD4015B pin 7 (Data A) to Arduino pin 6
  • CD4015B pin 9 (Clock A) to Arduino pin 7
  • CD4015B pins Q1A - Q4A to LED Cathode and Anode to 5v via a 100 ohm resistor

To enable an 8 Stage Shift Register

  • Connect pin 14 (Reset B) to pin 6 (Reset A) on CD4015B
  • Connect pin 1 (Clock B) to pin 9 (Clock A) on CD4015B
  • Connect pin 10 (Q4A) to pin 15 (Data B) on CD4015B
  • CD4015B pins Q1B - Q4B to LED Cathode and Anode to 5v via a 100 ohm resistor

An Arduino program is included to demonstrate how the CD4015B can be used with LEDs. No special library is needed for the program to work. You don't have to use pins 5, 6 and 7 of the Arduino, as any of the I/O pins will work, but you will need to amend the sketch to whichever pins you have used.

The circuit can be set up on a bread board.

The program loop demonstrates 4 different ways to program the CD4015B.

Step 3: Conclusion

I just happened to have a CD4015BCN IC lying around and wondered about how to program it. Studying the relevant data sheet gave me all the information. There are also many other shift registers on the market. One example is the popular 74LS595 which has its own specific way to program it as well as being TTL as opposed to CMOS. There does not seem to be a lot of information available for the Arduino and the CD4015B.

I am not an electronics expert and am only providing this information to anyone who may find it interesting.

More information can be found on the relevant data sheets.