BrainfuckPC 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


Tens of thousands of people creates they own programs on brainfuck programming language. 

Thousands - creates they own brainfuck compilers or emulator to run their creation.

But the only one man tries to create Brainfuck Relay Computer.

BrainfuckPC (BFPC) - is a computer on reed relays, which can execute brainfuck commands natively, without any compilation into other assembly. All main instructions are corresponds to eight bf commands.


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

  • WW16 BFPC Project overview [ENGLISH]

    Artem Kashkanov4 days ago 0 comments

    Created show video-review of my project for hackaday Prize 2018 Contest

  • WW12 Worlds-Fastest Relay Adder Test - 500OPS

    Artem Kashkanov03/22/2018 at 07:21 5 comments

    Insane five hundred ADDC operations per second to the relay!

    0x9999+0x6666 + Carry = 0x10000 with Carry and 0xFFFF w/o it, so All digits are involved 

    World-Fastest relay adder exist  - Time to go to the worlds-fastest relay computer

  • BfMonday#6-11 Parts assembly process...

    Artem Kashkanov03/13/2018 at 08:55 0 comments

    Last month all 64 D-trigger modules were done. Need to wire-wrap second register block.

    I printed all cases for blocks and need to commit first revision of logic blocks schematics. Without this step I have no idea what modules I need to solder next.

    Now my bookcase looks like this :)

  • 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

View all 27 project logs

Enjoy this project?



Dr. Cockroach wrote 4 days ago point

Yes, yours will be the first relay BF computer and I hope to have perhaps the first DTL BF computer :-)  has a nice sound to it :-) Your build is looking fantastic Artem :-)

  Are you sure? yes | no

Dr. Cockroach wrote 04/06/2018 at 22:11 point

I agree, well done :-)

  Are you sure? yes | no

Artem Kashkanov wrote 04/07/2018 at 18:44 point

Thanks!  One more stimulus to complete this project

  Are you sure? yes | no

Artem Kashkanov wrote 04/07/2018 at 18:42 point

I miss this :) Thanks for the link)

Very interesting ethics discussion, but I do not rename this project :) 

Perhaps I should not tell them that the DekatronPC would have BF instruction set too :)

  Are you sure? yes | no

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