Kaluma

A tiny JavaScript runtime for RP2040 (Raspberry Pi Pico)

Kaluma is a tiny and efficient JavaScript runtime for RP2040 (Raspberry Pi Pico). The main features are:

  • Small footprint. Runs minimally on microcontrollers with 300KB ROM with 64KB RAM.
  • Support modern JavaScript standards (ECMAScript 5/6/6+). Powered by JerryScript.
  • Has internal event loop like as Node.js for asynchronous.
  • Has built-in modules including file systems (LittleFS, FAT), graphics, networking and more.
  • Support RP2's PIO (Programmable I/O) inline assembly in JavaScript code.
  • Provides very friendly API that resembles Node.js and Arduino.

Installation

Pico

  • Get a Raspberry Pi Pico board or other RP2040 board.
  • Download firmware .UF2 file.
  • Push and hold the BOOTSEL button and plug into USB port of your computer, and then release the button. It will mount as USB storage device named RPI-RP2.
  • Drag and drop the downloaded .UF2 onto the RPI-RP2 volume. Your Pico will reboot automatically.

Quick Start

Write the first blink code with any text editor.

// index.js
const led = 25;
pinMode(led, OUTPUT);
setInterval(() => {
  digitalToggle(led);
}, 1000);

To upload code to your board, we need Kaluma CLI. Of course, it is assumed that Node.js is installed.

$ npm install -g @kaluma/cli

Use flash command of CLI to upload index.js to your board. CLI automatically finds a serial port which Raspberry Pi Pico is connected. If you want to specify a serial port to upload code, use --port option.

$ kaluma flash index.js

After uploading successfully, you will see a blinking LED on the board.