Program This Badge in Lisp

This hardware badge is a computer programmed with Lisp. You can write your own programs right on the badge using the built-in keyboard, as long as you know Lisp.

If there’s one thing we really like to see, it’s people advancing their own projects based on inspiration from others. The Lisp Badge by [David Johnson-Davies] is a perfect example. With an interface inspired by [Voja Antonic’s] hardware design for the 2018 Hackaday Belgrade Conference Badge, this version is an upgrade of an earlier single-board Lisp machine, now sporting an integrated keyboard.

Unlike the Belgrade badge, which is programmed in BASIC, this new badge is programmed in uLisp, a subset of common lisp designed for microcontrollers. Let’s face it, BASIC is retro, but Lisp is even more so, only pre-dated by FORTRAN as the oldest high-level language. So, if you’re into retro-style programming on small devices (physically small, that is), you should consider building one of these.

A 16 MHz ATmega 1284P serves as the badge’s brain, allowing storage for 2,816 Lisp cells, while the 256×64 pixel OLED display shows 8 lines of 42 characters in 16 gray levels. A full complement of I/O connections includes four analog inputs, two analog outputs, I2C, SPI, serial, and a handful of GPIOs for interfacing with just about anything. Power comes from a LiPO battery, which at a nominal voltage of 3.7 V doesn’t quite meet the datasheet requirements for running the processor at 16 MHz, although it seems to work fine in practice. Really cautious builders could opt for a 12 MHz crystal transplant to avoid any possibility of problems.

The keyboard layout is optimized for uLisp programming: unnecessary keys have been removed and the all-important parenthesis are afforded their own dedicated keys on the bottom row. This is presumably for convenience of use, but we suspect this will also make it easier to replace the parenthesis key switches when they inevitably wear out from overuse [obligatory Lisp/parenthesis joke].

As far as entering uLisp programs, you can simply use the keyboard. The built-in editor buffers a full screen of text, and includes parenthesis matching that highlights each pair as you type. We’re guessing that we won’t see Emacs implemented in the near future, so this bracket management is a great feature for a badge-based editor. If you find the keyboard difficult to type on, you can also enter programs over the serial port.

The other thing we really like to see is open-source projects. [David] doesn’t let us down on this point, either. The Eagle design files for the PCB as well as the source code for the badge are available on GitHub. The PCB is also shared on OSH Park, and there are detailed instructions for installing the bootloader and uploading the code.

If programmable badges is your thing, also check out the 2018 Hackaday Supercon Badge, the successor the Belgrade design.

Thanks to [Sven] for the tip!

21 thoughts on “Program This Badge in Lisp

    1. It keeps popping up because C is such an awful language, and people are looking for something better. C is really nothing more than a thin layer over PDP-11 machine language with a badly implemented macro processor glued on. The poor behavior of C arithmetic makes it impossible to write secure code. Its explicit low-level nature seems useful, but it also makes many compiler optimization difficult or impossible. C++ inherits all of this nonsense and is no better. If you want a language with well behaved arithmetic and a proper macro processor then Lisp is a good place to start.

      1. > C is really nothing more than a thin layer over PDP-11 machine language with a badly implemented macro processor glued on.

        Exactly this is why I love C! C is my favourite macro assembler… so to say. I really don’t have the time to do assembler on all the platforms that cross my way.

      2. It does seem like, of all the languages to add object-orientation and whatever else to, C was the worst possible choice. Except maybe Objective Assembler, which hopefully doesn’t exist. Objective Brainfuck maybe. Any idea why Bjarne chose C to add pluses to, or was it just cos he thought it was funniest?

      3. C is acceptable because many programs have only a tiny fraction of performance critical code, and the rest is all low speed UI stuff. It still sucks to write any C at all, but I don’t see why anyone would want to write a complete application in anything remotely low level when python makes calling C so easy.

        Recently my language of choice on embedded systems has been Squirrel, but it really needs ESP32 or better MCUs to work on, so I’m stuck with CPP for everything else.

        I’ve always wondered why there aren’t more compilers targeting LISP source code. The syntax is confusing for most, but the interpreters are fantastically compact and easy to write.

  1. I just have to make one of these! The power of 6.001 compels me!

    I would be curious if anyone out there has any wisdom about those key switches, if anyone has found ones that work better, or last longer, or are easier on the fingers, or such.

  2. Has anyone come up with a mesh routing for one of these badges? With lots of these floating about routing full time connecting devices point to point should be very easy and requite no other infrastructure. Think voice, swapping images, code, contact cards, messages etc … could use FireChat application on phones as a start. An interesting point of optimisation would be to use controllable rf power so that the more nodes there are in theory the closer the proximity of nodes the less rf is needed. In a dense mesh as at a con micro miniature power levels should mean tiny power draws. So no 3/4G or wifi internet infrastructure would be needed as such. Why a badge? Because phones cant be running the routing layer application in the background full time. I would love to see such anarchy work and spread out.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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