Relay ALU

My son asked: But how does that power can compute?

Similar projects worth following
My son asked me: How does a computer can compute with only a power cord attached? My solution: Show him a basic part of every computer: the ALU. Not with boring black ICs but with shiny transparent relay (and LEDs and hidden, modern binary to decimal converter)

Yes there are many relay computer out there. But it is also an exercise for me.

I use "Code: The Hidden Language of Computer Hardware and Software" by Charles Petzold as a basis for my built.

The ALU consists of:

* I/O board (LEDs and switches)
* 8bit adder
* 8bit register (8 edge triggered d-flipflop)
* 8bit logic (NOP, NOT, AND, OR, XOR)
* 8bit 8* mulitplex
* Easy-to-read-display using an arduino


And in real life:

The data input, select and store switches are mounted on the I/O board. For every data line (input, register, result and select) a LED displaying the status of this line is mounted and a voltage divider (12V to 5V) to feed the states to the display board.

All data lines of the I/O board and the register are always connected to the inputs of the adder and the logic circuit (no input multiplexer). The (output) multiplexer then selects the operation that is forwarded to the result lines.

The multiplexer is wired as follows:





= Input (LD)



= Register (NOP)



= Add(Register, Input)



= XOR(Register, Input)



= AND(Register, Input)



= OR(Register, Input)



= NOT(Input)



= NOT(Register)

Example: 24+36=60

  1. Enter the first number at the I/O board (24 in the example below)
  2. Select 000 [0] at the multiplexer: result = input
  3. Press ‘store’ à the first number is stored in the register (24 is displayed in the register)
  4. Enter the second number at the I/O board (36)
  5. Select 010 [2] at the multiplexer: result = register + input (result = 60)

For easy reading, all numbers are also displayed on a separate board on 7-segment displays. This cheating board aka “easy-to-read-display” allows to select between displaying signed or unsigned 8bit numbers. This way it is also possible to subtract.

Some Notes:

  • If you want to know more about CPUs, read "Code: The Hidden Language of Computer Hardware and Software" by Charles Petzold
  • For the documentation I created parts of the circuits with the Circuit Simulator version 2.5.7js (see files: *.circuit)
  • If someone is interested:
    • Circuit, PCB development and rendering of PCB images was done using Target 3001!
    • 3D printed parts were created using Solid Edge

Parts summary:

  • PCBs
  • 72  1N4001
  • 3   220R
  • 106 680R
  • 2   10k
  • 37  4k7
  • 28  6k8
  • 48  Relay G2RL-2 12V
  • 24  Relay M412H
  • 13  Switches
  • 110 LED
  • 1   Arduino nano
  • 3   Display CX56-12
  • 2   MAX7219CNG
  • 2   MCP 23017
  • 192 cables (dupont connectors)
  • picture frame
  • power supply (Meanwell 12V, 6A)
  • buck converter
  • Volt and Ampere Meter
  • Mains connector
  • Power switch
  • Screws, nuts
  • Plenty of time


Register circuit

Adobe Portable Document Format - 39.85 kB - 03/04/2022 at 10:41



multiplexer circuit

Adobe Portable Document Format - 24.62 kB - 03/04/2022 at 10:41



logic circuit

Adobe Portable Document Format - 27.02 kB - 03/04/2022 at 10:41



adder circuit

Adobe Portable Document Format - 27.70 kB - 03/04/2022 at 10:41



logic (Circuit Simulator version 2.5.7js.)

circuit - 2.65 kB - 03/04/2022 at 10:36


View all 11 files

  • 1
    I/O Board

    The I/O board is used to

    1. Enter the data input
    2. Enter the multiplexer selection
    3. Trigger the storing in the register
    4. Feed all data lines of select, data input, register and result to the display board
    5. Show all data line states (high/low) using LEDs 

    So this board is built of many switches, resistors, LED and connectors.

    See also files:

    • I_O_SCH.PDF

    Below is the multiplexer selection circuit:

    And a rendering of the whole board:

  • 2
    Display board

    The display board helps in reading the data. It reads all data lines and displays them on 7 segment displays.

    This is done with the help of an Arduino nano, two MCP23017 are used and for reading all the data lines and two MAX7219 for driving the displays.

    See also files:

    • disp_SCH.PDF
    • display.ion
  • 3
    Adder board

    An adder is built of two half-adders:

    With DTDP relay this can be built as follows:

    See also files:

    • add.circuit
    • 4xFullAdder_SCH.PDF

View all 7 instructions

Enjoy this project?



Jon wrote 07/16/2021 at 16:07 point

Nice job, looks very similar to the work here:

  Are you sure? yes | no

Christian wrote 07/16/2021 at 20:36 point

The relay are connected a little bit different. E.g., I always tried to strictly separate control and load circuits so my AND, OR and XOR circuits (to be documented) need two relay. But It looks like the project uses the same relay - Omron G2R :-D

  Are you sure? yes | no

dearuserhron wrote 07/13/2021 at 18:09 point

Hi, Christian. Welcome to the club. See this #Relay Adder 

  Are you sure? yes | no

Christian wrote 07/14/2021 at 18:08 point

Oh yes, something like this was my 1st idea, but - as always - I wanted 8 bit and then I bought that book and wanted a register and .... then I forced me to stop that "wanting" :-D

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates