In the following tutorial, directions are given for creating a single node for the DoHas (Distributed Optical Harvard Architecture System). After constructing two of these nodes, a small distributed computer can be implemented which uses one node for sending instructions, mimicking input and the instruction set to manage it, and another node which will act as memory.
One unique feature about this system is that although it does separate the instruction and memory, it also has an important feature that is shared with the Von Neumann architecture, in that since both nodes are identical physically, they are both capable of fulfilling either role, depending on the state that either machine is in at the time of transmission.
This platform was designed by Marty Miller and William Tolley, two students at Berea College, and it should be pretty easily extensible. Have fun writing your own programs to be executed by our DoHas system.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Acquiring Materials
For each node, you will need:
- Infrared Emitter
- Infrared Receiver
- (3) 1,000 ohm resistor
- (3) LED
- solid core hookup wire
Additionally, you may want a blank PCB board to create a permanent machine, as shown in the first photograph.
This project has been designed for individuals interest in creating small programming projects with the Arduino platform that may not necessarily have any background in creating circuits or following circuit diagrams. If this doesn't apply to you, however, and you would rather simply follow a schematic of the project, one has been provided in addition to the step-by-step instructions.
Step 2: Preparing the Wires
The hookup wire should be cut into pieces as follows:
(9) 3 - 4 inch pieces with 1/2 inch exposed wire
(3) 6+ inch pieces with 1/2 inch exposed wire
Step 3: The Pins of the IR Receiver
The Left Pin is the pin that will be outputting data to the Arduino.
The Middle Pin is the ground.
The Right Pin is for receiving power.
Step 4: Wiring the IR Receiver
1.) Connect a 6 inch wire (to act as a global ground) from the GND port on the Arduino to the ground on the breadboard.
2.) Insert the IR Receiver onto the breadboard (location is not necessarily important).
3.) Connect a 6 inch wire from the 5V port on the Arduino to the Right Pin of the IR Receiver.
4.) Connect one of the short wires from the global ground area on the breadboard to the Middle Pin of the IR Receiver.
5.) Connect the last 6 inch wire from the A4 port on the Arduino to the Left Pin of the IR Receiver.
Step 5: Wiring the Standard LEDs
1.) Connect a short wire from the D12 Pin on the Arduino to the closet side of the breadboard, leaving a notch closet to the inseam.
2.) Connect a resister in the adjacent notch and bridge the gap to the other side of the breadboard, leaving a notch on the nearest side.
3.) Insert the cathode of an LED in the remaining notch, and insert the anode into a notch next to the other one.
4.) Connect short wire from a notch on the same line as the anode end of the LED to the global ground of the bread board.
5.) Connect a short wire from the D10 Pin on the Arduino to the closet side of the breadboard, leaving a notch closet to the inseam.
6.) Connect a resister in the adjacent notch and bridge the gap to the other side of the breadboard, leaving a notch on the nearest side.
7.) Insert the cathode of an LED in the remaining notch, and insert the anode into a notch next to the other one.
8.) Connect short wire from a notch on the same line as the anode end of the LED to the global ground of the bread board.
9.) Connect a short wire from the D8 Pin on the Arduino to the closet side of the breadboard, leaving a notch closet to the inseam.
10.) Connect a resister in the adjacent notch and bridge the gap to the other side of the breadboard, leaving a notch on the nearest side.
11.) Insert the cathode of an LED in the remaining notch, and insert the anode into a notch next to the other one.
12.) Connect short wire from a notch on the same line as the anode end of the LED to the global ground of the bread board.
Step 6: Wiring the IR Emitter
1.) Connect a short wire from the D3 Pin of the Arduino to the far side of the breadboard.
2.) Insert the cathode end of the IR LED into an adjacent notch to the D3 wire.
3.) Connect the anode end of the IR LED to an adjacent notch.
4.) Connect a short wire from the anode end of the LED to the global ground.
Step 7: Upload the Test Program
The files that are needed to test the system can be found here (mirrors below). You will need the Arduino programming environment found here to upload the proper code to each node and test the system.
1.) After downloading the files, be sure that you put the IRSendRev folder into the Libraries folder of your Arduino directory.
2.) Then open both the Send test and Rev test in the Arduino environment.
3.) Click on the checkmark in the upper-left corner to compile the code. This may take a few moments.
4.) Then click on the right arrow next to the checkmark to upload upload the Rev test to a single node, and the Send test to a single node to ensure that everything is working (repeat this uploading each of the files to the other node).
You should see the LEDs start to light up in sequence on the node that had the Rev test uploaded to it. This indicates that the system is functioning, but if you want to see what data is being sent, you can open the serial monitor (CTRL + SHIFT + M) to view the data being transmitted by the sending node.
Step 8: Understanding the System
Now that you have hopefully verified that your system is working physically, it might be nice to take a look at how the code works. The following gists (send code and receive code) and the accompanying pictures show what the code is, although you should already have it downloaded if you have tested your system. We will provide a short explanation of what is happening with each.
The Sender code does a few different things. First it establishes some variables, the most important of which are the instructions for the sending device, labeled 'a' through 'f' and are character arrays. These arrays function much like CPU instructions for something like a Hack CPU, although it is very much simplified; the first several of the numbers in these instructions are needed for determining the specification of IR signal to send and are not essential to understanding the system itself. The most important of the the 'bits' of the instruction are the last three, which determine which LED is turned on (or off). These are the workhorses of our very small instruction set, and it is important to note that more significant information could be sent and acted upon. We imagine that if you built up some infrastructure, then you could send things such as pictures or objects of classes you created that could be used as input on your Receiver nodes or more complicated instruction sets that could mimic something more akin to a full computer or CPU.
The fourth 'bit' from the right could be implemented as a control 'bit' if you wanted to add more nodes to your system. You could change this to various numbers that would represent which device (or group of devices) the instruction was intended for and then the Receiver devices would check to see if the instruction was for them, and execute it if so, and ignore the instruction if not.
The Receiver code essentially turns on the infrared receiver and then listens for input. Once some sort of IR input has been received, it then takes this data, which is a string of characters in this example, and executes an instruction (turning on or off an LED) depending on the instruction that was sent. In this system, the last three 'bits' represent which LED to turn on and which to turn off. If the bit is 1, then the corresponding LED is turned on, and of it is 0, then that LED is turned off. If you were to add more nodes to your system, it would be necessary to code each device to determine if the instruction it received was actually for it, which could be implemented by checking for a control 'bit' before executing the instruction.
What we have provided is more of a template than a complete system, and it is provided as a system to be built upon. Feel free to try out your own programs and test the capabilities of the platform. Our original intentions were to build a distributed Harvard Architecture, which is a computing platform that physically separates data memory and instructions memory. We wanted to do this by separating each of the operations associated with both data types into its own Arduino, with both devices communicating via infrared light. There are surely plenty of cool things that could be made with this setup, however, and we hope you have fun testing out new configurations or programs. If you do come up with something cool, please share it back with us, we would like to see it.
Step 9: Optional Additions
The same components are used here, but they are soldered directly onto a PCB board and the connections are made using wires that are also soldered to the board and then connected on the bottom using solder as well. The layout shown below works pretty well, but feel free to try out different configurations that may decrease the complexity of the wiring or soldering.
The box for our project was completed using a template generator here, and then printed using a laser engraver located in the Berea College Woods Lab.
The dimensions needed for a perfect fitting box (read: goldilocks tight) are as follows:
Width: 61.595 cm
Height: 33.02 cm
Depth: 83.82 cm
Thickness: 4 cm
Notch Length: 9.525 cm
Cut Width: 0 cm