Converting Piano Toy to MIDI Keyboard.

Dependencies:   mbed mbed-STM32F103C8T6 USBDevice_STM32F103

How to turn kids' old piano toy to a MIDI keyboard

Inspired by http://www.codetinkerhack.com/2012/11/how-to-turn-piano-toy-into-midi.html I did the same with a Blue Pill module using Mbed.

The old toy was capable to play only one tone at a time:
Zoom in
https://os.mbed.com/media/uploads/hudakz/minikeyboardtoy01.jpg



A bit of reverse-engineering was needed to re-use the original printed boards. The results are below.

Original PCBs with switches traced to the connector pins:

Zoom in
https://os.mbed.com/media/uploads/hudakz/keys.jpg Zoom in
https://os.mbed.com/media/uploads/hudakz/buttons.jpg

Schematic:

Zoom in
https://os.mbed.com/media/uploads/hudakz/schematic.png

Wiring:

https://os.mbed.com/media/uploads/hudakz/wiring.png



Then I replaced the original chip with a Blue Pill module and added a USB connector:
Zoom in
https://os.mbed.com/media/uploads/hudakz/minikeyboardtoy02.jpg

Works great when connected over an USB cable to a Linux Ubuntu 18.04 machine

Installed software:

  • Yoshimi: An excellent MIDI software synthesizer for Linux.
    Zoom in
    https://os.mbed.com/media/uploads/hudakz/yoshimi.png
  • Patchage: Provides a graphical interface to connect jack and midi inputs and outputs.
    Zoom in
    https://os.mbed.com/media/uploads/hudakz/patchage.png

How to use it:

  • Connect the Keyboard to the PC over an USB cable.
  • Run Yoshimi.
  • Run Patchage and connect the Mbed USB Audio MIDI 1 output to Yoshimi's input (drag Mbed Audio MIDI 1 over yoshimi input and drop)

https://os.mbed.com/media/uploads/hudakz/connection.png

  • To apply the changes close the Patchage!
  • On Yoshimi's toolbar click on Instruments and select Show Stored ...
  • Select a bank and click on the instrument you'd like to play.
    https://os.mbed.com/media/uploads/hudakz/instruments.png

Have fun :-)

Committer:
hudakz
Date:
Thu Apr 09 08:23:32 2020 +0000
Revision:
1:41d2a3984dd7
Parent:
0:75d307e38488
Converting Piano Toy to MIDI Keyboard.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hudakz 0:75d307e38488 1 #ifndef MIDIKEY_H
hudakz 0:75d307e38488 2 #define MIDIKEY_H
hudakz 0:75d307e38488 3
hudakz 0:75d307e38488 4 #include "mbed.h"
hudakz 0:75d307e38488 5 #include "USBMIDI.h"
hudakz 0:75d307e38488 6
hudakz 0:75d307e38488 7 class MidiKey
hudakz 0:75d307e38488 8 {
hudakz 0:75d307e38488 9 public:
hudakz 0:75d307e38488 10 MidiKey(USBMIDI& midi, uint8_t note, DigitalInOut& row, DigitalIn& col) :
hudakz 0:75d307e38488 11 _midi(midi), _note(note), _row(row), _col(col), _position(0), _lastPos(0) {}
hudakz 0:75d307e38488 12 virtual ~MidiKey() {}
hudakz 0:75d307e38488 13 void scan();
hudakz 0:75d307e38488 14 private:
hudakz 0:75d307e38488 15 USBMIDI& _midi;
hudakz 0:75d307e38488 16 uint8_t _note;
hudakz 0:75d307e38488 17 DigitalInOut& _row;
hudakz 0:75d307e38488 18 DigitalIn& _col;
hudakz 0:75d307e38488 19 uint8_t _position;
hudakz 0:75d307e38488 20 uint8_t _lastPos;
hudakz 0:75d307e38488 21 };
hudakz 0:75d307e38488 22
hudakz 0:75d307e38488 23 #endif // MIDIKEY_H