homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam

The Geek Culture Forums

Post New Topic  New Poll  Post A Reply
my profile | directory login | | search | faq | forum home
  next oldest topic   next newest topic
» The Geek Culture Forums   » Techno-Talking   » Hardware, Robots, AI, Geek Toys!   » Building a relay based computer

 - UBBFriend: Email this page to someone!    
Author Topic: Building a relay based computer
Alpha Geek
Member # 609

Rate Member
Icon 11 posted April 07, 2004 23:17      Profile for MrMachineCode     Send New Private Message       Edit/Delete Post   Reply With Quote 
A geeky friend of mine was doing some spring cleaning and he was getting rid of a box full of about 100 telephone relays. "You want this?" He asked me.

"You betcha! I bet there's enough relays here to build a CPU!"

I've wanted to build a relay based computer ever since I heard of Konrad Zuse, who was building relay computers in the 1940's, but I always thought it would be prohibitively expensive for me to build one out of new components. I would never have dreamed someone would have a whole box full of used relays just sitting there!

While a relay computer would have no practical use today, it would be really cool to have a computer that goes click-clack-click when it's processing, and I could solder LED's to all of the relays so that it would be full of blinkenlights too. I will construct it on a piece of plywood so that all parts are visible in their operation. It would provide a really good way to demonstrate to computer science students the concept that a computer is not just a PC, but rather an idea, something that can be built out of many different types of components besides transistors or tubes.

Computers can be 4, 8, 16, 32 or however many bits wide, so, to minimize the amount of relays this machine will need, why don't I make it a ONE bit computer?? I know, I can hear you all the way from here saying "How are you going to do any memory addressing with just one bit???" A problem, I can assure you. But not insurmountable. For instance, consider the popular Z80 processor: it has only an 8 bit accumulator, but it has 16 bit addressing! To fill it's address register, it has to move 8 bits at a time. This would be the same way: it would have 16 bit addressing, but it would take 16 operations from the 1 bit accumulator to move the 16 bit address into the address register.

I plan to cheat a little: This relay computer will use modern intergrated circuits for the static RAM chips, and the input/output. The purpose is to build enough of the computer out of relays that skeptics and laymen would be convinced I could have done it ALL with relays, if I had had enough of them.

Although there have been projects done which prove that a complete computer can be implemented with just one instruction (subz, the "subtract and jump if less than zero" instruction), I don't think it's necessary to make my computer quite THAT spartan. The static RAM chip I plan to use is 8 bits wide--why not use 8 bit instruction words? That gives a lot of flexibility for several instructions, plus some immediate data.

In fact, going back to the 1-bit accumulator / 16-address register size disprepancy, it would take a large number of relays to implement address calculation because I would not only have to have at least 16 to store the address word, I would need many more relays to allow the single accumulator bit to "fan out" to the 16 address bits and 8 data bits.

So, let me narrow down this project even further: ***ONLY*** the Arithmetic Logic Unit part of the processor will be built of relays, and this relay based ALU will only perform calculations on one bit at a time. I will use modern 74xxx series TTL chips such as muxes/demuxes, shift registers, and latches, to interface the one-bit ALU to 8 and 16 bit data.

The ALU will have a 1-bit input line, a 1-bit output line connected directly to the 1-bit acumulator flip-flop relay inside the ALU, and it will have a Control Word input which may be four or five bits or so, I'm still deciding. The way you use it is you put a 1 or 0 on the input line, and set the control line to what you want it to do to the accumulator. Kind of like a logic gate where you can program whether it performs an AND, NAND, OR, XOR, etc. You toggle the clock line and it performs the boolean logic function you selected with the Control Word.

For instance, suppose you wanted to NAND 0 and 1. First, you would put 0 into the accumulator by putting 0 on the input line, and the bit pattern representing the "mov" instruction on the Control Word. Then you would put 1 on the input line, and the instruction for "NAND" on the Control Word lines. When the clock cycle is received, the accumulator will be set to the NAND of the input and the old contents of the accumulator. The result on the accumulator can be read from the output line of the ALU.

