http://www.technoblogy.com/show?3Z2Y Logo Technoblogy Arduino and AVR projects [ ] [Search] Most popular posts * CAN Bus Monitor * Logic Lab * Logic Lab Problem Answers * Tiny Time 2 Watch * Minimal RP2040 Board Recent posts V 2023 * Lisp Badge LE * CAN Bus Monitor * Logic Lab Problem Answers * Logic Lab * I2S Speaker for QT Py * Adjustable Load * Harder Number Maze Game * Power Deliverer with Current Monitor * Tiny UPDI-HV Programmer > 2022 * Number Maze Game * Minimal GIF Decoder * Lisp Star * Graphical Analogue Clock * The ATtiny 2-Series * Power Deliverer * Drawing Filled Quadrilaterals and Triangles * Reading from a TFT Display * I2C SD-Card Module PCB * I2C SD-Card Module * Monochrome Low-Power Display Library * Three-Channel Chart Plotter * Adding File Storage to an Arduino * Universal TFT Display Backpack * Tiny TFT Graphics Library 2 * On Bytes and Pins * Tiny I2C Routines for all AVR Microcontrollers * Minimal RP2040 Board * Printing to a Serial LED Display * 16 LEDs Kishi Puzzle Solution * Twinkling Pendant * Morse Code Message Pendant * Controlling RGB LED Strips with a Single Function * 16 LEDs Solution and a New Puzzle > 2021 * Using a Timer on the Arduino Uno or Arduino Zero * AM Morse-Code Transmitter * 16 LEDs Puzzle * Low-Power LCD Clock * Measuring Your Own Supply Voltage * 100MHz Frequency Meter * Pocket Op Amp Lab PCB * Frequency Divider Using CCL * Pocket Op Amp Lab Cookbook * I2C Detective * Pocket Op Amp Lab * Five LEDs Puzzle Solution * Five LEDs Puzzle PCB > 2020 * Compact TFT Graphics Library * Five LEDs Puzzle * Frequency Probe * Combination Lock using CCL * Diffusion Clock * Smooth Big Text * Simple Sprite Routines for the Wio Terminal * Saving Screenshots from a TFT Display * Simple Sprite Routines for the PyGamer/PyBadge * Reading the PyBadge Display * Minimal ATmega4809 on a Breadboard * Big Time * Four Sample Player * Mega Tiny Time Watch [Updated] > 2019 * Eight-Character Alphanumeric Display * Festive Lights Programming Challenge * UPDI Programmer Stick * New ATtiny Low Power * Nano Current Meter * ATtiny Running Lisp * Minimal I2C for the New AVR Microcontrollers * Getting Started with the New ATtiny Chips * Visible Lisp Computer * Simple DataFlash Board * Magic 3D Clock * Tiny TFT Graphics Library * Illuminated Button Matrix * Two-Digit Thermometer * Minimal ATSAMD21 Computer 2 * Minimal ATSAMD21 Computer * Tiny Thermocouple Thermometer * Twelve PWM Outputs from an ATtiny85 * Tiny Function Generator PCB * ATtiny10 Thermometer PCB * ATtiny10 Thermometer * Lisp Badge [Updated] > 2018 * ATtiny85 Weather Station [Updated] * Widget Dashboard * Tiny MIDI Player * Colour Graphics Library * I2C GPS Module PCB * Tiny Terminal 2 * Tiny Function Plotter * I2C GPS Module * Simple LCD Character Display * Alcohol Unit Counter * Tiny Machine-Code Monitor * One Input 20-key Keypad Interface * Programmable Signal Generator * Minimal Tiny I2C Routines * ATtiny85 20MHz Internal Clock * ATtiny10 POV Pendant * IR Remote Wand * IR Remote Control Detective [Updated] * Harmonic Function Generator * Tiny Graphics Library * Secret Maze PCB * Tiny Function Generator Sine Wave * Tiny Function Generator * Secret Maze * Playing Notes on the ATtiny85 * Tiny Colour Watch > 2017 * Continuity Tester * Programming the ATtiny10 [Updated] * Proto Power Supply * Using an ATmega328 without a crystal * Bounce-Free Rotary Encoder * Four-Channel Thermometer * Flexible GPS Parser * Tiny Face Watch * Driving Four RGB LEDs from an ATtiny85 * Big Text for Little Display * ATtiny85 Graphics Display * Tiny Time 2 Watch * 10 or 12-bit DAC from the ATtiny85 * Simple 1-Wire Interface * Audio Pitch Shifter * Tiny Lisp Computer 2 PCB * GameBone Simple Electronic Game > 2016 * Tiny Time Watch * Tiny Lisp Computer 2 * Tiny Lisp Computer * Text Display for the Arduino Uno * Simple PS/2 Keyboard Interface * Making Your Own I2C Peripherals * Using the ATmega1284 with the Arduino IDE * Digital Clock Using Lisp * Making millis() tell the time * A Lightweight Alternative to tone * Adjustable Load * Programming ATtinys with Arduino 1.6.8 [Updated] * Digital Music Box [Updated] * Using the Arduino IDE Without Cores * Flashing Thermometer * Portable Lab Power Supply * ATtiny85 Sound Level Meter > 2015 * ATtiny85 Bargraph Voltmeter * TinyNav Simple GPS Navigator [Updated] * Dot Matrix Clock * Simple Rotary Encoder Interface [Updated] * Driving LED Displays with Fewer I/O Lines * Infrared Controlled Buggy * Powering Projects from a 1.5V Battery * IR Remote Control Switch * Odometer/Speedometer Pendant [Updated] * Push-Button On/Off Switches * Simple ATtiny USI UART 2 * Sony NEX/Alpha Remote Control * IR Remote Control Receiver * Bulls & Cows Game 2 * IR Remote Control Tool (NEC) * IR Remote Control Tool * Bulls & Cows Game * Tiny Terminal * Choosing a Friendly AVR Chip > 2014 * Simple GPS Odometer * Simple Compass Display * Tiny GPS Speedometer [Updated] * Minimal GPS Parser [Updated] * Simple ATtiny USI UART * Timescale Clock * Tiny Synth * Waveform Generation using an ATtiny85 * Audio Sample Player * ATtiny85 Analogue Clock * Radio Time Code Clock * Four PWM Outputs from the ATtiny85 * ATtiny-Based Beginner's Kit * MINIL Machine-Code Monitor * One Input Keypad Interface * Conundrometer Game * Getting Extra Pins on ATtiny * Simple Tones for ATtiny * ATtiny Low Power Topics > Games * Conundrometer Game * Bulls & Cows Game * Bulls & Cows Game 2 * GameBone Simple Electronic Game * Secret Maze * Secret Maze PCB * Five LEDs Puzzle * Five LEDs Puzzle PCB * 16 LEDs Puzzle * 16 LEDs Solution and a New Puzzle * 16 LEDs Kishi Puzzle Solution * Number Maze Game * Harder Number Maze Game > Sound & Music * Audio Sample Player * Simple Tones for ATtiny * Waveform Generation using an ATtiny85 * Tiny Synth * ATtiny85 Sound Level Meter * Digital Music Box [Updated] * A Lightweight Alternative to tone * Audio Pitch Shifter * Playing Notes on the ATtiny85 * Tiny Function Generator * Tiny Function Generator Sine Wave * Harmonic Function Generator * Tiny MIDI Player * Tiny Function Generator PCB * Four Sample Player * I2S Speaker for QT Py > Watches & Clocks * Radio Time Code Clock * ATtiny85 Analogue Clock * Timescale Clock * Dot Matrix Clock * Digital Clock Using Lisp * Tiny Time Watch * Tiny Time 2 Watch * Tiny Face Watch * Tiny Colour Watch * Magic 3D Clock * Mega Tiny Time Watch [Updated] * Big Time * Diffusion Clock * Low-Power LCD Clock * Graphical Analogue Clock > GPS * Simple ATtiny USI UART * Simple ATtiny USI UART 2 * Minimal GPS Parser [Updated] * Tiny GPS Speedometer [Updated] * Simple Compass Display * Simple GPS Odometer * Odometer/Speedometer Pendant [Updated] * TinyNav Simple GPS Navigator [Updated] * Flexible GPS Parser * I2C GPS Module * I2C GPS Module PCB > Power Supplies * Powering Projects from a 1.5V Battery * Portable Lab Power Supply * Proto Power Supply * Power Deliverer * Power Deliverer with Current Monitor > Computers * MINIL Machine-Code Monitor * Tiny Lisp Computer * Tiny Lisp Computer 2 * Tiny Lisp Computer 2 PCB * Tiny Machine-Code Monitor * Lisp Badge [Updated] * Minimal ATSAMD21 Computer * Minimal ATSAMD21 Computer 2 * Visible Lisp Computer * ATtiny Running Lisp * Minimal ATmega4809 on a Breadboard * Minimal RP2040 Board * Lisp Badge LE > Graphics * Tiny Terminal * ATtiny85 Graphics Display * Big Text for Little Display * Tiny Graphics Library * Tiny Function Plotter * Tiny Terminal 2 * Colour Graphics Library * Widget Dashboard * Tiny TFT Graphics Library * Reading the PyBadge Display * Simple Sprite Routines for the PyGamer/PyBadge * Simple Sprite Routines for the Wio Terminal * Smooth Big Text * Compact TFT Graphics Library * Tiny TFT Graphics Library 2 * Universal TFT Display Backpack * Three-Channel Chart Plotter * Monochrome Low-Power Display Library * Reading from a TFT Display > Thermometers * Flashing Thermometer * Simple 1-Wire Interface * Four-Channel Thermometer * Tiny Graphics Library * ATtiny85 Weather Station [Updated] * ATtiny10 Thermometer * ATtiny10 Thermometer PCB * Tiny Thermocouple Thermometer * Two-Digit Thermometer > Wearables * Odometer/Speedometer Pendant [Updated] * ATtiny10 POV Pendant * ATtiny10 Thermometer PCB * Morse Code Message Pendant * Twinkling Pendant * Lisp Star > Test Equipment * IR Remote Control Tool * IR Remote Control Tool (NEC) * IR Remote Control Receiver * Sony NEX/Alpha Remote Control * IR Remote Control Switch * ATtiny85 Bargraph Voltmeter * Adjustable Load * Continuity Tester * IR Remote Control Detective [Updated] * IR Remote Wand * Programmable Signal Generator * Alcohol Unit Counter * Illuminated Button Matrix * Simple DataFlash Board * Nano Current Meter * UPDI Programmer Stick * Frequency Probe * Pocket Op Amp Lab * I2C Detective * Pocket Op Amp Lab PCB * 100MHz Frequency Meter * Three-Channel Chart Plotter * I2C SD-Card Module * I2C SD-Card Module PCB * Tiny UPDI-HV Programmer * Adjustable Load > Tutorials * ATtiny Low Power * Getting Extra Pins on ATtiny * One Input Keypad Interface * ATtiny-Based Beginner's Kit * Four PWM Outputs from the ATtiny85 * Choosing a Friendly AVR Chip * Push-Button On/Off Switches * Powering Projects from a 1.5V Battery * Driving LED Displays with Fewer I/O Lines * Simple Rotary Encoder Interface [Updated] * Using the Arduino IDE Without Cores * Programming ATtinys with Arduino 1.6.8 [Updated] * Using the ATmega1284 with the Arduino IDE * Making Your Own I2C Peripherals * Simple 1-Wire Interface * 10 or 12-bit DAC from the ATtiny85 * Driving Four RGB LEDs from an ATtiny85 * Bounce-Free Rotary Encoder * Using an ATmega328 without a crystal * Programming the ATtiny10 [Updated] * ATtiny85 20MHz Internal Clock * Minimal Tiny I2C Routines * One Input 20-key Keypad Interface * Simple LCD Character Display * Twelve PWM Outputs from an ATtiny85 * Minimal I2C for the New AVR Microcontrollers * New ATtiny Low Power * Saving Screenshots from a TFT Display * Smooth Big Text * Pocket Op Amp Lab Cookbook * Frequency Divider Using CCL * Measuring Your Own Supply Voltage * Using a Timer on the Arduino Uno or Arduino Zero * Printing to a Serial LED Display * Tiny I2C Routines for all AVR Microcontrollers * On Bytes and Pins > Libraries * Minimal Tiny I2C Routines * Colour Graphics Library * Minimal I2C for the New AVR Microcontrollers * Compact TFT Graphics Library * Tiny I2C Routines for all AVR Microcontrollers * Tiny TFT Graphics Library 2 * Monochrome Low-Power Display Library * Minimal GIF Decoder > PCB-Based Projects * Tiny Time Watch * GameBone Simple Electronic Game * Tiny Time 2 Watch * Tiny Face Watch * Proto Power Supply * Continuity Tester * Tiny Colour Watch * Secret Maze PCB * Tiny Machine-Code Monitor * ATtiny10 POV Pendant * I2C GPS Module PCB * Lisp Badge [Updated] * ATtiny10 Thermometer PCB * Tiny Function Generator PCB * Two-Digit Thermometer * Illuminated Button Matrix * Simple DataFlash Board * UPDI Programmer Stick * Eight-Character Alphanumeric Display * Mega Tiny Time Watch [Updated] * Big Time * Frequency Probe * Five LEDs Puzzle PCB * Pocket Op Amp Lab PCB * Low-Power LCD Clock * 16 LEDs Puzzle * Morse Code Message Pendant * Twinkling Pendant * Minimal RP2040 Board * Universal TFT Display Backpack * I2C SD-Card Module PCB * Power Deliverer * Lisp Star * Number Maze Game * Power Deliverer with Current Monitor * Harder Number Maze Game * Adjustable Load * I2S Speaker for QT Py * Logic Lab * Lisp Badge LE By processor AVR ATtiny > ATtiny10 * Programming the ATtiny10 [Updated] * ATtiny10 POV Pendant * ATtiny10 Thermometer * ATtiny10 Thermometer PCB * Morse Code Message Pendant * Twinkling Pendant > ATtiny2313 * Simple GPS Odometer * Driving LED Displays with Fewer I/O Lines * Dot Matrix Clock > ATtiny84 * Radio Time Code Clock * Timescale Clock * IR Remote Control Tool * IR Remote Control Tool (NEC) * Simple ATtiny USI UART 2 * Odometer/Speedometer Pendant [Updated] * Adjustable Load * Alcohol Unit Counter * Two-Digit Thermometer * Nano Current Meter * Frequency Probe * Adjustable Load > ATtiny841 * Making Your Own I2C Peripherals * I2C GPS Module * I2C GPS Module PCB > ATtiny85 * ATtiny Low Power * Simple Tones for ATtiny * MINIL Machine-Code Monitor * Four PWM Outputs from the ATtiny85 * ATtiny85 Analogue Clock * Audio Sample Player * Waveform Generation using an ATtiny85 * Tiny Synth * Simple ATtiny USI UART * Tiny GPS Speedometer [Updated] * Simple Compass Display * Tiny Terminal * IR Remote Control Receiver * Sony NEX/Alpha Remote Control * Simple ATtiny USI UART 2 * Push-Button On/Off Switches * IR Remote Control Switch * Infrared Controlled Buggy * Simple Rotary Encoder Interface [Updated] * TinyNav Simple GPS Navigator [Updated] * ATtiny85 Bargraph Voltmeter * ATtiny85 Sound Level Meter * Flashing Thermometer * Digital Music Box [Updated] * Tiny Time Watch * GameBone Simple Electronic Game * Audio Pitch Shifter * Simple 1-Wire Interface * 10 or 12-bit DAC from the ATtiny85 * Tiny Time 2 Watch * ATtiny85 Graphics Display * Big Text for Little Display * Driving Four RGB LEDs from an ATtiny85 * Tiny Face Watch * Flexible GPS Parser * Four-Channel Thermometer * Bounce-Free Rotary Encoder * Continuity Tester * Tiny Colour Watch * Playing Notes on the ATtiny85 * Secret Maze * Tiny Function Generator * Tiny Function Generator Sine Wave * Secret Maze PCB * Tiny Graphics Library * Harmonic Function Generator * IR Remote Control Detective [Updated] * IR Remote Wand * ATtiny85 20MHz Internal Clock * Programmable Signal Generator * Tiny Machine-Code Monitor * Tiny Function Plotter * Tiny Terminal 2 * Colour Graphics Library * Tiny MIDI Player * Widget Dashboard * ATtiny85 Weather Station [Updated] * Tiny Function Generator PCB * Twelve PWM Outputs from an ATtiny85 * Tiny Thermocouple Thermometer * Tiny TFT Graphics Library * Magic 3D Clock * Four Sample Player * Diffusion Clock * Five LEDs Puzzle * Five LEDs Puzzle PCB * Printing to a Serial LED Display * Tiny TFT Graphics Library 2 > ATtiny861 * Portable Lab Power Supply > ATtiny88 * Illuminated Button Matrix AVR ATmega > ATmega328 * Conundrometer Game * Bulls & Cows Game * Bulls & Cows Game 2 * A Lightweight Alternative to tone * Digital Clock Using Lisp * Simple PS/2 Keyboard Interface * Text Display for the Arduino Uno * Tiny Lisp Computer * Using an ATmega328 without a crystal * Proto Power Supply * Simple LCD Character Display * UPDI Programmer Stick * Using a Timer on the Arduino Uno or Arduino Zero > ATmega1284 * Using the ATmega1284 with the Arduino IDE * Tiny Lisp Computer 2 * Tiny Lisp Computer 2 PCB * Lisp Badge [Updated] AVR 0-series and 1-series > ATmega4809 * Minimal ATmega4809 on a Breadboard * Logic Lab > ATtiny1604 * Power Deliverer * Power Deliverer with Current Monitor > ATtiny1614 * I2C SD-Card Module * I2C SD-Card Module PCB > ATtiny3216 * ATtiny Running Lisp * Big Time > ATtiny3227 * Lisp Star > ATtiny402 * New ATtiny Low Power * Printing to a Serial LED Display * Tiny TFT Graphics Library 2 * Three-Channel Chart Plotter * Monochrome Low-Power Display Library > ATtiny404 * 16 LEDs Puzzle * 16 LEDs Solution and a New Puzzle > ATtiny414 * Mega Tiny Time Watch [Updated] * 100MHz Frequency Meter * Measuring Your Own Supply Voltage * Universal TFT Display Backpack > ATtiny814 * Graphical Analogue Clock AVR DA/DB-series > AVR128DA28 * Combination Lock using CCL * Frequency Divider Using CCL * Measuring Your Own Supply Voltage * Minimal GIF Decoder > AVR128DA32 * Number Maze Game * Harder Number Maze Game > AVR128DA48 * Low-Power LCD Clock * Logic Lab > AVR128DB28 * Pocket Op Amp Lab * Pocket Op Amp Lab Cookbook * Pocket Op Amp Lab PCB * Measuring Your Own Supply Voltage * Minimal GIF Decoder > AVR128DB48 * Lisp Badge LE ARM > ATSAMD21 * Minimal ATSAMD21 Computer * Minimal ATSAMD21 Computer 2 * Visible Lisp Computer * Using a Timer on the Arduino Uno or Arduino Zero > RP2040 * Minimal RP2040 Board About me * About me * * Twitter * Mastodon Feeds RSS feed Lisp Badge LE 27th September 2023 This is a self-contained low-power computer with its own display and keyboard that you can program in uLisp, a version of the high-level language Lisp for microcontrollers: LispBadgePulse.jpg The Lisp Badge LE, a low-power computer programmed in Lisp with a self-contained keyboard and display. It's based on an AVR128DB48 which provides 128K bytes of flash memory, and 16K bytes of RAM. There's an integrated 45-key keyboard optimised for Lisp, using reverse-mounted buttons giving room for large key legends on the PCB. It has a low-power monochrome display, readable in daylight without a backlight, so it's ideal for programming in the garden or on the beach! This gives 10 lines of 41 characters, or graphics with a resolution of 250x122 pixels, supported by several graphics commands. You can use it to run programs that interface to components such as LEDs and push-buttons via the I/O pins, read the analogue inputs, and operate external devices via the I2C and SPI interfaces. Introduction A few years ago I designed the Lisp Badge, a self-contained computer with its own display and keyboard, based on an ATmega1284, that you could program in Lisp. Since then I've been thinking about how I could improve it, and made a list of features I'd like to add. On the one hand I wanted it to have a better keyboard, and be low power, powered from a button cell, with an eInk display that you could see in daylight. On the other hand I wanted it to have a colour TFT graphics display, and use a fast 32-bit ARM processor, with support for floating-point arithmetic. I soon realised that these requirements are incompatible in a single design, and so set about designing two different Lisp Badges to meet the two sets of requirements. This Lisp Badge LE (low energy) is the first of those designs, and has the following new features: Processor and memory It's based on an AVR128DB48 (or AVR128DA48) running at 24MHz, and provides 2800 Lisp objects, about the same as the original Lisp Badge. You can save the entire workspace to flash. Current consumption The Lisp Badge LE draws only 6mA from its CR2032 button cell, and so should have a life of about 40 hours. There's a physical on/off switch too for long periods of inactivity. Lisp language The Lisp Badge LE runs the AVR version of uLisp which provides 16-bit integer arithmetic, arbitrary length symbols and strings, lists, multi-dimensional arrays, Arduino interface functions, debugging features, and built-in documentation. Display The display is a low-power monochrome graphics display ^[1] which I explored in an earlier article; see Monochrome Low-Power Display Library. It has a resolution of 250x122 pixels, and a text resolution of 10 lines of 41 characters per line. It supports reading back from the display, which makes it possible to support a full range of graphics functions, including plotting points, drawing lines, drawing outline and filled rectangles circles or triangles, and plotting characters and text at normal size or enlarged by any integer scale factor. Keyboard The keyboard takes advantage of push buttons that mount on the reverse of the board, with the button caps protruding through holes in the PCB. This makes it much easier to use than on the original Lisp Badge because it's easier to press the keys, and there's space for larger key legends. The push buttons are available from Adafruit ^[2]. or The Pi Hut in the UK ^[3]. It uses the same 45-key layout as the original Lisp badge, with upper and lower-case characters, digits, and the symbols required by uLisp. However, it now provides an addition META modifier key in addition to SHIFT, allowing you to enter characters that don't have a dedicated key on the keyboard. Peripherals There's a large piezo speaker that supports playing notes, and a reverse-mounting LED that shines through a hole on the front of the board. Here's the full specification: Lisp Badge - Specification Size: 107mm x 61mm (4.2" x 2.4"). Display: 41 characters x 10 lines, or 250 x 122 pixels. Keyboard: Integrated 45-key keyboard providing upper and lower-case characters, digits, and the symbols required by uLisp. The META key pressed in conjunction with another key gives access to the following characters not available from the main keyboard: META + A C D E P Q T U V < > Character & : $ ! % ? @ ^ | { } Memory available: 2800 Lisp cells (11200 bytes). Flash: 16384 bytes of flash are reserved for use to save the Lisp workspace using save-image. Processor: AVR128DB48 Clock speed: 24 MHz. Current consumption: Approx. 6 mA. A CR2032 cell has a typical capacity of 225 mAh, so this should give a life of about 40 hours. Types supported: list, symbol, integer, character, string, stream, and array. An integer is a sequence of digits, optionally prefixed with "+" or "-". Integers can be between -32768 and 32767. You can enter numbers in hexadecimal, octal, or binary with the notations #x2A, #o52, or # b101010, all of which represent 42. User-defined symbol names can have arbitrary names. Any sequence that isn't an integer can be used as a symbol; so, for example, 12a is a valid symbol. There is one namespace for functions and variables; in other words, you cannot use the same name for a function and a variable. Includes a mark and sweep garbage collector. Garbage collection takes 5 msec. Language uLisp, a subset of Common Lisp, with the following 196 Lisp functions and special forms: * + - / /= 1+ 1- < <= = > >= ? abs analogread analogreadresolution analogreference analogwrite and append apply apropos apropos-list aref array-dimensions arrayp ash assoc atom bit boundp break caaar caadr caar cadar caddr cadr car case cdaar cdadr cdar cddar cdddr cddr cdr char char-code characterp check-key closure cls code-char concatenate cond cons consp dacreference decf defcode defun defvar delay digitalread digitalwrite documentation dolist dotimes draw-char draw-circle draw-line draw-pixel draw-rect draw-triangle edit eq equal error eval evenp fill-circle fill-rect fill-screen fill-triangle first for-millis format funcall gc get-pixel globals glyph-pixel if ignore-errors incf integerp keyboard keywordp lambda length let let* list list-library listp load-image locals logand logbitp logior lognot logxor loop make-array makunbound mapc mapcan mapcar max member millis min minusp mod not note nothing nth null numberp oddp or pinmode plot plot3d plusp pop pprint pprintall prin1 prin1-to-string princ princ-to-string print progn push quote random read read-byte read-from-string read-line register require rest restart-i2c return reverse room save-image search second set set-cursor setf setq sleep sort streamp string string< string= string> stringp subseq symbolp t terpri third time trace truncate unless untrace unwind-protect when with-i2c with-output-to-string with-sd-card with-serial with-spi write-byte write-line write-string zerop It also provides 37 keywords such as :input, :output, and :led-builtin, as a convenient way of entering Arduino constants. For a full definition see uLisp Language Reference. Graphics extensions The Lisp Badge LE includes a graphics library to allow you to do plotting on the display; for details see Graphics extensions. These work using a coordinate system with the origin at top left: GraphicsDisplayCoords5.gif The following example shows a plot of the fractal Dragon Curve; for the program see Dragon curve: LispBadgeLEDragon.jpg A fractal Dragon Curve drawn in Lisp on the Lisp Badge LE using the graphics extensions. Assembler The Lisp Badge LE also includes an AVR assembler which allows you to generate and run machine-code functions, written in AVR mnemonics, using an assembler written in Lisp. For details see AVR assembler overview. The language includes several extensions specifically for the Lisp Badge, including plot and plot3d, for plotting graphs and 3d functions, and keyboard and check-key for reading the keyboard in real time. For details see Lisp Badge LE extensions. Interfaces These interfaces are brought to headers at the edge of the Lisp Badge LE board. The numbers in brackets refer to Arduino pin numbers: * Eight analogue input pins using analogread: PD0 to PD7 (22 to 29). * VCC, GND, and UPDI. * Two analogue outputs using analogwrite: MOSI0 (4) and MISO0 (5). * Digital input and output using pinmode, digitalread, and digitalwrite: TX0 (0), RX0 (1), SCL0 (2), SDA0 (3), MOSI0 (4), MISO0 (5), SCK0 (6), and PD0 to PD7 (22 to 29) * I2C interface using with-i2c and restart-i2c: SCL0 (2) and SDA0 (3), plus VCC and GND. * SPI interface using with-spi: MOSI0 (4), MISO0 (5), and SCK0 (6), plus VCC and GND. * Serial interface (FTDI) using with-serial: TX0 (0) and RX0 (1), plus DTR, VCC, and GND. Analogue output PB4 (12) is connected to a piezo speaker, which can use analogwrite or note. The SHIFT (33) and META (11) keys can be used as digital inputs, read with digitalread and referenced as :shift-key and :meta-key. PA7 (7) is connected to an LED on the front panel, referenced as :led-builtin. You can turn it on and off with digitalwrite, or vary its brightness with analogwrite. Entering programs You can enter commands and programs by typing them at the keyboard, and pressing ENTER. A keyboard buffer is provided that buffers a full screen of text, and you can use the DEL key to delete characters and correct typing mistakes. The line editor includes parenthesis matching which automatically highlights matching brackets in inverse video as you type in a program. This makes it much easier to enter a program correctly, and is especially helpful in telling you how many closing brackets to type at the end of defining a function. For example, the following program pulsates the built-in LED slowly on and off: (defun pulse (&optional (up t)) (dotimes (x 256) (analogwrite :led-builtin (if up x (- 255 x))) (delay 8)) (pulse (not up))) It's shown nicely formatted here for clarity, but you can type it in as one continuous line, only pressing ENTER at the end. To run the program type: (pulse) Connecting to a computer You can connect the Lisp Badge to a computer by plugging a 3.3V FTDI USB-to-serial converter onto the FTDI connector on the top right of the Lisp Badge, and then connecting this to the computer using a USB cable. You can then use the Serial Monitor in the Arduino IDE to enter and edit programs as described in Using uLisp. I used the 3.3V FTDI Basic Breakout from Sparkfun ^[4]. When using it with the Lisp Badge it powers the Lisp Badge, and so the battery should be left switched off. The circuit Here's the main part of the circuit: LispBadgeLE.gif Circuit of the Lisp Badge, based on an AVR128DB48 microcontroller. The keyboard arranges the keys in a matrix of four rows and 11 columns: LispBadgeKybd.gif The circuit of the Lisp Badge keyboard matrix. > Parts list Qty Item Value Size Typical parts Pushbutton 6 x 6mm Reverse Mount Tactile 45 Black SMD Reverse Switch Buttons Mount 5 Ceramic 100nF 0805 capacitor 2 Ceramic 10uF 0805 10V capacitor 1 SMD resistor 33kO 0805 5% 1 SMD resistor 1kO 0805 5% 1 SMD resistor 10kO 0805 5% 1 SMD resistor 470O 0805 5% 1 LED Blue 1206 Reverse Kingbright KPTL-3216QBC Mount 1 Schottky Diode B340A DO-214AC 40V 3A 1 Regulator AP2112K-3.3 SOT23-5 Or MIC5205-3.3. 1 Microcontroller AVR128DB48 TQFP48 1 Header 1x6-way 0.1" pitch 1 Header 1x4-way 0.1" pitch 1 Header 2x3-way 0.1" pitch 1 Button cell 3.3V CR2032 1 Battery Holder SMD AAA Coin Cell Battery Holder - 20mm (SMD) 1 SPDT Switch 3 pin 2mm pitch SPDT Right-Angle Slide Switch 1 Piezo buzzer SMD 16 x 16mm Square Wave External Piezo Buzzer 1 Monochrome SPI 250 x 2.13" 2.13" 122*250 monocrome display 122 screen TFT Module 1 Double-sided 1.2mm thick 106.7 x 67.3 PCB mm Construction I created a PCB in Eagle, and ordered a set of boards from PCBWay. I chose white PCBs to contrast with the black buttons. The board is the same width as the original Lisp Badge, but slightly taller to accomodate the larger display. After a bit of experimentation I chose a board thickness of 1.2mm. With the standard 1.6mm thick PCB material the reverse-mounted buttons didn't protrude far enough through the holes, and 0.8mm made the boards too bendy, but 1.2mm was ideal. The components, apart from the display, are mounted on the back of the board: LispBadgeLEBack.jpg The reverse side of the Lisp Badge printed circuit board. The push buttons are mounted at a 15deg angle, which makes it possible to pack them closer together. I've taken advantage of the fact that the terminals on each side of the push buttons are connected together to link the rows and columns of the key matrix across the board, and simplify the PCB track layout. A consequence of this is that if one push button is omitted, or has a faulty connection, all the other buttons to its left or below it across the keyboard may not work. Understanding this should help you track down any faulty soldering. The PCB uses 0805 resistors and capacitors. The LED is a reverse-mounting 1206 LED ^[5] to make the front of the board flush. The board will accommodate either a 16 x 16mm SMD piezo speaker ^[6], or a 11 x 9mm SMD piezo speaker ^[7]. The battery holder is an SMD 20mm coin cell holder available from Sparkfun ^[8], or from Proto-PIC in the UK ^[9]. Note that on many button cells the negative terminal is concave, and doesn't make good contact with the pad on the PCB. I therefore recommend melting some solder on the circular PCB contact to provide extra thickness before mounting the battery holder. The display is held in place with a double-sided self-adhesive foam pad, and then soldered to the board with the seven header pins. There are also four mounting holes if you prefer to use screw mounting. I recommend leaving the display uninstalled until you have tested the rest of the board, because it's likely to be sensitive to overheating. I used a Youyue 858D+ hot air gun at 275degC to solder the small SMD components and push buttons, and then used a conventional soldering iron for the display, battery holder, switch, piezo speaker, and connectors. The PCB has space for a 5 x 3.2mm 32.768kHz crystal and its capacitors which you could use with the RTC peripheral to provide accurate timekeeping. However, I didn't fit it on the prototype as the internal clock is already pretty accurate. The program The Lisp Badge program is based on the code for the AVR version of uLisp Version 4.4 (see Download uLisp), with the addition of routines to handle the display and keyboard, and the plot extensions. Display The display routine is based on the routine I developed for the display in my project Monochrome Low-Power Display Library. The display driver is the ST7302 ^[10], and it shares some similarities with the ST7735 used for colour TFT displays. Here's the display layout: GraphicDisplayLayout3.gif The display is divided into 11 lines, each of which is 12 pixels high, and 125 columns, each of which is 2 pixels wide. Note that because 122 isn't an exact multiple of 12, only part of the last line actually appears on the display. Unlike on the colour TFT displays each pixel isn't individually addressable; in fact, the minimum update is to write three bytes to the display, which defines the state of a block of 2x12 pixels corresponding to one column and one row. Fortunately the display supports reading back the display memory, so it's not necessary to maintain a copy of the display in RAM to do things like line drawing; instead, to set a single pixel we can read the 2x12 block, change one pixel, and write it back. Reading from the display The routine ReadBlock() reads a 12x2 pixel block from the display memory specified by the column, from 0 to 124, and the line, from 0 to 10: uint32_t ReadBlock (uint8_t column, uint8_t line) { uint32_t pix = 0; PORT_TOGGLE(1<>mosi & 1); PORT_TOGGLE(1<>16); Data(block>>8); Data(block); PORT_TOGGLE(1<