Kake Toy

Kake is a MicroPython-based firmware for a little toy remote that plays MIDI and MOD music as well as various sounds.

The four colorful buttons the bottom are used to switch between the following modes:

Mode 1: Numbers

Mode 2: MOD music

Mode 3: Instruments

Mode 4: MIDI music

Compiling and installing

First, check out all submodules:

git submodule init
git submodule update --recursive --remote

Next, compile the rp2040 version of MicroPython with our custom native module:

cd micropython
make BOARD=RPI_PICO submodules
cd ports/rp2
make USER_C_MODULES=../../examples/kakenative/micropython.cmake -j8

Next, flash the generated firmware from micropython/ports/rp2/build-RPI_PICO/firmware.uf2 to the Pico.

Finally, copy all the Python files plus data files from under data/ to the MicroPython filesystem using Thonny.

Sofware simulator

The project also contains a simple software simulator based on Pyxel for running the firmware on a normal computer. To run it:

  1. Install uv if you already haven’t.
  2. Build the native music playback module:
cd sim_mod
make

Finally, run the simulator:

uv run main.py

Hardware

This basis for this project is a modified multilingual TV remote control toy. You can find similar ones all over. One day, the toy suddenly stopped working, which was enough motivation for me to pull it apart and start this project.

The microcontroller is a WaveShare RP2040-Zero, which just about fits inside the chassis. Its specs are:

There is additionally a MAX98357 based amplifier for the speaker.

Wiring

image

The keyboard scan matrix on the original PCB is wired as follows:

ButtonInput - Output
powerB3 - E3
ch+B2 - E3
vol+B2 - E1
okB3 - E2
vol-B2 - E0
ch-B2 - E2
1A3 - E1
2A3 - E0
3A2 - E3
4A2 - E2
5A2 - E1
6A2 - E0
7A1 - E3
8A1 - E2
9A1 - E1
0A3 - E2
revB3 - E1
stopB0 - E2
playB3 - E0
fwdB1 - E3
fiB0 - E3
dkB0 - E1
noB0 - E0
seA3 - E3

These are wired to the following GPIO pins on the Pico:

image

PinConnection
vsysbattery+
gndbattery-
gp9E0
gp10E1
gp11E2
gp12E3
gp14A1
gp15A2
gp26A3
gp0B0
gp1B1
gp2B2
gp3B3
gp5max98357 DIN (SD)
gp6max98357 BCLK (SCK)
gp7max98357 LRCLK (WS)
gp4led+
gndled-

Power management

The microcontroller is powered by two AAA batteries. In order to make them last as long as possible, I shut down the microcontroller after two minutes of inactivity.

I originally wanted to use the power button to wake the microcontroller again, but the buttons on the remote are flaky enough that they start registering presses on their own if you leave the corresponding output pin high for more than a few tens of milliseconds.

The plan B was a tilt ball switch that triggers the wake up interrupt when the remote is rotated or shaken.

The repository contains a version of MicroPython as a subproject with modifications to allow this wake up from deep sleep.

Downloads