Tiny Handheld BASIC Computer
by PlainOldAnders in Circuits > Arduino
5615 Views, 39 Favorites, 0 Comments
Tiny Handheld BASIC Computer
This tiny project is a smaller version of another project I made roughly six months ago. The other project was fun, but I had a couple of hardware and user issues that bugged me. Besides the bugs from the previous version, I also wanted to make it a lot smaller, since the previous version was a bit clunky. This project has a width of 47mm and a height of 65mm. I am very pleased with the size of the PCB, but the depth of the board is 28mm due to a silly choice in components.
Even though I wanted to fix some bugs with the old project, this project also has a lot more bugs as well and is probably a bad idea to build. That being said, it’s very fun.
After this was published, I made a video showcasing the project.
Parts I Used
- SSD1306 OLED 128x96 display
- 4pin female jumper for display
- ATmega 328P-PU (Like the ones used in the Arduino Uno)
- 28-pin IC-socket for Atmega
- 6-pin angled male jumper pins
- 260mAh 3.7V battery
- Tiny nylon strips for the battery
- Battery charging board
- 50x 3x4mm SMD buttons (I couldn't find any Eagle library online for these)
- Small 3pin toggle switch
- 8x 10K resistors (Although one resistor wasn't needed after all)
- 2x 22pf Ceramic Capacitor
- 16MHz Crystal
The Circuit
The circuit is built mainly around the Arduino on a breadboard-circuit with regards to the crystal, ceramic capacitors and reset-resistor. It also uses I2C-communication with the display and a button-matrix for the keyboard. There are two ways to power the device: the first way is from the battery charging-board that is soldered to the PCB and is led through the switch. The other way is through the 6-pin jumper. These pins make it possible to upload code to the device without having to take out the IC and can also power the device. DO NOT turn on battery power while powering through these pins. Lastly, there is a single GPIO (pin 9~) that is programmable via BASIC.
There are two errors in the circuit! I have tried to mark these in the Eagle-files provided and, on the circuit.
- Error 1 (Orange square on image): The shift key connected to resistor R8 has one button-pin connected to a GPIO on the IC and the other button-pin connected to a pull-down resistor (R8) but not connected to VCC, because I forgot. I shorted the resistor and used the ATmega’s input pull-up resistor instead. I have not fixed this since it is easy to just replace with a resistor with a very low resistance or a wire.
- Error 2 (Blue arrows on image): For some reason, resistor R3 didn’t connect to the IC’s pin 13 (digital pin 7) on the PCB. I made a physical connection on the PCB and corrected the mistake in the files.
Downloads
The PCB
The PCB is 2-layered with a green solder mask and routed using the Auto Router. I blame the auto router for the aforementioned error 2 but I think it might have been my fault. Let’s pretend it was the auto router’s fault though. It is designed in Eagle and developed by JLC PCB. The buttons were soldered by hand with an iron and this was difficult but not impossible. There is a hole in the upper right corner to make it look like a key chain, but I could NEVER imagine carrying this with my keys. There are also two holes between the display and keyboard for mounting the battery.
On the back, I soldered the battery charging board with the USB port facing down. The board is not made for SMD soldering, but it works fine. There are also holes for mounting the display. The holes came with the library and are probably a good idea to use, although I have not used them yet.
Uploading the Code
If you’re just ripping the ATmega328 from an Arduino Uno, you can just upload the code to the IC, and use it as is. If you’re using a new ATmega328, you have to first burn a bootloader on it. I usually follow this guide.
The code used for this project is a modified version of the code used for my previous project (the HAL1284). The code can be found here and it should be noted that it is not completely finished. There are still some issues with backspace and memory optimization. The main differences between this version and the previous HAL1284-version, are of course a different display which limits the various added Draw-functions as well as moving the keyboard into the code. Before, textual input was read from UART-bus, but now the Adafruit keypad library is used instead. This also lead to some changes around the code.
Assembly
Assembly is pretty straight forward if you are comfortable with soldering, but I could imagine this being difficult for beginners. I personally start with the shortest components and then work my way up to the taller and bulkier ones.
It’s worth noting that I replaced the jumper pins on the OLED display with some other pins I had lying around where the female ones are shorter. This makes the display protrude less from the board.
Other than PCB soldering, I soldered the battery cables to the battery charging board, and then fastened the battery with nylon strips. Now you’re ready to get frustrated with a stupidly small keyboard!
Bugs and Future Work
The device is fun, but there are A LOT of problems with it that makes it near useless and act mostly as a novelty as opposed to an actual usable computer:
Keys: I noticed that the board sometimes writes A LOT of strange characters out of nowhere. I had no idea what it was, until I noticed that the capacitive signal from my fingers caused some errors with the board. I have to hold the board on the sides, because if my fingers get too close to the back, it starts messing up. This could also be because of the battery on the backside, but the problem was also there before mounting the battery.
Keyboard: It was fun at first with the tiny keyboard, but it is TOO tiny. The characters are too difficult to read and backspace messed up. I also accidently printed “VOUT” next to the ‘O’-key making it look funny. You really have to know the keyboard by heart to use it.
Reset Button: The reset button is tucked a bit too far way between the battery and the IC.
Schematic Errors: They are more easily fixed but annoying.
Memory: It’s not often you run into a lack of memory in 2021 but the ATmega328 does not have enough space to do anything fun with the BASIC program. My previous device using an ATmega1284 had a lot more memory and that really becomes important with something like this. The standard OLED Display library is great, but I can’t use it for this device, so I had to use an ASCII-only-library.
Backspace: The lack of a proper backspace is annoying, but it is fixable. I need to update the code.
SMD: I have never really used SMD components for hobby projects before this one, and they certainly make things easier! I wish I had used the smaller ATmega328 (but preferably a better IC) and SMD resistors. I think I could have improved the look.
Thickness: The device is a little too thick because of the battery, IC, and display. I was afraid of soldering the display directly on if something were to go wrong. I’m not too happy about applying more heat than necessary to the display. I also tried to go with button cell batteries, but they were insufficient in powering the display, but a slimmer battery would be nice.
Power LED: I would’ve liked a power LED.
Function Keys: Seeing as I worked with a button matrix, I had two leftover buttons that I didn’t know what to do with, so I left them as “Function Keys” (F1 and F2 and with shift: F3 and F4). They don’t do anything right know, but I could potentially map BASIC commands or arrow keys to them.
Firmware: The code for the device is a modified version of my previous project and is, as of writing, unfinished. There are BASIC commands present that will not work. I would also have liked to create a small manual for the board, much like I did with my previous project, but I, not sure this device deserves as much time.
Generally, this device has been a lot of fun to build and I think it looks great but a device this size needs proper components, “CPU” and time.