Air drums that trigger MIDI notes when your hands pass over infrared sensors, built on an ATmega8 at the MIDI baud rate, with a 555-based 38kHz IR front end and TSOP1738 receivers.

MIDI air drums sit at an interesting intersection of music and electronics. Unlike a traditional kit that needs physical strikes on pads, this system uses infrared sensors that fire when your hands move over them, then sends the data to a computer’s synthesizer.
The project centres on MIDI (Musical Instrument Digital Interface), an industry-standard protocol established in 1982. MIDI lets electronic instruments such as keyboard controllers, computers, and other equipment communicate, control, and synchronize with each other.
MIDI transmits event data rather than audio: information about pitch, intensity, velocity, and timing. It runs at 31,250 baud, and every MIDI-compatible device interprets the messages identically.
A standard MIDI word is three bytes: a status byte followed by two data bytes. A NOTE_ON event on channel 1 might look like 0x90, 0x3C, 0x7F (middle C at maximum velocity). The upper nibble of the status byte is the command type, the lower nibble is the channel (1 to 16). All status bytes have the MSB set to 1 and all data bytes have it set to 0, which makes them easy to tell apart. For drums, MIDI channel 10 controls percussion, and each note number maps to a specific drum sound under General MIDI.
I chose an ATmega8 microcontroller running at 8 MHz, which can transmit at 31,250 baud, the MIDI standard speed.
Microcontroller board: a development board with a rectifier converting AC to DC, regulated to 5V for TTL logic. It includes the ATmega8, Port B inputs to tactile micro-switches, a six-pin header for serial programming, and a four-pin header for UART (Rx, Tx, Vcc, Ground). The PCB was designed in DipTrace freeware.
IR sensors: the triggering uses infrared sensors with a 555 timer in astable mode generating a 38 kHz carrier. TSOP1738 sensors detect the modulated IR; their output goes low when receiving IR and stays high otherwise.
I used WinAVR, which bundles the GNU GCC compiler for C and C++ (avr-gcc), the programmer (avrdude), the debugger (avr-gdb), and more. The firmware initializes UART and continuously scans the sensors. When a sensor output goes low, it transmits a three-byte MIDI command.
void midi(uint8_t cmd, uint8_t data1, uint8_t data2) { uart_tx_char(cmd); uart_tx_char(data1); uart_tx_char(data2);}Each sensor triggers a different drum sound through a distinct MIDI note value. After a hit, a 200 ms delay precedes a NOTE_OFF command (0x8A status byte). The data leaves the board at 38,400 baud, and a small program called “edrummonitor” converts it to the MIDI-standard 31,250 baud and routes it to the PC’s built-in synthesizer.
The system is fast and accurate, and the small initial latency becomes imperceptible after a little use.
Originally published on sslabs.in.