📜 ⬆️ ⬇️

Four-bit calculator from cardboard and balls


The appearance of the cardboard four-bit calculator made of cardboard. The half-adder at the top and three adders in the middle and lower parts of the calculator are clearly visible

Long ago, before the invention of electronics, people made mechanical computers from scrap materials. The most famous and complex example of such a machine is the anti-Kitter mechanism — the most complex device of no less than 30 gears was used to calculate the motion of celestial bodies and made it possible to find out the date of 42 astronomical events.

Nowadays, mechanical computers (calculators) are more likely a subject of geeks' entertainment and a reason to have a funny show. For example, as a computer of 10,000 dominoes , which adds arbitrary four-digit binary numbers and gives a five-digit two-bit sum (the mathematical theory of this calculator and architecture ). Such performances allow children to better understand how bit-logic operations work in programming, how logic gates are arranged. And in general to make a small computer with your own hands from the materials at hand is very interesting, especially if you do it with your child.


Logical AND operation on a computer of 10,000 dominoes
')
For the manufacture of a mechanical calculator great designer Lego. On YouTube you can find many examples of such calculators .

Lego calculator



Inspired by the example of a computer from dominoes and mechanical calculators from the Lego designer, the C ++ programmer under the lapinozz nickname , together with his younger sisters, decided to build something similar at home for a school science project by one of the sisters. He conceived and implemented the LOGIC (Logic cardbOard Gates Inpredictable Calculator) , a fully functional four-bit LOGIC calculator. For the manufacture of this computer does not require anything other than cardboard and glue, and it works not on electricity, but on balls and earth gravity. The calculator can add numbers from 0 to 15 with a maximum amount of 30.

Unlike dominoes and Lego cubes, no factory-made components were used in the production of this calculator. All elements of the calculator are glued from cardboard from scratch, which is well understood from the photographs of the device. In this sense, this device can be considered unique.

Objective of the project


Visual representation of how to add binary numbers. Teaching a student how to convert from decimal to binary number system and back. The study of bit logic operations and basic logic circuits.

Appearance calculator


As you can see in the photo of the calculator, in the upper part there is a zone for data entry. After passing all the logical operations, the balls show the result of the operation below.



Data entry is carried balls. The ball is - 1, the ball is not - 0. The bit on the right is the smallest bit of the number. Before you begin, some parts of the calculator should be brought to its original position. After specifying the initial values, a strip of cardboard is moved away, which holds the balls in the initial position - and the process of addition begins.

For example, this is the initial position of the balls for operation 7 + 5 (0111 + 0101).



Calculator device


The logical operations of the cardboard calculator are carried out in a similar way, as in the aforementioned domino computer .

Schematically, logic gates for all logical operations are shown in the diagram.



That is, the logical AND gate (AND) means that when 0 balls enter, it turns out 0 is output. Upon receipt of 1 ball at the entrance is 0 at the output. Upon receipt of 2 balls at the entrance is 1 at the output.

1 at the entrance, 0 at the exit


2 at the entrance, 1 at the exit


The XOR logic gate is a bit more complicated. In this case, if one ball arrives, it must pass. And if two balls come in, they should cancel each other, that is, the output will be 0. The author shows how to do this through a vertically hanging piece of cardboard with a narrow neck. If two balls come at the same time, then they block each other - and thus effectively implement the logical XOR operation.

Logic gate XOR


In order to optimize the system and not fence the mass of the AND and XOR logic gates, the author implemented a semi - adder - a combinational logic circuit having two inputs and two outputs. The half-adder allows you to calculate the sum of A + B, with the result being two bits S and C, where S is the sum bit modulo 2, and C is the carry bit. In our cardboard construction, this means that if we have 1 ball at the entrance, then it hits output C, and if 2 balls at the entrance, then 1 ball hits output S, and the second does not go anywhere.

The programmer came up with a fairly simple and effective scheme for a half-adder. In it 1 ball at the entrance quietly continues its way, turning the barrier, and passing into the hole C. But if two balls arrive, then the second ball can no longer pass through the barrier inverted by the first ball - and falls into the hole, nailing S. This is a half adder.

One ball at the entrance of the half adder


Two balls at the entrance to the half adder


Finally, a real masterpiece is the adder. Usually it is made of two half-adders and a logical OR gate, but the author has implemented a different design, which is actually a small modification of the half-adder.

One ball at the entrance - one ball along the path 1


Two balls at the entrance - one ball on the way 2


Three balls at the entrance - one ball on path 1, and the other on path 2


The entire calculator consists entirely of one half adder and three adders.



The calculator gives the correct result of the calculations if the balls fall at the correct speed, not too fast and not too slow, and do not bounce from each other. The logic itself is flawless, but in practice the calculator is sometimes buggy.

Source: https://habr.com/ru/post/399391/


All Articles