Calliope mini

The Calliope mini [1] is a single-board computer developed for use in German primary schools. It is inspired by the BBC Micro:bit, and shares some of its features.

Like the BBC Micro:bit it is based on the Nordic Semiconductor nRF51822 ARM Cortex-M0 microcontroller running at 16 MHz and with 256 Kbytes of flash program memory. The boards produced from 2019 onwards use the nRF51822-QFAC version with 32 Kbytes of RAM, twice as much as the BBC Micro:bit:

CalliopeMini.jpg 

It's available from Adafruit [2], or from Amazon in the UK [3].

Like the BBC Micro:bit it includes a 5x5 LED matrix display, two push buttons, banana plug/crocodile clip connections, and a JST battery connector. It also features a MEMS microphone, piezo speaker, DC Motor Driver (TI DRV8837), two Grove connectors (I2C + serial/analog), and a space for an optional DataFlash chip.

It is named after Kalliope, a daughter of Zeus and the muse who presides over eloquence, science, and epic poetry.

Installing uLisp on the Calliope mini

You can install the ARM Version 3.3 or later of uLisp on a Calliope mini using the Arduino IDE as follows:

  • Download the ARM version of uLisp from the downloads page: Download uLisp.
  • In the Arduino IDE open the Preferences dialog box, and add the following URL to Additional Board Manager URLs:
https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json
  • Open the Boards Manager… from the Board item on the Tools menu, search for nRF5, and install Nordic Semiconductor nRF5 Boards by Sandeep Mistry.
  • Connect the Calliope mini to your computer using a USB cable.
  • Select Calliope mini from the Board menu, set Softdevice to None, and set Port to the USB port.

You should now be able to upload uLisp to the Calliope mini.

Follow the instructions in Using uLisp to interact with uLisp on the Calliope mini.

Updating the serial buffer

As with the BBC Micro:bit there is one change I recommend you make to the Sandeepmistry core before uploading uLisp; without this change the Serial Monitor drops characters if you paste a long listing into the input field:

  • Locate the file RingBuffer.h at:
/Users/david/Library/Arduino15/packages/sandeepmistry/hardware/nRF5/0.6.0/cores/nRF5/RingBuffer.h

replacing David by the name of your user folder, and 0.6.0 by the version of Sandeepmistry you have installed.

  • Edit the file in a text editor, and change the line:
#define SERIAL_BUFFER_SIZE 64

to:

#define SERIAL_BUFFER_SIZE 256

Using the full 32 Kbytes of RAM

The Arduino core assumes that the Calliope mini has 16 Kbytes of RAM. To take advantage of the full 32 Kbytes you need to make the following changes:

  • Locate the boards.txt file at:
/Users/david/Library/Arduino15/packages/sandeepmistry/hardware/nRF5/0.6.0/boards.txt

replacing David by the name of your user folder, and 0.6.0 by the version of Sandeepmistry you have installed.

  • Edit the following three entries as shown, changing "xxaa" to "xxac" in each case:
CalliopeMini.build.ldscript=nrf51_xxac.ld
CalliopeMini.menu.softdevice.s110.build.ldscript=armgcc_s110_nrf51822_xxac.ld
CalliopeMini.menu.softdevice.s130.build.ldscript=armgcc_s130_nrf51822_xxac.ld
  • Change the #define in the ARDUINO_CALLIOPE_MINI section in the ulisp-arm.ino file as follows, to increase the workspace to use this extra space:
#define WORKSPACESIZE 3328              /* Objects (8*bytes) */

Pin connections

The Calliope mini has 6 pads which can take crocodile clips or banana plugs.

Calliope_mini_1.gif

The board also includes two pushbuttons and a matrix of 5 x 5 multiplexed LEDs. See Example programs below for examples of using these from uLisp.

Buttons

The Calliope mini provides two pushbuttons on pins 20 (A) and 22 (B). You can read these with the following program:

(defun buttons ()
  (pinmode 20 nil)
  (pinmode 22 nil)
  (loop
   (print
    (list (digitalread 20) (digitalread 22)))
   (delay 1000)))

Run it by typing:

(buttons)

LEDs

The Calliope mini provides a matrix of 5 x 5 LEDs. They are connected in an illogical arrangement of nine rows and three columns, and to light any individual LED you need to take the row low and the column high corresponding to that LED.

The following table shows the (row, column) for each LED:

(4, 13) (7, 14) (5, 13) (8, 14) (6, 13)
(7, 15) (8, 15) (9, 15) (10, 15) (11, 15)
(5, 14) (12, 13) (6, 14) (12, 15) (4, 14)
(11, 13) (10, 13) (9, 13) (8, 13) (7, 13)
(6, 15) (10, 14) (4, 15) (9, 14) (5, 15)

This program flashes the LED at (row, column):

(defun b (row col)
  (let ((x t))
    (pinmode row t)
    (pinmode col t)
    (digitalwrite row nil)
    (loop
     (digitalwrite col x)
     (delay 1000)
     (setq x (not x)))))

For example, to flash the centre LED run:

(b 6 14)

Analogue outputs

Any pin can also be used as an 8-bit analogue output, so you can pulsate the centre LED slowly on and off with the program:

(defun pulse ()
  (let (down)
    (pinmode 6 t)
    (digitalwrite 6 nil)
    (loop
     (dotimes (x 256) 
       (delay 5) 
       (analogwrite 14 (if down (- 255 x) x)))
     (setq down (not down)))))

Run it by typing:

(pulse)

Exit from any program by entering ~.

Analogue inputs

The Calliope mini provides six 10-bit analogue inputs, three of which are available on the edge connector pins labelled 0, 1, and 2.

The following example program reads the analogue input on pin 0 and displays the value as a bar of LEDs, using the fourth row of LEDs on the matrix. The program takes advantage of the fact that this row of LEDs share the same column number and have consecutive row numbers. Here's the program:

(defun meter ()
  (let ((row 7) (col 15))
    (pinmode col t)
    (digitalwrite col t)
    (dotimes (i 5) (pinmode (+ row i) t))
    (loop
     (dotimes (i 5)
       (digitalwrite 
        (+ row i)
        (< 
         (analogread 1)
         (* (1+ i) 170)))))))

To run it evaluate:

(meter)

If you touch pad 1 on the edge connector you'll see the bar flash from the voltage on your finger. Connect a voltage of up to 3.3V to pad 1 to display a bar of LEDs in proportion to the voltage.

DataFlash capability

Interestingly the Calliope mini circuit board has a space for a 8-pin surface-mount DataFlash chip, type M45PE80 (8 Mbyte) or M45PE16 (16 Mbyte). It's possible this could be used to add the ability to save and load uLisp images to the board.


  1. ^ Calliope mini website.
  2. ^ Calliope mini on Adafruit.
  3. ^ Calliope mini on Amazon.

Previous: BBC Micro:bit

Next: ESP32 boards