close-circle
Close
0%
0%

Single Chip AVR BASIC Computer

A computer running the BASIC programming language, generating composite video and reading PS/2 keyboard input using a single AVR.

Dan
Similar projects worth following
close
A single AVR microcontroller (the ATmega 1284P) has been used to create a standalone computer system which runs the BASIC programming language. The 1284P runs TinyBASIC Plus, generates composite video signals (using TVout) and reads PS/2 keyboard input.

A single sided PCB was used to hold all the components meaning it is easy to manufacture the computer at home using processes such as photo-etching. Additionally, the component count is fairly low and only one IC is required (the 1284P).

I created this project as a sort of follow up to my Arduino BASIC Shied project which used a custom designed shield to turn the Arduino UNO into a computer running the BASIC programming language. The shield worked correctly but two reasons made me decide to design a new computer; the TVout resolution was low meaning some of the lines were wrapped onto next line and an Arduino was required to operate the computer (it was not entirely standalone). I decided to design a new computer which would still run BASIC but use only a single AVR microcontroller to keep circuit design simple, the component count low and the cost down.

After managing to find a PS2 keyboard library which worked with TVout without causing any issues, I modified the TinyBASIC Plus sketch to use TVout and the PS2 keyboard (rather than serial) and tested it the ATmega 1284P (I am using the Arduino bootloader and IDE to program to the 1284P) which worked correctly. It was then a simple case of designing a PCB and sending it off to be manufactured. I was able to keep the PCB single sided by using two jumper parts (two 0 ohm resistors). The build instructions on this page explain the process of building the computer step by step.

Once the computer had been completed, I had a functioning standalone system which uses a single AVR microcontroller.

The computer has some of the GPIO pins of the 1284P mapped to female pin headers allowing components to be connected. Pin headers are also used to allow the power supply rails to be connected to. By connecting a PS2 keyboard, composite video enable display (such as a TV which has a yellow RCA socket) and a power supply (such as a PP3 battery), the computer can be used and programmed in BASIC. The EEPROM of the 1284P is used to save the BASIC programs to.

Ideally, I would like to have included an SD card for program storage but I was having issues with the FILES command (the TinyBASIC command) displaying random characters on the TV. Autorun BASIC programs are found and run fine (when an SD card is attached) but the FILES command does not show a list of files on the SD card like it is supposed to (rather the random characters). I am unsure of the issue which is causing this (it may be linked to the variable types used to store the file names and the different variables used by TVout but I am unsure) so I did not include an SD card. If this issue was fixed, I would include an SD card on a future version.

In summary, I have been able to create a standalone computer system running the BASIC programming language with composite video generation and PS2 keyboard reading using only a single AVR microcontroller.

  • 1 × ATmega 1284P
  • 1 × DIL 40 Pin 0.6" IC Holder
  • 1 × 16MHz Crystal
  • 2 × 22pF Ceramic Capacitors
  • 1 × 2.1mm Barrel Jack

