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
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:
Schematic:
Wiring:
Then I replaced the original chip with a Blue Pill module and added a USB connector:
Zoom in
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
Patchage
: Provides a graphical interface to connect jack and midi inputs and outputs.
Zoom in
How to use it:
- Connect the Keyboard to the PC over an USB cable.
- Run
Yoshimi
. - Run
Patchage
and connect theMbed USB Audio MIDI 1
output toYoshimi
's input (dragMbed Audio MIDI 1
overyoshimi input
and drop)
- To apply the changes close the
Patchage
! - On
Yoshimi
's toolbar click onInstruments
and selectShow Stored ...
- Select a bank and click on the instrument you'd like to play.
Have fun :-)
MidiKey.cpp@0:75d307e38488, 2020-04-08 (annotated)
- Committer:
- hudakz
- Date:
- Wed Apr 08 17:47:23 2020 +0000
- Revision:
- 0:75d307e38488
- Child:
- 1:41d2a3984dd7
Converting Piano Toy to MIDI Keyboard.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 0:75d307e38488 | 1 | #include "MidiKey.h" |
hudakz | 0:75d307e38488 | 2 | |
hudakz | 0:75d307e38488 | 3 | /** |
hudakz | 0:75d307e38488 | 4 | * @brief |
hudakz | 0:75d307e38488 | 5 | * @note |
hudakz | 0:75d307e38488 | 6 | * @param |
hudakz | 0:75d307e38488 | 7 | * @retval |
hudakz | 0:75d307e38488 | 8 | */ |
hudakz | 0:75d307e38488 | 9 | void MidiKey::scan() |
hudakz | 0:75d307e38488 | 10 | { |
hudakz | 0:75d307e38488 | 11 | _row.output(); |
hudakz | 0:75d307e38488 | 12 | _row.mode(PullUp); |
hudakz | 0:75d307e38488 | 13 | _row = 1; |
hudakz | 0:75d307e38488 | 14 | _position = _col.read(); |
hudakz | 0:75d307e38488 | 15 | _row.input(); |
hudakz | 0:75d307e38488 | 16 | _row.mode(PullDown); |
hudakz | 0:75d307e38488 | 17 | if (_position != _lastPos) { |
hudakz | 0:75d307e38488 | 18 | _position == 1 ? _midi.write(MIDIMessage::NoteOn(_note)) : _midi.write(MIDIMessage::NoteOff(_note)); |
hudakz | 0:75d307e38488 | 19 | _lastPos = _position; |
hudakz | 0:75d307e38488 | 20 | } |
hudakz | 0:75d307e38488 | 21 | |
hudakz | 0:75d307e38488 | 22 | wait_ms(2); |
hudakz | 0:75d307e38488 | 23 | } |