The Waveshare Mini Piano HAT adds capacitive touch keys to Pi for music, MIDI control, and sound effects.
Features
- 13 capacitive touch pads (one octave + 1)
- I2C interface, LED per key
- Speaker output or 3.5mm jack
Setup
Mount on GPIO, enable I2C, install pygame.
Sound Synthesis
import pygame, numpy
pygame.mixer.init(44100, -16, 1)
def tone(freq, dur=0.5):
t = numpy.linspace(0,dur,int(44100*dur))
w = (numpy.sin(2*numpy.pi*freq*t)*32767).astype(numpy.int16)
pygame.sndarray.make_sound(w).play()
MIDI Output
import mido
out = mido.open_output()
out.send(mido.Message('note_on', note=60, velocity=100))
Projects
- Learning piano with LCD note display
- Sound effects board
- Musical doorbell
- Rhythm game
Frequently Asked Questions
Play chords?
Yes, pygame supports polyphonic playback.
Full MIDI keyboard?
Connect any USB MIDI keyboard instead.
Audio quality?
Use USB DAC or Audio HAT for better quality.
School use?
Affordable music education tool.
Conclusion
The Piano HAT adds musical interactivity to Pi for education and entertainment.
Browse the full Waveshare collection at Zbotic.in with fast shipping across India.
Add comment