-
1Step 1
Required Components:
The component list for this computer is fairly low as only a single IC is required:
1 x ATmega 1284P Microcontroller
1 x DIL 40 Pin 0.6" IC Holder
1 x 40 Pin Female Pin Header (to be cut down into smaller headers)
1 x 16 MHz Crystal
2 x 22pF Ceramic Capacitors
1 x 2.1mm Barrel Jack
1 x L7805 Voltage Regulator
1 x 0.1uF Electrolytic Capacitor
1 x 0.33uF Electrolytic Capacitor
1 x RCA PCB Mount Socket
1 x PS/2 Mini Din PCB Mount Socket
2 x 470 Ohm Resistors
1 x 1k Ohm Resistor
2 x 0 Ohm resistors (used as jumpers)
1 x 3mm LED
1 x PCB / Strip-board / Matrix-board (depending on how the computer is going to be constructed. If a PCB is not used, different components may be needed as some have footprints such as the RCA socket which cannot be placed on strip-board)
Additionally, tools are needed to construct the PCB including a soldering iron, solder, needle nose pliers and wire cutters.
To operate (use) the computer, a PS/2 keyboard, composite enabled display (such as a TV) and a power source (such as a PP3 battery or wall mounted PSU) are needed. To bootload and program the 1284P, a programmer is needed (I used an Arduino UNO as an I -
2Step 2
The Circuit:
I designed the circuit diagram in the program Fritzing as it had all the required footprints readily available. The circuit is fairly simple as the ATmega 1284P has the minimum hardware connections required (along with a 16MHz crystal) to operate along with the TVout connections (RCA socket) and the PS/2 keyboard connections (mini din socket).
Note, the above circuit diagram shows the keyboard clock pin connected to pin 1 of the jumper j2 (also pin PB0 of the ATmega 1284P). The pin PB0 cannot be used for GPIO as it is in use for the keyboard clock (despite it being connected to pin 1 of j2). If using this circuit diagram, it may be best to not connect the pin PB0 to anything other than the keyboard clock line.
The TVout pins are PD5 (for sync) and PA7 (for video) and the PS/2 keyboard pins are PD0 (for data) and PB0 (for clock). To power the circuit, a 5V voltage regulator is used (along with two capacitors) to allow various input voltages from different source to be connected (such as a 9V PP3 battery or 12V wall mounted PSU). A 2.1mm barrel jack (same power jack as Arduinos) is used to allow power supplies to be connected. An on-board LED is used to indicate when a power supply is connected.
Some female pin headers were used to allow connections to the input/output (IO) pins of the ATmega 1284P, connections to the second UART (serial port) of the 1284P and connections to 5V and ground from. This allows various circuits and components to be connected to the system such as LEDs, potentiometers, LDRs etc and allows power to be taken from the board. The serial port header is present on the PCB but serial communications have not been enabled within the TinyBASIC Plus source code as serial communications clash with the keyboard library I used.The Fritzing project file can be found at the schematic link.
-
3Step 3
The PCB:
Once I had used the program Fritzing to design the PCB, it was sent off to a PCB manufacture to be produced using the isolation milling process. The PCB is single sided as a double sided PCB was not needed, due to the fairly low component count on the PCB. Only two jumper parts are needed; I used two 0 ohm resistors.
Fritzing was used as it had all the parts I needed readily available. The Fritzing parts library had the right footprints for the RCA socket and the PS/2 mini din socket meaning they did not need to be created. Other programs such as KiCAD and Eagle could be used if needed but, in this case it was easier to use Fritzing.
Instead of creating a PCB, a piece of strip/matrix board could be used (or even a breadboard) but other connectors would be needed due to some of the footprints; the RCA socket and the 2.1mm barrel jack are two examples of components which cannot be attached to stripboard.
The PCB could be optimised in certain ways such as making it smaller by moving the components (such as the female pin headers around the ATmega 1284P) closer together and if a double sided PCB was being used (with features such as through-hole plating), the jumper parts could be removed.The Fritzing file (which contains the schematic and the PCB layout) can be found at the schematic link. Also, the etchable PDFs for the circuit can be found at the etchable PDFs link.
-
4Step 4
The Firmware:
The standard TinyBASIC Plus sketch had to be modified in order to create a standalone computer system. The unmodified version of TinyBASIC Plus uses the serial port of the AVR to allow users to interact with the software and create programs. I imported the TVout library and replaced all serial output calls (Serial.write() etc) with TVout calls (TV.print() etc). The standard PS/2 keyboard library clashes with TVout causing strange output to be shown on the TV and the keyboard not being read correctly but, after some research, I came across a library known as PS2uartKeyboard which uses the XCK0 pin and RX0 pin of an AVR to connect to the keyboard in order to allow a PS/2 keyboard to work with the TVout library. This library can be found here near the bottom of the page:
https://code.google.com/p/arduino-tvout/issues/detail?id=38
(Actual library link here)
I tested the PS2uartKeyboard library and the TVout library together and they worked fine so I added the PS2uartKeyboard library to the TinyBASIC Plus sketch which resulted in creating a working standalone computer system. The serial calls which read serial input in TinyBASIC Plus were replaced with keyboard calls to read the keyboard input. As the TVout library, the PS2uartKeyboard library and TinyBASIC Plus sketch were all running on the same AVR, the computer requires only a single chip (one AVR) in order to operate. I started TVout using the following line:
TV.begin(PAL, 720, 480);
which starts TVout at a higher resolution than the default in order to fit some of the text output from TinyBASIC Plus on a single line as at the default resolution, some of the text wraps to the next line. Note, a resolution of 720x480 is not being generated here as it is divided down by the TVout library to a lower resolution. Starting TVout like this uses around 8KB of the ATmega 1284Ps SRAM (for the video buffer). I had to alter the RAMEND value in TinyBASIC Plus in order to allow enough memory for the video buffer required by TVout and I also changed the break key used in TinyBASIC Plus (it was previous CTRL+C) because control keys are not supported by this PS2 keyboard library (I used the escape key instead).
I had to use the original ATmega 1284P 16MHz bootloader in order to stop any TVout glitches which occur when using the optiboot bootloader (the original bootloader does not cause these glitches). When compling the sketch in the Arduino ERW IDE, the sketch size is less than 22KB and the estimated SRAM usage of the AVR is nearly 9KB (leaving around 8KB for the TVout video buffer). The TinyBASIC Plus sketch can be found at the code link.
The ATmega 1284P Arduino bootloader can be found here:
https://github.com/fakufaku/mighty-1284p
The original TinyBASIC Plus code can be found here:
https://github.com/BleuLlama/TinyBasicPlus
The TVout library can be found here:
https://code.google.com/p/arduino-tvout/
Please note, TinyBASIC Plus, Arduino software (bootloaders, IDE etc), the PS2uartKeyboard library and the TVout library all hold there own software licences which must be followed if using any of the creators code. -
5Step 5
Completed PCB:
Once I had all the components and had received the PCB, I assembled it and carried out some basic multimeter tests ensuring no short circuits were present (mainly ensuring no pins had shorts to the ground plane). No issues were present with this PCB and everything appeared to operate correctly once assembled so I programmed the TinyBASIC Plus sketch from the Arduino IDE (using an Arduino UNO as an ISP).
Once I had connected a TV and a PS/2 keyboard, I was met with the TinyBASIC prompt which indicates the amount of memory available for programs, the software version etc showing everything was running OK. TinyBASIC Plus reported 7692 bytes (7.692KB) are available for programs and the ATmega 1284P has 4KB of EEPROM to save programs to.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.