View all 15 components

  • *Update* - PCBs & Component Kits

    Dan05/16/2015 at 22:30 1 comment

    More PCBs and component kits are now available on Tindie. The kits contain all the components required to assemble the PCB to create a fully working computer.

    See the links on the left hand side of the page. Additional information can be found on my website: http://www.danselectronic.systems/projects/avr-basic-computer-v0-1/

    I currently have 10 kits available and 14 PCBs.

  • New PCBs

    Dan12/06/2014 at 20:24 0 comments

    The design of this computer has been updated and I have PCBs available for sale through eBay (using the link on the left - "Purchase PCBs"); the direct link http://www.ebay.co.uk/itm/121510974344

    A new page dedicated to this new computer design has been created: https://hackaday.io/project/3537-avr-basic-computer-v01

    This design includes an additional EEPROM IC to allow full size BASIC programs to be saved. The PCBs are white in colour with ENIG finish.

  • New PCBs and assembly

    Dan08/14/2014 at 17:05 0 comments

    I have received the new PCBs and assembled one of them which can be seen in the above image. A few changes have been made to the design of the PCB compared to the previous PCB including:

    - Changing of the naming of the computer (now V0.x - this PCB is v0.3)

    - Added a USBasp programming header

    - Added a female header labelled "Storage" which allows a small PCB containing a 25LC640 EEPROM IC to be connected (see below images). A male pin header labelled "MEM Select" allows the user to select between the internal and external EEPROM for saving BASIC programs to. This feature was added to allow larger programs to be saved as the ATmega 1284P only has 4KB internal EEPROM.

    - Mapped all GPIO pins which are not in use to male pin headers (except analogue reference).

    - This PCB was also designed in KiCAD rather than Fritzing.

    The remaining PCBs have been put on eBay and can be found at the following link:

    http://www.ebay.co.uk/itm/Single-Chip-AVR-BASIC-Computer-V0-3-Printed-Circuit-Board-PCB-Black-Colour-/121410644845?

    I have started a new HaD projects page which focuses only on this new PCB (single chip computer V0.3); this new page will contain a link to the firmware, the schematic, some details and possibly more. The following link is for the new project page:

    https://hackaday.io/project/2428-Single-Chip-AVR-BASIC-Computer-V0.3

  • More PCBS Ordered

    Dan07/28/2014 at 12:17 0 comments

    I have just ordered some more PCBs for the single chip computer and added a few new things such as a USBasp programmer header, a few more GPIO pins and a header to allow a connection to a small PCB containing a 64Kbit EEPROM. I will be putting these PCBs up on eBay once I receive them.

  • Taking this project further

    Dan07/14/2014 at 18:52 2 comments

    I would like to take this project further by adding more features to the computer and would like to get the communities opinion on the sort of features which should be included in a future version. Adding more features most likely means moving away from a single AVR chip so the computer would have to be called something else. I was thinking about changing the language which is run on the computer to Bitlash (rather than TinyBASIC) as Bitlash allows custom commands to be added fairly easily and hence makes it easy to add additional hardware. The following list shows the possible features which could be added so if anyone has time to let me know what they think (should they be included or not etc), I would appreciate it:

    A) running Bitlash instead of TinyBASIC as it seems much easier to extend Bitlash compared to TinyBASIC

    B) expanding SRAM of the computer by adding a 23LC1024 (128KB) SPI SRAM IC - the entire SRAM IC would be available to the user for storing bytes (not for storing programs created with BASIC or Bitlash). May even be possible to add a SIMM memory socket (such as via another 1284P, a 328P or IO expander).

    C) expanding program storage using an EEPROM IC / SD card (downside with the SD card is soldering a surface mount socket at home and the addition of the extra hardware including a 3.3V regulator, level shifting and the socket)

    D) some form of networking such as Ethernet (using an ENC28J60), RS485 or RS422

    E) moving video generation to a separate 1284P to give the main 1284P maximum SRAM for writing programs (offloading the video buffer to a separate AVR). I would like to stick with TVout as the hardware is simple and the library is easy to use (I was looking into Nick Gammons VGA video generation sketch for the Arduino but the resolution is too low - if this could be increased it would be something to consider).

    Thanks in advance for any comments.

  • Thanks for the support!

    Dan07/12/2014 at 14:17 0 comments

    I have sold all the PCBs which I put on eBay so would just like to say thank you to everyone who purchased one. I appreciate the support you provided by purchasing a PCB :)

  • New PCBs on eBay

    Dan06/17/2014 at 13:59 0 comments

    I have put the remaining new PCBs up on eBay if anyone is interested in them. The following address is for the listing:

    http://www.ebay.co.uk/itm/Single-Chip-AVR-BASIC-Computer-PCB-Printed-Circuit-Board-/121365425871?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item1c41f16ecf

  • Assembly of new PCB

    Dan06/16/2014 at 18:48 1 comment

    Today I assembled one of the new PCBs and it works as expected. With this PCB, I used male pin headers for the IO pins as I personally think they look better than female pin headers (especially when cutting female pin headers down as they usually leave an untidy edge). When testing IO pins, I found pin 1 of the AVR (although mapped to a pin header) cannot be used for GPIO as it is in use by the keyboard (this is something which could be addressed in a later version of the PCB). I have also changed the main image of this project to the new PCB.

  • Arrival of new PCBs

    Dan06/12/2014 at 21:03 1 comment

    Today I received the new PCBs in the post which I previously ordered from DirtyPCB. They look great and I will be assembling one of them in the next few weeks. As I have ten of these PCBs, if anyone is interested I may put a few on eBay.

  • Updated design (version 2) sent to be manufactured

    Dan05/28/2014 at 21:35 2 comments

    After seeing the HaD post regarding DirtyPCB, I updated the design of the single chip computer (added a reset button, removed the jumper parts, added a capacitor across the AVR supply pins, moved some components closer together etc as shown in the PCB layout below) and sent the files to DirtyPCB. I am currently awaiting the arrival of the PCBs.

