Close
0%
0%

Hall-Effect Mini Piano

Play your favorite songs using a custom mini electronic keyboard!

Similar projects worth following
306 views
0 followers
The goal of this project is to teach music-enthusiasts how to get a feel for piano using a custom electronic keyboard that can be hooked up to the computer for sound! Traditionally, people try learning piano using digital apps, but the feeling of playing with tactile keys is quite different from a touchscreen. It’s also quite difficult to access a keyboard for people who just want to learn the very basics, so this project aims to resolve these two issues by creating a mini keyboard that is able to handle polyphony!

1. Overview

This project implements a compact electronic piano mechanism that combines magnetic sensing (Hall effect) with a mechanically responsive key system. The design prioritizes (i) analog sensing of key displacement, (ii) tactile feedback through nonlinear restoring forces, and (iii) modular, repairable construction.

2. Mechanical Structure and Supports

The mechanical system is designed to ensure stable, repeatable key motion while minimizing wobble and misalignment.

  • Key Mounting (Rotational Axis):
    Each key is mounted on a shared rod (axle), allowing rotational motion similar to a lever. This enforces a single degree of freedom and ensures consistent pivoting.

  • Threaded Inserts and Screws:
    Structural components are assembled using threaded inserts embedded in the base. This provides:

    • Repeatable assembly/disassembly without degrading the material

    • Higher clamping force compared to direct screw insertion into plastic or wood

  • Wedge Constraint (Key Leveling):
    A mechanical wedge beneath each key defines the resting position. Its purpose is:

    • Prevent overextension from spring force

    • Ensure all keys return to a uniform height (planar alignment)

    • Provide a hard stop that stabilizes the equilibrium configuration

Overall, the structure behaves as a constrained rotational system with well-defined boundary conditions.

3. Magnet-Based Sensing Mechanism

Each key is instrumented with a permanent magnet attached to its underside, positioned above a Hall effect sensor.

  • Operating Principle:
    As the key is pressed, the magnet moves closer to the sensor, changing the local magnetic field. The Hall sensor outputs a voltage proportional to field strength:

    Vout proportional to B(D)

    where D is the magnet–sensor distance.

  • Advantages of This Approach:

    • Contactless sensing → no mechanical wear

    • Enables continuous (analog) key position detection rather than binary switching

    • Supports expressive control (velocity or pressure sensitivity)

  • Nonlinearity Consideration:
    The magnetic field decays nonlinearly with distance, so the voltage response is inherently nonlinear. This can be:

    • Calibrated in software

    • Or used directly for expressive mapping

4. Key Retraction and Restoring Mechanism

The restoring force is implemented using extension springs attached at the rear of each key.

  • Mechanical Behavior:

    • The spring force increases with displacement:

      F=kx
    • Because of lever geometry, the perceived resistance at the finger is non-uniform, typically increasing as the key is pressed further.

  • Tactile Outcome:

    • Provides a progressive resistance profile, closer to real piano feel than linear rubber domes

    • Enables more controlled actuation and improved user feedback

  • Interaction with Wedge:

    • The wedge ensures that when the spring retracts, it does not overshoot

    • This creates a well-defined equilibrium point and avoids oscillations or uneven resting states

5. Noise Reduction and Material Considerations

Mechanical prototypes introduced audible and tactile noise, addressed through damping strategies:

  • Foam Padding:

    • Added at contact points (e.g., wedge interface, base contact)

    • Reduces impact noise and vibration transmission

  • Surface Friction Mitigation:

    • Smoothing or lining contact regions reduces scratchy motion artifacts

    • Improves perceived quality of interaction

  • Tradeoff:

    • Excess damping can reduce responsiveness

    • Optimal design balances quiet operation with crisp mechanical feedback

6. Electrical and Signal Challenges and Potential Improvements

(a) ADC Stability and Wiring

  • Long analog wires introduce:

    • Noise pickup (EM interference)

    • Voltage fluctuations and unstable readings

Mitigation:

  • Shorten wire lengths

  • Use twisted pairs or shielding where possible

(b) Digital Filtering / Hardware Smoothing

  • Adding a capacitor across signal and ground acts as a low-pass filter:

    τ=RC
  • This reduces high-frequency noise before ADC sampling

  • Complement...

Read more »

pianodemo.mov

quicktime - 3.24 MB - 03/16/2026 at 20:03

Download

C4v6.wav

Waveform Audio File Format (WAV) - 2.68 MB - 03/16/2026 at 20:02

Download

hall_piano.ino

- 1.26 kB - 03/16/2026 at 20:02

Download

README.md

md - 1.62 kB - 03/16/2026 at 20:02

Download

piano_serial.py

py - 6.23 kB - 03/16/2026 at 20:02

Download

View all 10 files

  • 1 × 3D printed keys and baseboard (see .stl or .step files)
  • 1 × 6mm diameter rod
  • 5 × A1324 Hall Sensor Application Specific ICs / Telecom ICs
  • 30 × 6 x 2mm Neodymium Magnets
  • 10 × 6mmx10mmx3mm Bearings

View all 9 components

  • Wiring Diagram

    Ritali Jain03/18/2026 at 06:02 0 comments

    (soldered junction single bus soldered junction per ground and power line)

  • Wiring Diagram

    Ritali Jain03/18/2026 at 06:02 0 comments

    (soldered junction single bus soldered junction per ground and power line)

  • Hall Sensor Baseline Testing

    Ritali Jain02/24/2026 at 08:50 0 comments

    I finally wired up the hall sensor and tested whether it was sensitive enough to detect magnetic flux changes as I move neodymium magnetics near it. 

    The baseline was 2.5V as expected (analog serial signal 512) and I was able to get up to plus minus 25 on this serial value if two small magnets got really close. With more magnets (say a stack of around 10-15) the values were far more drastic (going into the 100s or 1000s depending on the polarity of the magnets).

    This is the pinout diagram. The flat side down is the one where these correspond (although this can be checked by setting the serial monitor to the correct baud rate and making sure the baseline is around 512.

    The Nano pinout is also here as a handy reference.

    (We will be using GND, 5V, and 5 analog pins)

  • 3D Prints

    Ritali Jain02/23/2026 at 10:13 0 comments

    The first round of 3D printing took place last week! The first thing I noticed was that I would need to make my keys substantially thinner if I want them to look more realistic. 

    The bearings and magnet design worked well because the components fit right in. I am having some issues with getting the bearings on the rods, however. I also still need to figure out how to get the keys/springs set up onto some sort of base plate in order to show the keypress effect. 

  • Initial Key Design Purchases

    Ritali Jain02/07/2026 at 07:38 0 comments

    02/06/26:

    Purchasing 6mm rod and bearings, torsion springs, and the hall effect sensors (A1324) for high sensitivity

    Allegro MicroSystems A1324LUA-T Enlarged ImageUpdated the CAD to account for insets for bearings as well as different test locations for neodymium 52 magnets! Still need to add some sort of inset for the torsion spring end (need to learn more onshape skills + intuition for this)

    Something to think about: the current magnet insets are 2mm and the magnets are diameter 6mm with 2mm thickness, but I'm wondering if the inset into the key needs to be reduced so that the hall sensor can actually detect the field and experience more fringing/exposure to detect changes in the magnetic flux.

View all 5 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates