Handheld BASIC Computer

7,859

100

17

Introduction: Handheld BASIC Computer

This Instructable describes my process of building a small handheld computer running BASIC. The computer is built around the ATmega 1284P AVR chip, which also inspired the silly name for the computer (HAL 1284).

This build is HEAVILY inspired by the amazing project found here and the SuperCON BASIC Badge.

The computer runs a modified version of TinyBasic, although much of the software is based on the project by dan14. You can of course follow this Instructable, or even better, improve on it since I made a few mistakes.

For this project, I also created a manual. It mentions some bugs and specifics for the chosen monitor but most importantly, it has the list of BASIC operations.

After this was published, I made a video showcasing the project.

Step 1: Parts I Used

For the main IC:

  • ATmega 1284P
  • 16MHz Crystal
  • 2x 22pf Ceramic Capacitor
  • 10KΩ Resistor (For reset pull up)
  • 4-pin button (For reset)
  • 470Ω Reistor (For composite video)
  • 1kΩ Resistor (For composite video sync)
  • 3-pin jumper (For video signal)
  • Passive Buzzer

For keybaord control:

  • ATmega 328P (Like the ones used in the Arduino Uno)
  • 16MHz Crystal
  • 2x 22pf Ceramic Capacitor
  • 12x 10KΩ Resistor (For reset pull up and buttons)
  • 51x 4-pin button (For the actual keyboard)

