Brainfuck relay computer

Von-Neumann 16-bit relay computer with Brainfuck++ instruction set

Similar projects worth following
I'm assembling relay computer on soviet reed relays - I need about 800 of them.
All compute logic mounted on 192 modules (60x44mm, with 4 relays on each) placed on 6 base places (150x200mm), 32 modules on each.

rev.1 would be with RAM on IC, 64KWords x 16bits.
16 commands, 8-bit default mode, 16-bit extended mode.

8 basic Brainfuck commands plus some extended what I can implement on current main blocks.

Soviet relays - RES64 - 1A, RES55 - 1C and RES-43 - 2A

Blocks placement. Dimensions 900x600mm

[DRAFT] Assembler instruction set

All instructions are 16-bit wide.

  • Bits 15, 14, 13, 12 - define instruction class
  • Bit 12 - Signed bit for Adder commands. Value of this bit extended to 13-15 bits when sending to adder input B;
  • Bits 11-0 - contain least 12-bit of signed integer. Master 4 bits generates automatically: 0 for positive and 1 for negative values.

InstructionOpcodeOperationBrainfuck EquivalentDescription
add m120X XX*AP ← *AP + m12'+' (Repeat m12 times)Add base to current data value
sub m121X XX*AP ← *AP - m12'-' (Repeat m12 times)Substract base from current data value
ada m122X XXAP ← AP + m12'>' (Repeat m12 times)Increase memory address
ads m123X XXAP ← AP - m12'<' (Repeat m12 times)Decrease memory address
jz m124X XX(*AP == 0)? IP ← IP + m12 : IP ← IP'['Jump to IP + m12 if current data value is zero
jz m125X XX(*AP == 0)? IP ← IP - m12 : IP ← IPNoneJump to IP - m12 if current data value is zero
jnz m126X XX(*AP != 0)? IP ← IP + m12 : IP ← IPNoneJump to IP + m12 if current data value is not zero
jnz m127X XX(*AP != 0)? IP ← IP - m12 : IP ← IP']'Jump to IP - m12 if current data value is not zero
xor m12
*AP←*AP XOR m12 NoneLogical XOR of current data value with positive constant
xor m12bX XX*AP ← *AP XOR m12NoneLogical XOR of current data value with negative constant
inc0 00*AP ← CIN','Read one m8 symbol from console. If Cin buffer is empty, wait it
outc0 01COUT ← *AP'.'Write m8 symbol to console
clr.apd0 01AP ← 0NoneClear AP register. Can be combined with other clr commands
clr.ipd0 02IP ← 0NoneClear IP register. Can be combined with other clr commands
clr.dpd0 04*AP ← 0'[+]' or '[-]'Clear current data cell. Can be combined with other clr commands
set.apd0 10AP ← *APNoneWrite current data value to AP register
set.ipd0 20IP ← *APNoneWrite current data value to IP register
get.apd1 00*AP ← APNoneRead current data value from AP register
get.ipd2 00*AP ← IPNoneRead current data value from IP register
mode.b8e1 00None8-bit mode activated(1) - default state
mode.b16e2 00None16-bit mode activated
haltf0 00Nonehalt machine
  • AP - Address pointer Register
  • IP - Instruction pointer register
  • *AP - Current Data cell
  • CIN - Console input
  • COUT - console output
  1. When 8-bit mode activated all arithmetic operations continue to perform in 16-bit mode. But JZ and JNZ branches start depends on only least data byte - (DP & 0x00FF == 0)? and (DP & 0x00FF != 0)? Console Input and Output are always read and write only least byte of 16-bit Word.

  • 768 × LED RED 5mm LED
  • 640 × RES55 USSR Reed relay with 1C contact group
  • 128 × RES64 USSR reed relay with 1A contact group
  • 192 × PCB module 60x44mm different PCB modules
  • 6 × Base PCB plate 200x150mm PCB each for 32 modules