View all 10 project logs

  • 1
    Step 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

  • 2
    Step 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.

  • 3
    Step 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.

View all 5 instructions

Enjoy this project?

Share

Discussions

kimtherock wrote 09/26/2017 at 15:00 point

Hi
I was wondering if I could purchase a kit of the avr basic computer or a PCB of the said kit
How much would that be.

I have been looking at your progress and I am impressed so I have to have one.

Many thanks

Kim

  Are you sure? yes | no

luc.de.smedt1 wrote 03/29/2017 at 11:14 point

Hi Dan, can I still purchase a kit ?

  Are you sure? yes | no

Takanuva588 wrote 11/26/2016 at 15:39 point

Hello, I've been able to get everything working for the most part but it appears that this computer generates PAL composite video. Is there a way to alter it so it can make NTSC video? Like altering the arduino code?

  Are you sure? yes | no

Andrey Skvortsov wrote 05/04/2017 at 08:29 point

In the instantiation of the TVout library main object you can try to change the PAL or _PAL macros to NTSC

  Are you sure? yes | no

Richard Štefún wrote 05/31/2015 at 13:52 point

Hello Dan, I created complete portable 8-Bit computer, also based on ATMEGA1284p and TinyBasicPLUS as you! You can check it out on my page :)

  Are you sure? yes | no

kodera2t wrote 11/29/2014 at 13:33 point
Hello Dan, I made a compatible one! It works perfectly! Thank you for your great job!
https://www.youtube.com/watch?v=XszcTqUQVZM&list=UULE2SRkdTBHHXjxj7Rm6j8g

  Are you sure? yes | no

Dan wrote 12/04/2014 at 01:20 point
Amazing! Thanks for the nice comment :)

  Are you sure? yes | no

mac_ha wrote 07/12/2014 at 17:35 point
Great project, will be perfect for my son to build himself to learning BASIC programming! Need to find the MCU first, though, and the first question: why in the schematic it says ATmega644, while everywhere else you mention ATmega1284P? Any other MCU could be used? What are the requirements - speed, memory/flash size, etc.? Any advice is very much appreciated. Many thanks.

  Are you sure? yes | no

Dan wrote 07/12/2014 at 17:56 point
Hi,

The schematic was created in Fritzing which has the ATmega 644 part already available and as the 644 is pin compatible with the 1284P I just used the 644 part (I could of just used a blank DIP part but then I would need to add pin names and using an already available part was just easier). It might be possible to use other microcontrollers such as the 644 but the code would need to be altered for the lowered RAM (on the 1284P around 8KB of SRAM is for the video buffer and the rest is for TinyBASIC). Using any other AVR than the 1284P means less TinyBASIC program space and the video buffer would need to be reduced (i.e. the resolution lowered).

The compiled size of the sketch is 22.476KB and the speed requirements are a 16MHz crystal (it may be possible to use a lower value crystal but not sure what will happen with the TVout library as I think it is designed to run on 16MHz AVRs).

Dan

  Are you sure? yes | no

MobileWill wrote 07/11/2014 at 22:19 point
Sweet! I would love to try and run my old BASIC programs. Any chance you can sell a kit on Tindie? That would rock. Maybe I can help if you don't want to deal with shipping and stuff.

  Are you sure? yes | no

Radu Motisan wrote 07/04/2014 at 07:23 point
I just purchased one of the boards - to show some support for this nice project

  Are you sure? yes | no

Stian Soreng wrote 06/10/2014 at 06:51 point
Just a tip from someone who built this before: try using SPI2X for serializing the video output, or alterately use a 74165 PISO. You'll get much better video resolution, definitely worth it.

  Are you sure? yes | no

Radu Motisan wrote 07/04/2014 at 07:22 point
can you provide more details?

  Are you sure? yes | no

The Big One wrote 06/09/2014 at 02:48 point
Nice implementation! I am definitely amazed at the power of the 'lowly' AVR chip.

  Are you sure? yes | no

Jasmine Brackett wrote 06/04/2014 at 18:56 point
Hey Dan. I thought I would let you know that this project is featured on the homepage today. Nice work.

  Are you sure? yes | no

zaphod wrote 05/28/2014 at 22:31 point
wow! this is a cool project. I've always wanted to do something similar.

  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