For program storage, I plan to use Scantron sheets (the sheets you mark on when you're taking a multiple choice test). They have several advantages, IMO: 1. works like a punch card, but you don't need a punch, you can use a #2 pencil. You could erase your mistakes. 2. You can buy packages of Scantron sheets cheaply at the store near my university. 3. Easy as pie to make a reader for it, all you need is a row of electric eyes. If you build the device so that you pull the sheet across the eyes yourself (similar to how ATM machines sometimes make you swipe a card yourself), then you don't need a motor or paper feed. 4. If I later write an assembler for this machine, but the assembler runs on a PC, the assembler could use a printer to output the program as pieces of paper that LOOK like scantron sheets and could be read in the same scantron reader.

To program the relay computer, you would fill in the machine code for it on a scantron sheet, then put the hardware into "program mode" by flipping a toggle switch. In this mode, anything you swipe across the homemade scantron reader gets copied by hardware into the static RAM chip. Then you flip the switch to RUN mode, and, as long as the device has power, you don't need to mess with the scantrons anymore; it will run the program from RAM.

I'm still trying to decide what peripherals it needs to have. I suppose I could give it a keyboard and teletype display, but I hardly think it would be fast enough for someone to type on it comfortably. Maybe a row of seven segment LED display characters, mapped to RAM locations, would be sufficient...

It's really hard to find schematics for relay based computers on the net. There's lots of pictures of old machines in computer museums, and historical discussions about them, but technical information is sadly lacking.

Posts: 314 | From: USA | Registered: Dec 2000  |  IP: Logged
Number 2608
Mini Geek
Member # 2608

Rate Member
Icon 1 posted April 08, 2004 03:57      Profile for Number 2608     Send New Private Message       Edit/Delete Post   Reply With Quote 
Interesting project, sounds like you could be in for a lot of fun there. I for one would be interested in how you get on.
Posts: 82 | From: Leeds, UK | Registered: Mar 2004  |  IP: Logged
Member # 2426

Member Rated:
Icon 1 posted April 08, 2004 04:15      Profile for Gibbonboy   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
I always wanted to wire my home automation system through some real old relays, and mount them in a glass shadowbox on a wall somewhere. It would be neat to see it all working, kind of a kinetic sculpture, with the added bonus of controlling the house.

"It's not the end of the world, but you can see it from here."

Posts: 155 | From: A Very Small Hole in the Forest | Registered: Nov 2003  |  IP: Logged

Solid Nitrozanium SuperFan!
Member # 615

Member Rated:
Icon 1 posted April 08, 2004 09:04      Profile for Zwilnik   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
For programming, I'd like to suggest using Lego bricks wrapped in tinfoil or painted with conductive paint on the underside. You can paint contact strips down a Lego baseboard with conductive paint and place bricks between pairs of strips to set that 'address'. you'd wire the edges of the strips directly to your CPU as your input memory.

As far as storage memory is concerned, set up 8 relays as a memory pointer register and use them to control a robot that stacks wooden blocks (or more Lego bricks) in 256 locations on a 16x16 board.

If you want to be *really* clever. make the grid black and the blocks white and put a light sensor on the robot's pickup hand. Then the memory array becomes two way as you can wire the sensor to a relay that lets you read the bit at that address.

The Universe is entirely made up of elements.
The most important of which is the element of surprise.

Posts: 1040 | From: West Sussex, UK | Registered: Dec 2000  |  IP: Logged
Member # 1991

Member Rated:
Icon 1 posted April 08, 2004 20:57      Profile for mongoose     Send New Private Message       Edit/Delete Post   Reply With Quote 
Building a relay based cpu would be really cool, but not very practical. I would love to see pics and a schematic for that. I would love to try it, but I have very little electrical engineering knowlege beyond what I had to learn for my ham license. I want to learn more, but have never taken the time too, partly because it seems like most of the EE jobs are going overseas, but thats the downside to free trade.


"information superhighway" is just an anagram for "i'm on a huge wispy rhino fart". - www.bsd.org

Posts: 141 | From: There's a NEW Jersey? | Registered: Feb 2003  |  IP: Logged
BlabberMouth, a Blabber Odyssey
Member # 1659

Member Rated:
Icon 1 posted April 09, 2004 03:51      Profile for TheMoMan         Edit/Delete Post   Reply With Quote 
MrMachineCode_______Do you have idea about how big this is going to get? Where I worked we had some assembly machine for putting together a Spark Plug, they used GE static controls, and, nand, or, and of course nor gates. These controls used the inputs of all of the head position switches and a main drive shaft rotation sensor to drive the main clutch brake and to turn on the welder. the main control panel was about 8 feet tall 4 feet wide and two feet deep and once you opened the door there were two internal swing out panels full of logic relays. some of the relays had lights and others had thier armatures painted so that the electricians could see what state each one was in.

If it don't glow it ain't Ham Radio

Posts: 5342 | From: Just South of the Huron National Forest, in the water shed of the Rifle River | Registered: Sep 2002  |  IP: Logged

Member # 371

Member Rated:
Icon 1 posted April 09, 2004 08:38      Profile for Doco   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
Let me throw out some random ideas here.

First - cool project. A blinken light on each relay will help you debug it. Plan a a fully static design and make your clock line so you can hand toggle it if necessary to help debug it.

I like the idea of narrowing it down to just the ALU using relays - that should make it more do-able.

Work on the circuit to create a NAND or NOR out of a couple of relays - and/or the circuit to create a flip-flop. Then you have everything you need to create any logic circuit you ever wanted. Lack of sleep (and need to do what I get paid for) prevent me from sketching something up right now - but it shouldn't be that bad to figure out. ROM for the micro-code should be just a simple series of pull-ups/pull-down resistors.

The scan-tron thing sounds cool - but to get real nostalgia do a series of 8 or 16 input toggle switches and a "load" and reset toggle. The reset switch will put you into load mode at address 0. Each time you hit the load switch 1 byte of data/program is loaded and a counter advances to the next address. After loading so many bytes or after hitting a run switch you start fetching and executing from address 0. This might be simpler to implement than the scantron deal - BUT a pain in the ass to use. Another alterative if you have this set up is to use your parallel port on a PC to drive it.

Output - you can't beat blinky lights. A couple of 8 segment LEDs are great. First program blinks one segment. Second program does alternating blinks. Third does a chase sequence. Then you can get into reading input from the toggle switches and adding the numbers for a result to be displayed.

Posts: 419 | From: Minneapolis, MN | Registered: Mar 2000  |  IP: Logged
Member # 1991

Member Rated:
Icon 1 posted April 10, 2004 10:24      Profile for mongoose     Send New Private Message       Edit/Delete Post   Reply With Quote 
Starting to sound like the Altair computer that M$ got their start writting BASIC for, just that wasn't relay based.



"information superhighway" is just an anagram for "i'm on a huge wispy rhino fart". - www.bsd.org

Posts: 141 | From: There's a NEW Jersey? | Registered: Feb 2003  |  IP: Logged

All times are Eastern Time  
Post New Topic  New Poll  Post A Reply Close Topic    Move Topic    Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:

Contact Us | Geek Culture Home Page

© 2014 Geek Culture® All Rights Reserved.

Powered by Infopop Corporation
UBB.classicTM 6.4.0

homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam