AVR microcontrollers can do pretty much anything nowadays. Blinking LEDs, handling sensor inputs, engine control modules, and now, thanks to [Dan], a small single chip BASIC computer with only ten parts (and four of them are capacitors).
[Dan]’s homebrew computer has it all. The ATmega 1284P microcontroller outputs a composite video signal and handles inputs from a PS/2 keyboard. The microcontroller runs at 16 MHz, has 7 kB of memory for programs, and can use a separate EEPROM to store data. It also has an array of GPIO pins for interacting with the physical world.
For software, the microcontroller runs a version of BASIC called Tiny BASIC plus, which is a stripped-down language that can fit in 3 kB of memory. This is crucial if you’re in the 1970s or if you’re programming on an AVR microcontroller in the 21st century.
We’ve seen other Arduinos and AVR-type microcontrollers that can run BASIC, but this one has a great form factor and clean look. It’s also a great way to get familiar with homebrew computing and the BASIC programming language!
38 thoughts on “The Most Basic BASIC Computer”
Me thinks you may want to check that 10 components number.
Well, it’s 10 if you don’t count the AVR, the PCB, that power inverter, the power plug, ps/2 plug, componet video out plug, and the various connectors. =)
I think they mean “and four of them are resistors” too… I count five capacitors.
Oh dear… now I’m getting in on this nitpicking. Next thing you know, I’ll be yelling about how it could all be done with a 555 and seven thousand discrete components. Slippery slope, my friends… slippery slope.
Actually redesign it with one input NAND gates :)
10 is what you get if you look at the component list and DON’T click on “See all components”. AND you don’t count the AVR.
Have a look at the firmware with its spaghetti style and you see that “basic” (sic!) is the principal theme of the entire project.
I wonder if you could squeeze an S100 bus (or an Apple II bus for that matter) out of those GPIO pins… might make an interesting co-processor/debug board for probing retro machines… loving the fact that TinyBasic (http://en.wikipedia.org/wiki/Tiny_BASIC) is still alive after all these years. Mr Gates’s “software as a product rant” may be long forgotten (but no doubt he is still laughing as he chats with his bank manager), but the spirit of Dr Dobbs journal and open ideas lives on.
I doubt it – considering the S-100 bus has 100 pins (hence the name); the Apple II bus has 50 pins.
The only way you’d be able to do it would be more external hardware bit-banged with the gpio pins, or using SPI. Then you’d still have to deal with the whole Havard architecture, which might cause challenges with interfacing old hardware (if that was a goal).
It’d probably be better just to design a new “retro-machine” using some other more general-purpose (but available) 8-bit cpu (many Z-80 variants still exist – there’s also the venerable 80C52).
Indeed there are 50 or 100 pins, but not 50 or 100 useful signals, but I agree it would not be *easy* to interface to an S100 backplane, I just threw out the possibility of it being an interesting idea to *try* to interface to an S100 bus. Nobody actually *needs* to speak to an old S100 peripheral like an ST506 hard disk controller, but it might be fun to give it a try.
First of all I want to thank Dan for posting this project, because this is exactly the product I was looking for to replicate in order to learn something, because I always wanted to do this, but doesn’t have the knowledge. The standalone element really excites me.
I also seek to recieve some advice about how I have to compile the firmware in something that I can flash, considering my high noob -factor. Could someone please write me here step by step what I have to do?
I am just wondering why a 16MHz crystal instead of the 20MHz crystal which should be compatible and run faster.
An EEPROM to store data? I want full-on retro, where are the audio cassette tape jacks?
I can’t complain about the generous 7 KB of RAM since I had the luxury of a 16 KB (!) RAM expansion pack on my Sinclair ZX-81 back in the day.
It has a composite out – backup to a VCR. Think of the bandwidth! It’s only ‘restore from backup’ that’s a problem at that point.
Yeah, composite IN is a bit more challenging. But not insurmountable. As long as you don’t go overboard with the bandwidth, you could read black and white blocks from VCR video. Heck, if you just made each whole LINE either black or white, that would be easily readable, and you’d get 240 bits per field, at 60 fields per second, which comes to 14.4 kits/second. Faster rates are left as an exercise for the reader, but who needs it when you’ve only got a few kB of memory to fill?
Why on earth would you want video input?
it is doable, even on AVR but plain boring.
You do those kind of things on at least an ARM?
To read back those backups recorded on the VCR, of course. I just wanted to point out that it wasn’t as outlandish an idea as it at first seems…
I did the same several months ago on the ATmega1284.
In 320×200 graphics resolution and in COLOR!
I’ve run TinyBASICplus on my Uno without any issues, using the serial monitor as the text-only display.
It seems to me that the impressive part of this build is the build itself, not the software.
Nice build and all, but seems like a major waste of time, tinybasic doesn’t compare with any modern language, and if you want to get started in programming, learn Python, which is actually useful and available on pretty much anything that boots.
If you should learn anything it’s C or C++ and nothing else.
That is the standard programming language for both professionals and hobbyists.
Nothing else or he can stick to BASIC.
That’s right – Graduate from the 1960s and BASIC, into the 1970s with C/C++!
Having said that, I wouldn’t dream of using BASIC OR Python, or any other interpreted language on an 8-bit micro, for anything more sophisticated than blinking a light.
… and… ?! You cant just stop mid prejudiced rant… you have to provide an amusing alternative… what would you recommend in that case?!.. The Arduino IDE?! Brainf**K?! Besides what exactly is wrong with BASIC (or Python for that matter) on an 8 bit micro? BASIC has amused several generations of emergent geeks. It still does… Yes, you get more compact code if you hand write it in assembler, and yes, you can write it much easier in the Arduino IDE, but why not port BASIC on an AVR, in fact why not port BASIC on your internet connected toaster… just because you can. … in fact, why not extend the AVR (or toaster) Tiny BASIC to allow in line assembler… Acorn Atom style, then you can really show of your geek cred. Think of this as a fun toy, not a device to save the world, and then have fun with it.
And it is a fun toy.
That would not have been possible without C/C++
I have noting against any programming language.
Use which ever you like.
I just said what is considered the standard one.
Neat little system for possibly even simpler cobbled projects than an a###no but I rather like the M____mite ecology (http://geoffg.net/maximite.html) created by Australian designer Geoff Graham. His version of BASIC allows structured programming without line numbers and includes floating point math, strings and more. The MicroMite is the simplest device – on a 28 pin DIP although without video or keyboard, but a terminal emulator via a comm port is all that is needed to program it. Includes LCD and keypad libraries, plus much more.
Reminds me of QuickBASIC that MS put out decades ago. No line numbers, floating point math, and a number of other nice toys not usually associated with BASIC. It even had a compiler.
Not to be confused with QBASIC, it’s useless, stripped-down cousin that was included with several versions of MS-DOS.
Micromite basic on PIC32 runs 70!!! times slower than Arduino 328P.
Single precision float is the only datatype, lot of problems with conversions and accuracy, not to mention the horrible slow speed.
Very poor functionality for embedded application.
No, shift or rotate functions, YES they recommended writing them in slow basic, what a joke.
No direct access to any hardware peripherals, timers etc.
You want functionality or timing in sub milliseconds, FORGET IT!
You want to interface peripherals and devices that original author does not support, FORGET IT!!
Now some users are developing a PC programmer that requires an I7 processor with USB3 to program the PIC32 in ONE HOUR, they are hailing this a huge success????
Do I need to keep going?
BOTTOM LINE, current users appear to be OLD forgotten generation from 1970’s that are totally ignorant, incompetent and lazy to move to 21st century.
If you have half a brain, don’t waste your time with BASIC interpreter of any type. It was the only thing available 40 years ago. Now you have so many other better choices.
Very nice project.
Is it possible to “poke or peek” the IO ports?
A major point worth noting about Geoff’s MicroMite; it has a component count of ZERO (if you don’t count the PIC chip and also mis-count the single capacitor!!).
I see it has a very large following along with the MaxiMite. With the school curriculum changing to include Computer Studies I can see why support for them are rapidly growing. As a professional programmer, I can truly say that the MicroMite & MaxiMite are a lot easier to learn than the Raspberry Pi and the Arduino range. Remember, a school lesson is around 45 minutes long. Thats enough time to write Basic code and achieve quick results – but nowhere near enough time to set-up an IDE for other non-Basic languages. If you disagree then put a school child in front of an Arduino and ask them to make it flash an LED in under 45 minutes . . . .
There was a post that was taken down shortly after it was posted that had a video of a porn star with no programming experience use an Ar###no to control a vibrator with PWM in about 10 minutes.
Hm. I didn’t realize HAD was doing this. No WONDER I never see hacks here on sex toys.
BTW, that porn star probably could’ve done it in five minutes in BASIC. See below.
The one advantage that standalone computers like MicroMite and the machine under discussion have over Arduino and other micros connected to an IDE is that there’s no confusion over where the program is running. Even as a long-time programmer, I STILL get confused at times when I’m running an IDE in one window and a terminal emulator to an external device in another, so it’s a great help conceptually when the interface between program creation and execution is seamless and intuitive. Sure, it’s intuitive to hit the “run” button in an IDE, but only after you reach the understanding that even though I’m typing it HERE, it’s happening over THERE.
I think some people just wish that the designers of standalone user-programmable micros would stop reviving BASIC and choose what everybody calls a more “modern” programming language. But in BASIC, as soon as you turn the computer on, you can start entering a program. You don’t have to recite incantations while magic runes scroll up your screen to get from power-on to running the editor, then save a program, then load and run it. I’m talking to YOU, RPi. You just type in the program and then type “run”.
Is there a “modern” language that makes it that easy? In my experience, every new programming language or IDE or whatever, involves some kind of brain twist to get to “Hello World” or blinking light. I know you can type in a program in Python and it executes it immediately, but you have to put the whole program in a single line (although it may be a very, very long line), and it executes immeditately. To write an actual program that gets saved somewhere, you have to get out of Python, get into some other mode to type in and edit your program, then go back to Python. Close, but no cigar.
Further to BrightBlueJim’s excellent post . . .
Anyone curious about making a remote controlled ‘Toy’ then take note:
With a MicroMite you would need just 6 components (counted correctly) plus a remote control – an Apple Remote works perfectly for this application (on/off + speed control).
I know the component count would be the same for whichever language the code is written in but here is the whole point about the advantages of BASIC; in under 30 lines of code you would have a fully functioning speed-controlled remote operated ‘Toy’; and less than ten minutes to code and get working!
I won’t describe the connection details or the code as I don’t want this post ‘removed’.
So here is the challenge: Can anyone out there, using an IDE coding language, write the necessary ‘Toy’ software in less than 30 lines of code – any libraries used have to be coded & lines counted too.
Oh, and by the way, from start to finish (working device) programming time must be within 7 minutes!!
Let the challenge begin . . . .
Jimbo (A 1970’s, old-generation, ignorant, FilmStar that you’ve probably forgotten about!)
I’ve spend around 12 years teaching at technical college and private training providers, I’ve seen bad programs written in C, Pascal, Basic and Assembler. The programming language doesn’t make the program better generally. Teaching students to program at high school(usually in the last 2 years, 11&12) will not make programmers out of them, all that can be hoped is that will gain an understanding of the logic of programming and the level of attention to detail it requires. This knowledge may be translated into a more generalised understanding of how things work.
Modern programming languages are mostly compilers and not interpreters like most basics,interpreters allows fast program writing and debugging. However basic does require greater discipline to write good code that other persons can understand.
Long term ease of maintenance of code is the goal that requires well written and commented code. I’m not sure the language is as important now due to the better compilers and faster machines of today
Food for thought?
I thought I would put my 2 cents in on this conversation…
I have been working with the uMite since beta days and can tell you I have completed several paying projects using uMite that I probably would not have even looked at without it. This chip and it’s firmware opened many doors for me by allowing me to EASILY implement I2C, SPI, serial, LCD interfacing, rotary encoder interfacing, 3×4 and 4×4 keyboard, IR remote control (sony and apple remote), ultrasonic range finder, multiple servo control, MP3 player interfacing, RF wireless communication, 8×8 matrix led modules, GSM modem, currency acceptors, dc servo motor control, uMite to uMite communication for expansion and more. Its all a matter of what works for you and your specific application. I can only say that this thing works so incredibly well and is extremely easy to use, I don’t think I would ever consider something else. Speed wise, it is more than capable to do what I need it to do. For a simple BASIC chip, this thing rocks, and is super easy to embed in many different types of projects. 1 chip and a cap is all it takes to get the ball rolling. Hook it up to a terminal program and start programming. Check out TheBackShed forum and see what people are doing with this awesome hunk of silicon.
Can’t wait to hear from the haters. Again, it worked (and paid) well for me and continues to do so.
So, I actually have the board all together and running and have managed to run the print “Hello World ” loop program
The issue I am having is simple – when using the keyboard I cannot use the delete or backspace keys
I purchased a PS2 minin keyboard from Newegg.com but it does not work at all, nor do USB to PS2 adaptors.
Any Ideas???? all the best
Please be kind and respectful to help make the comments section excellent. (Comment Policy)