View all 7 components

  • Assembled Relay Blocks working!​

    Artem Kashkanov02/08/2018 at 12:09 2 comments

    Two month of assembling and 10% of BrainfuckPC done and tested! 

    My new video  - I added Russian subs, so English subs should be generated automatically - but everything is clear, so :)

  • BfMonday#5 Adder and register blocks work!

    Artem Kashkanov02/05/2018 at 07:28 0 comments

    I connected assembled blocks to PSU and check them. So, they work!

    I use this switches to send data to input:

    So, Adder is counting (0x9999 + 0x6666 = 0xFFFF):

    And register block remember input values:

    This Thursday I publish video with checking progress. I added manual Russian subs, so auto-translated English subs should be available.

    Stay tuned!

  • BfMonday#4 Register block is done! (1/2)

    Artem Kashkanov01/29/2018 at 07:47 4 comments

    Instead of a thousand words:

    One of two required registers blocks is done! 2 Independent parallel 16-bit registers(right block). 

    Back view. ~150 wire-wrapped jumpers, about 4 hours of work.

    Some bonus for those who open project log page:

  • BfMonday#3 Registers block and indicators

    Artem Kashkanov01/22/2018 at 05:46 0 comments

    Continue assembling differens staff as for checking adder or for another computer logic.

    Start working on register block - two 16-bit registers. Each bit need one 1-bit register module, so I create base plate and support for them with HIPS  plastic.

    Another deal that I added SPI wrapper, so currently indicator board can show state from 16-bit input. (there are two 74HC165D on it)

  • BfMonday#2 IV-6 vacuum indicators panel

    Artem Kashkanov01/15/2018 at 21:17 0 comments

    Indicator panels are intended for displaying various information. Whether the current value of the register (16-bit input exactly for this), or something else received by UART. Anyway, you can always make a clock :). Why are the 6 not 8? Just because 100x100mm PCB very cheap.

    Circuitry is simple and was done on the principle "From what I found." And I found a pinch of ATMega168 controllers and two hundred cases of quad D-flip-flops K155TM8

    Segments in parallel, everything is polled up to power and shunted to ground by transistors. Keys, by the way - 2N2222 - at 60V.

    It's clear that besides the board itself, you need a firmware too, so we uncover AVR ISP mkII, Atmel Studio and remember what it is - debug the programs having only some digital outputs available. 

    The firmware is here:

    The ASCII table is clogged with dashes. Only HEX-numbers have been added so far. Does anyone have a more complete table? To be honest, I have not looked for it yet, but I'm too lazy to fill in the letters myself. Formatting tabs, yeah, where without it ...

    Happiness? No. After sending ABCDEF I got EBFACD.

    Crap - digits are not in order to simplify wiring. Dirty hack in the form of an array of six elements solves the problem. So what? The code will all endure.


    The refresh rate is 500Hz, this is more than enough to not see the flicker alive.

    Next tasks: add a UART-ring for messaging, find a bootloader for 8MHz, connect a 16-bit input.

  • WW2.5​: IV-6 Indicator panel fw development

    Artem Kashkanov01/12/2018 at 08:58 0 comments

    Working onIV-6 indicator panel MCU firmware. Main functions are:

    Read from 16-bit input current value (from register)  and print it in HEX view with prexif (e.t. IP, AP, CP) or without


    Read from UART some string (e.g. with current clockticks counter value) and show it on indicators.

    Just PoweOn test:

    SUDDENLY I have no power supply yet for BFPC! I need to order PSU's:

    5V - 200W - main relay voltage

    48V - 50W - IV-6 indicators anode voltage

    1.2V - 10W - IV-6 indicators heating

    As I have no 48V/1.2V power supply, I have to create junk-style one:

    despite the appearance it works good.

  • WW52.6 Happy new year!

    Artem Kashkanov12/30/2017 at 10:06 0 comments

  • WW52.4 Adder Block Assembled

    Artem Kashkanov12/28/2017 at 09:27 1 comment

    Print block-basket (as blockbaster, but only basket:) ) and install all modules inside. Each module has it's own rails.

    Book on the left of the picture - A.W. Rechten - Fluidik (translation from Deutsche), about fluid logical elements.

    On the right - soldered indicator board (need 10 of them) and 16-bit latch (need 10 of them too).

  • WW52.2 Test suite

    Artem Kashkanov12/26/2017 at 08:31 0 comments

    I'm developing an "absolute encoder" - 16 position switch with binary output. I already have two this switches, but for one word I need 4 of them, so I want to draw all parts and print them.

    On the left  - key cylinder with binary rings, on the right - miniature switches.  Top ring is to hold cylinder in each position. I'll add little spring-loaded balls between them - the same mechanism I found in my real switches.

  • WW52.1 16 bit ADDer Wire-wrapping DONE!

    Artem Kashkanov12/25/2017 at 09:03 4 comments

    I'm done with Adder block wire-wrapping. 32 modules, 2 modules per bit. Bit Placement:

    Top rows - FEDCBA98, Bottom rows - 76543210, So two bytes in natural view

    Not good with wire-wrapping yet - can't place wires smoothly, but already can do isolated turns.

    Next steps -  need some test suite for checking blocks

View all 24 project logs

Enjoy this project?



Yann Guidon / YGDES wrote 01/15/2018 at 22:56 point

You have progressed well ! It's cool to see :-)

  Are you sure? yes | no

Artem Kashkanov wrote 01/16/2018 at 08:41 point

Yep! After I got pcb's I began to work actively on the project. I had to order them before instead of making them manually, but... :)

I want to have minimum working set (Adder+Latches+Registers+Memory) with MCU controlling for generating sequences for nearest April's fools day - there should be really cool article to reddit and geektimes resources.

  Are you sure? yes | no

Yann Guidon / YGDES wrote 01/16/2018 at 08:43 point


  Are you sure? yes | no

Yann Guidon / YGDES wrote 11/06/2017 at 00:24 point

Hello :-)

Are there any updates lately ?

  Are you sure? yes | no

Artem Kashkanov wrote 11/12/2017 at 14:57 point

Yes) Today

  Are you sure? yes | no

Yann Guidon / YGDES wrote 11/12/2017 at 15:26 point

Awesome !

  Are you sure? yes | no

Yann Guidon / YGDES wrote 03/31/2017 at 18:47 point

Do you have estimates of the power supply requirements ?

  Are you sure? yes | no

Artem Kashkanov wrote 03/31/2017 at 19:52 point

Each base block would consume up to 5Volt and 2Amps. And Up to 2 Amp for memory board and vacuum indicator panel (approx 30pcs of soviet IV-6 tubes, which schematic is still in draft).

So 14Amps is not so much for this. Thanks to reed relays :-) I will use 25Amp 5Volt power supply.

  Are you sure? yes | no

Yann Guidon / YGDES wrote 03/31/2017 at 20:54 point

so it's in the range of 120W...

  Are you sure? yes | no

Dr. Cockroach wrote 03/31/2017 at 00:05 point

That is really awesome, I will be watching this :-)

  Are you sure? yes | no

Adam Vadala-Roth wrote 03/27/2017 at 14:23 point

this is so hardcore, much respect!!!

  Are you sure? yes | no

Yann Guidon / YGDES wrote 03/27/2017 at 10:17 point

A nice addition to #Relay-based projects :-)

  Are you sure? yes | no

Artem Kashkanov wrote 03/27/2017 at 11:50 point

Yes, very good idea.  :-)

  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