Visualization
For correct visualization of this site, its recommended the last versions of this softwares:




(for videos and photos)

Homemade MIDI turntable


Table of contents



About

I pretend to build a cheap and simple MIDIexternal link Turntableexternal link for use with Puredataexternal link.

I am sharing this project for free with GPL license in the hope that It helps someone with same needs of me. If you need help to build the project, have some ideas or need something, feel free to leave a comment or send me an e-mail: casainho@gmail.com.

State of project

95% - It already works, I just have to test It with an old turntable.

Download the source code for microcontroller ATmega16, the circuit schematic source and the Puredata test patch: Project-Homemade_MIDI_turntable-V0.3-15062007.tar.bz2external link.

Demonstration video

The next video does not show last version of software, there is some small differences.



In this video we can see the values of MIDI changing in Puredata. Values are from moving mouse.

On the left outlet - moving left: Number of ticks during 50ms and on the right outlet - moving right: Number of ticks during 50ms.

There are a red LED that turns on during 2 seconds and off during 1 second.

The yellow and green LED represents directions of mouse movement.

On the MIDI <-> USB converter, the flash LED have frequency of the 50ms, each time the MIDI messages are sent.

Hardware

I want use cheap and simple hardware that I can find easily in local shop.

The circuit


Click in the image to view the full circuit schematic or download circuit schematic - gEDA versionexternal link.

The circuit is very simple. There is a power bloc, with the 7805 IC - this bloc regulates input power and put the output at constant +5volts. This is the main and only voltage of the circuit.

The microcontroller ATmega16 is the brain. As inputs, there is only two, the YA and YB from HDNS-2000 ICexternal link, which reside inside the optical mouse. With this two inputs, we can know the direction of movement and velocity of the turntable.

As outputs, the microcontroller output information for MIDI and for three LEDs. It sends by MIDI information about the movement of turntable. One LED flash just for show activity of the microcontroller, and the other two, turn on when there is movement of the turntable, LED 1 when turn for right and LED 2 when turn for left.

Connector CONN2 is for programing the microcontroller, by SPIexternal link.

Turntable



Any older turntable or some homemade rotate plate should be ok.

I am waiting to get one old from a friend and in the future, I hope to construct one in wood.

Encoder



Any used or new optical mouse, should be ok for the encoder, to measure velocity and movement direction of the turntable.

I am using an old A4Tech, which have inside one HDNS-2000 IC. This IC is great because have one output as the expensive incremental rotary encoders, however, this HDNS-2000 IC can be found in most optical mouse, witch are very cheap and can be found everywhere.



As can be seen in the Typical Application using Quadrature Output on HDNS-2000 data sheet IC, the HDNS is already configured to work, we just need to connect two wires from pin 4(YA) and 5(YB) to the microcontroller ATmega16.

I had used the original USB cable from mouse. I had unconnected D+ and D+ wires from mouse electronic board and connected them to pin 4(YA) and 5(YB) of HDNS-2000 IC.

Microcontroller



I am using an ATmega16. It receives the data from mouse encoder(HDNS-2000 IC) and sends It by MIDI. Also flash the three LEDs.

I decided to use this microcontroller because there is FreeSoftware tools to develop software for it and I wanted to share this project with everyone.



I bought on Ebay for about 30 euros. It link Home Made MIDI Turntable with PC.

Ouput of lsusb command:
Bus 002 Device 007: ID 0a92:1010 EGO SYStems, Inc.

Software

GCC AVR and FreeRTOS

I am using GCC-AVR, AVR-Libcexternal link, UISP programmerexternal link and FreeRTOSexternal link. All this tools are FreeSoftware and are in Linux Ubuntu repositories smile, except FreeRTOS which have a kind of LGPL license and can be downloaded from is official home page - http://www.freertos.org/external link.

There was no need to use an RTOS, however, I wanted to learn to use it and it works really good! is quick to add some new functionalities, to add new tasks to system smile.

Source code

There source code and binary can be download here: Project-Homemade_MIDI_turntable-V0.3-15062007.tar.bz2external link.

Explanation:

There are three main code blocks, one interrupt service routine and two tasks.

Interrupt service routine - INT0

The task of this INT0 ISR is to increment or decrement a counter - TicksCount - , in this case, the number of ticks coming from HDNS-2000 IC.

This ISR is very short and simple, it must be like that since it should happen with high frequency. This ISR INT0 have the highest priority in the system.

Task - vMainTask

This task, works the data from TicksCount and send by MIDI the direction of movement from turntable and its relative velocity. It also signalize the data on LEDs 1 and 2.

The task happens every 50ms and have a lower priority than INT0 ISR.

Task - vFlashLED

This is a very simple task that flashes LED 0, just to signalize the working of the system.

It turns on the LED 0 every 2 seconds and off during 1 second.

This task have the lower priority, as it is not really important for the main task of the all system.

MIDI

The microcontroller always sends the sequence: 0xB0 -> 0xxx -> 0xxx. O 0xB0 is the start byte for a MIDI controller and sent for channel 0. The next bytes are relative velocity(ticks from HDNS-2000 encoder) during 50ms plus two bits indicating direction of movement.

1st byte: 0xB0

2nd byte: bit 6, turned right; bit 5, turned left; least five bits represents the higher bits of the 12 bits value of relative velocity(ticks from HDNS-2000 encoder).

3th byte: 8 bits representing the lower bits of the 12 bits value of relative velocity(ticks from HDNS-2000 encoder).

MIDI protocol specs:

MIDI project with an AVR and with source code:
http://www.serasidis.gr/circuits/MidiGenerator/MidiGenerator.htmexternal link

Puredata test patch




Vídeo



Download the Puredata test patch - Project-Homemade_MIDI_turntable-V0.3-15062007.tar.bz2external link.

My references to others works


mspinky no festival Dialektus Abril Budapest


Turntables made with PC mousesexternal link.

Last edited by casainho .
Page last modified on Sábado 23 de Junho, 2007 22:56:55 CEST.
O conteúdo desta página é licenciado sob os termos do Creative Commons by-nc-sa 2.5.