For power:

  • L7805 Voltage Regulator
  • 3mm LED
  • 220Ω Resistor (For LED)
  • 2x 0.1µF Electrolytic Capacitor
  • 0.22 µF Electrolytic Capacitor (You could substitute this 0.22 and one 0.1 for one 0.33. I've also been told that the values doesn't really matter, but I'm not great with capacitors)
  • 2x 2-pin jumper (For power input and for main switch)

GPIO (Maybe add a couple more grounds):

  • 7-pin Jumper
  • 2x 8-pin Jumper
  • 2-pin Jumper (For 5V and GND)
  • 3-4-pin Jumper (For Serial Communication)

Non-PCB:

  • 4" LCD Display with Composite Video (Mine had an input voltage between 7-30V)
  • 3D printed holder for display
  • Some sort of switch

Step 2: The Circuit

The circuit isn't very pretty and much of the main IC-region is inspired by dan14. That being said, it is a pretty straight forward Arduino on a Breadboard-circuit. The keyboard is a simple grid and is controlled by the ATmega328. The two AVR chips communicate via the UART Serial pins.

Both an image and my Eagle-files are attached and will hopefully be enough to recreate the circuit. If not, feel free to inform me and I'll update the Instructable.

Step 3: The PCB

The PCB is 2-layered and created using Auto Route (Oh, what an a**hole!). It has buttons and power indicator LED in the front and the rest on the back. I had my PCB made with JCL PCB, and they did an amazing job with it. The files needed to recreate the PCB should be in the Eagle-files from before.

I would suggest that you redesign the PCB, as I have some things I would like to have done differently. If you like my design, I still have (as of writing) four unused boards that I'm more than willing to sell.

The board has four drill holes that I have used for mounting the LCD Display.

Step 4: Uploading the Code

Both the 1284 and the 328 of course need code and the code I used can be found here: https://github.com/PlainOldAnders/HAL1284 under ArduinoSrc/src. I simply used the Arduino IDE for modifying and uploading the code but before that can be done, you'll need to burn bootloaders on the ICs:

ATMega328:

This one is easy, in the sense that there's a lot of support out there on how to burn a bootloader and upload code to this IC. I usually follow this guide, mostly because I keep forgetting the specifics.

The code for the 328 (under ArduinoSrc/keypad) is fairly simple. It totally relies on the Adafruit_Keypad-master-library. In case anything changes about the lib, I've included the version that I used on my github-page under ArduinoSrc/lib.

ATmega1284:

This was a bit difficult for me when I first got the IC. I started out by getting the bootloader from here, and followed the install-guide. To burn the bootloader, I simply did the same thing as with the 328 and got help from here. For both ICs I just used an Arduino Uno for both burning the bootloader and uploading the code (removed IC from Arduino Uno when uploading).

The code (under ArduinoSrc/HAL1284Basic) is much too complicated for me but I was able to modify some parts of the code:

I added a couple of commands (those marked with [A] in the manual.pdf), and I also changed other commands:

Tone: The tone command just used Arduino's tone-function before, but when using the TVout library, this caused the buzzer to not work properly. I changed it to use TVout's tone-function, but this means that the tone pin HAS to be pin 15 (for the atmega1284)

Serial Communication: Since the keyboard is DIY, it uses serial communication for reading the characters. Since the atmega1284 is used here, there are two available serial communication lines, and when "sercom" is enabled, the code also allows for writing via the serial port (from a computer or whatever).

Resolution: The monitor used for this project is pretty dumb, and a small resolution is needed, or else the picture flickers. If a better monitor is used, I would suggest that you change the resolution in the setup function.

Step 5: Assembly

With the code uploaded and the PCB and parts ready, it's now time for assembly. All the parts I used were through hole, so the soldering wasn't too difficult (as opposed to the badass-SMD-soldering-fellas out there). The monitor was fastened to the four drill holes in the PCB with a 3D printed holder. If another monitor is used, the four drill holes can hopefully be used for mounting this.

The monitor holder used here, is also designed to house a toggle switch (connected to the "switch" jumper on the PCB) and the three control buttons for the monitor. The holder is fastened with plastic M3 bolts and spacers.

For the power plug I used a JST PCB connector, although a slick barrel jack would've been a bit more smooth. To power the board, I switched between a 12V power supply or three 18650 batteries in series. A smoother cowboy than myself could probably design a slick battery holder for the board.

Step 6: Bugs and Future Work

Arrow Keys: The Arrow-keys were put accidently and don’t serve much function. This makes navigation difficult

File I/O: There exists File I/O capabilities but these are not implemented. To combat this, the HAL1284Com software is able to upload files to the board. It is also possible to upload to the EEPROM.

PEEK/POKE: PEEK and POKE are untested, and I’m not sure what the addresses are.

Break: Break (Esc) has sometimes been messing with the entire code, when in infinite loops.

Pin 7: The PWM pin 7 can be difficult when trying to DWRITE High or AWRITE 255. It works fine with AWRITE 254.

Idiot: It would be ideal to also be able to upload via UART1 but upload is only possible via UART0, so upload will have to be done by extracting the main IC. The Screen and Voltage Regulator 5 gets a bit too hot when running for a long time.

Be the First to Share

    Recommendations

    • Reclaimed Materials Contest

      Reclaimed Materials Contest
    • Made with Math Contest

      Made with Math Contest
    • Hide It Challenge

      Hide It Challenge

    17 Comments

    0
    themelispan
    themelispan

    10 months ago

    Really quite nice project! I have some ideas for version 2:
    1) You can add an SD card module (if the chip supports it) to have plenty of storage to work with.
    2) You can glue some pieces of metal (or coolers if you have) with thermal paste to take the heat away from the regulator. It is more difficult for the screen but if you glue it to a metal surface, it'll be ok.
    3) Maybe add a plastic case to protect the circuit from dust, shortcircuiting by touching the PCB and water drops
    4) Add a battery to make it completely independent; since it is so small I think it is a must. Better make it rechargable

    0
    PlainOldAnders
    PlainOldAnders

    Reply 10 months ago

    Hi, and thank you! You have
    some great ideas and I'm going to address them individually:

    1) I’m fairly sure the chip supports SD cards. This is the File I/O setting I mentioned in the “Bugs and Future Work”-section. The reason I didn’t pursue this is two-fold: Firstly, I didn’t have an SD card reader lying around and I didn’t have time to wait for one in the mail. Secondly, I only had time for one shot at PCB development and I didn’t want to add too much to the board if I wasn’t going to use it.
    That being said, I think it’s
    an excellent idea and I hope if anyone makes (and improves) this project, they
    will include SD support!

    2) Heat sinks are a great idea. I also could’ve put it directly on the PCB but this problem only occurred to me AFTER I got the PCB in the mail (one shot at PCBs, huh?), and any heatsinks added at this point, would just underline the poor design… So, great idea too and cooling should DEFINETLY be considered in the next one!

    3) A plastic case would, no doubt, make the computer much safer to use. Even better, I think it would be awesome to design some stupidly wild case for this ting (maybe even make it a laptop?) but I wanted the simple “one-board-design”, and that’s why I went with the exposed PCB. A bit like that supercon badge I mentioned. Still, I might try and design some case and add it here?

    4) I made a YouTube video for this, that I should probably add here. It can also be used with three 18650 batteries but it’s not very handy. After getting the PCB back, I had hoped to be able to add some mount for a battery holder on the back of the keyboard. 2-4 drill holes would make mounting very easy, or even some double-sided tape? I still have time, but with the overly bulky monitor holder, I feared everything got WAY too bulky.


    I REALLY like comments like these that help shoot dumb little projects ideas to cool little projects, thank you for leaving them here! My next idea was actually to make the same stupid mistake that every computer manufacturer does and MAKE IT EVEN SMALLER. I haven’t really tested it yet (or have had the time for that matter) but the idea is to use SMD buttons, OLED display and one Atmega328.

    Tl;dr
    Your ideas are awesome!

    0
    PlainOldAnders
    PlainOldAnders

    Reply 10 months ago

    Hey man, that looks great! Thank you!
    Without auto router, too?

    I hope everyone reads these comments, this is amazing

    0
    PlainOldAnders
    PlainOldAnders

    Reply 10 months ago

    Thanks!

    0
    prabbit237
    prabbit237

    10 months ago

    In the following paragraph:

    Both the 1284 and the 328 of course need code and the code I used can be found here: https://github.com/PlainOldAnders/HAL1284 under ArduinoSrc/src. I simply used the Arduino IDE for modifying and uploading the code but before that can be done, you'll need to burn bootloaders on the ICs:

    The link to Github has a period at the end (the actual link, not the text.) It goes to https://github.com/PlainOldAnders/HAL1284. and gives an error. It should be going to https://github.com/PlainOldAnders/HAL1284

    0
    PlainOldAnders
    PlainOldAnders

    Reply 10 months ago

    Great catch! Thank you! I tired to edit it but I don't think it works yet? I'm new to publishing instructs les but thanks for letting me know!

    0
    AlyssonR2
    AlyssonR2

    10 months ago

    Nice little project to produce a very retro-feeling device.

    Shame about the arrow keys - but they were never a thing with the old SBCs.

    0
    PlainOldAnders
    PlainOldAnders

    Reply 10 months ago

    Thank you and good point

    0
    Barkfin
    Barkfin

    10 months ago

    I think this is just fantastic.

    0
    Alex in NZ
    Alex in NZ

    10 months ago

    What a cute little SBC. This has a real vibe of what hobby machines were like in the late 70's Thank you very much for sharing it :-)

    0
    randofo
    randofo

    10 months ago

    Very cool. Thanks for sharing.