Interface Your C64 With Arduinos Through Firmata

Microcontrollers are cool, but sometimes the user interface options they can deliver are disappointing. The platform in question may not have the horsepower required to drive a decent screen, and often a web interface is undesirable for security or complexity reasons. Sometimes you just need a good software interface between chip and computer. Firmata is a protocol that’s designed to do just that, and [nanoflite] has brought it to the Commodore 64.

It’s a fun project, which allows one to use the C64’s charming retro graphics to interface with an Arduino-based project. Connection is achieved at 2400bps over the user port, which is plenty fast for most UI applications. [nanoflite] demonstrates the interface with an Arduino Uno and a Grove shield. The C64 is able to display the state of the LED, relay and servo outputs, as well as read the Arduino’s button and potentiometer inputs.

It’s an excellent way to integrate a Commodore 64 into a microcontroller setup without reinventing the wheel. We think it would make an awesome vintage interface to a home automation system or similar build. If you’re interested, but you don’t have a C64 of your own to play with, never fear – you can just build a new one.

13 thoughts on “Interface Your C64 With Arduinos Through Firmata

  1. Great project. Though for maximum safety a set of optocoupler could be of added in the serial line. I love the fact that the Arduino acts as a multipurpose io-co-processor. Fun project.

    1. Why is it that so many people like to recommend optocouplers for basically any design? Why would two locally powered 5 volt devices need to be isolated by optocouplers (and a set of inverters since any normal optocoupler is inverting the signal unless you connected it as an emitter follower which might not be the best of ideas due to bad signal levels as low)?

      I mean stuff like parallel printers and modems have been directly connected to computers for decades.

      Would you also recommend to optoisolate a pair of powered speakers, or the monitor connected to the computer as well?

      1. Hello matseng, I’m not recommending optocouplers to any design. I just suggested that it would add to the safety of the C64. Let me explain why.

        Considering that the C64 is an old CMOS design that doens’t handle ESD very well it will also not handle large voltage differences to ground very well. You are right about the good old days when everything was chained together and all went fine. But you are perhaps also familiar with devices (cheap ower supplies) that seems to discharge a tiny spark just before you make the connection. This may be caused by cappacitive coupling or bad filter design or good filter design but not properly connected to the protective earth line. And some cheap power supplies do this by default but don’t seem to care as they cost next to nothing and are not meant to be connected to other power circuitry that isn’t floating.
        In other words, it’s not strange to have to perfectly good powersupplies that work fine, but when you measure the voltage between those 5V supplies or the GND them you’ll measure a differences of 90V (in a 230V system that is slightly less the halve the net voltage). Now this voltage isn’t really hard, it drops to zero when connected, causing no problems. But just before you make the connection, there is a huge voltage and with a small capacitance behind it that may just be enough to blow out your precious CMOS chips. In case of the C64 that would be the CIA chip of the userport.
        Now all is fine if you make all connections when power is OFF, but we all know that a mistake is easily made especially in a situation of an experimental setup where you make and brake connections all the time.

        So in the end it’s up to you:
        – do you want the extra protection for a cost of 99 cents (logic level, inverting or non inverting is no big issue and if that scares you, you should perhaps choose a different hobby)
        – do you swear to work with perfect power supplies, perfectly grounded powerplugs and only make connections when all power is OFF.

        It goes without saying that you in all situations take all the ESD related precautions but that’s a slightly different story.

  2. Yes but what about realtime support for the data? Sadly the only source who might support it completely is largely out of business as far as technology goes is Xively, I think they got themselves a new name and a really useless business model. But there are probably other such sites out there.

    In fact I’ll bring it to the attention of the collectors of this machine at VCF East next month,

    1. I too want to do something like that. It’s be fun to say “write C for Arduino on a C128 or C64”
      But alas I fear the C= would take ages to compile even a simple Arduino sketch. Now.. bootloading shouldn’t be hard to accomplish. though the bootloader might need to be rebuilt for a much slower upload rate.
      Anyway I think the Amiga has a better chance of being usable to compile Ardu code.
      Now.. if it had some sort of built in interpreter… Like the basic stamp had (AFIK) or python? Then you just need a good editor / terminal on the C=. Either edit in term directly, or local editor and upload the text file, or convert to some form of tokenization. Interesting possibilities… Modern micros have so much power compared to the C=

  3. A cable provider destroyed my C-64 because the line was not grounded and it came through the T.V.

    Other people describe rare earth energy that has destroyed their devices.

  4. I had an “Advanced Physics Lab” course in college in the early 90s where we interfaced A/D converters directly into the C64 address bus and wrote code to read the values in C64 assembly language. It wasn’t really very difficult and got us lots of data points in a short amount of time. Yes, we used opto-couplers to keep us from frying the C64 if we wired something wrong into our A/D converter circuits.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.