Mouse Organ

This is a simple project that takes about an hour to make. It uses and Arduino and an optical PS/2 mouse or a USB mouse that is also PS/2 compatible. The Optical Cello project uses two mice. The mouse has four wires, 0 and +5 volt are connected to the gnd and +5v pins and the other two wires are connected to pins D2 and D4. A PS/2 mouse typically has a green round plug with 6 pins. Only 4 of the pins are in use. A USB mouse that can also work in PS/2 mode also uses 4 wires.

  • USB PS/2 Compatible mice
  • Red - +5V
  • Black - Gnd
  • Green - Clock (D2)
  • White - Data (D4)
  • PS/2 mice (made by V7)
  • Blue - +5V
  • Green - Gnd
  • Orange - Clock (D2)
  • Brown - Data (D4)

  • Staples wired mouse - PS/2 Compatible
  • Orange - +5V
  • White - Gnd
  • Blue - Clock (D2)
  • Green - Data (D4)
  • The software is divided into two main pieces. mouseorgan.ino has the high level code that uses the X,Y and switch data from the mouse and decides what Midi data to transmit. mouse.ino has the code that communicates with the mouse and decodes the three byte messages and updates three variables :-

    • mx - an integer that has the current X value
    • my - an integer that has the current Y value
    • mswitches - the bottom three bits indicate the state of the three mouse buttons.

    There are three source files for this project. Create a folder called mouseorgan and download and save the following three files into it.

    The main organ code is in the mouseorgan.ino file. The mouse1.ino provides the PS/2 interface and is similiar to other PS/2 mouse code. If you look through other projects I have on my website you can see that they share alot of code.
    radioshack logo
    Arduino logo