Hardware Interface

Force or pressure is normally measured with a (piezo)resistor bridge sensor. Alternatively one may use also a piezo crystal, by measuring the voltage, generated by it's applied pressure change. The latter is not so suitable, due to it's limited frequency range (10 Hz and up). Where in this case, most frequencies are in the range lower than 10 Hz. So there had to be found another way. Either another type of sensor, or another way of measuring. Problem with the other type of sensor is that there is only a limited amount of space for the sensor, Of course one may find a solution to change the mechanical properties in such a way that a larger sensor is mounted in an different place than where the actual force is applied, but this makes the construction more complicated. The advantage of the Piezo crystal sensor is, as it is used as a transducer in many digital wrist watches, it's very low height, low cost, and relatively easy, but unorthodox controlling. The electronics between the sensor and the microcontroller is merely a simple oscillator, where the sensor depends it's own oscillating frequency, and a circuit which enables the microcontroller to synchronise the sensor. Unfortunately, the chosen values for the components around the oscillator are quite limited, so one should experiment a little bit with that. See the schematics for this oscillator:

A stabilized 5V Power supply is is made adjustable for the power supply of the oscilator, with an extra circuit, which is not drawn here. The stabilized 5V is connected with the "brains" of the device: an Atmel AT89c2051 microcontroller. It is compatible with MCS-51™ products. I choose for this microcontroller because it is small and very easy to connect. Details about this controller can be found on the internet at Atmel. Last but not least we have the midi out, which is connected to the TxD port of the chip.

Software Solution

The pressure sensor is being brought into some kind of self oscillation, synchronised by the microcontroller. Force applied to the sensor causes a phase shift. The microcontroller makes sure that the frequency stays the same. After a hardware reset, the microcontroller calibrates itself to the sensors free running frequency. The calibrating creates a certain window for the self oscillating process, to keep the maximum phase shift within a valid range. This is vital for its proper functioning, because the sensor seems to be rather sensitive to temperature changes.

After calibrating follows normal operation. The sensor is monitored each period during a short time. A shift in phase indicates a change of pressure. Through a linearisation table, multiple values are captured and together outputted as an average value, representing absolute pressure. Easy recording of MIDI data with sequencers, favoured the decision to choose for the MIDI standard as an output format, available at the serial output from the microcontroller.

Next step for processing the collected data is to visualize it. This is not very easy, as MIDI pressure control data is not such a convenient format in exporting and especially importing. So I wrote a program, which converted a standard MIDI file into normal ascii text files; each track was assigned to a different file, which contained seperated values for time stamp and pressure. Then finally with a spreadsheet these data could be imported and made visible.

For this project I wrote three main programs:
1. A debugger program, which wrote incoming midi data to the screen. It was written in c, and runs on an Atari.
2. A converter program, which converted standard midi files to a standard txt file with numbers, corresponding to the measured data and time stamp. It too was written in c, and runs on an Atari.
3. The program for the microcontroller, which performed the measurements. It was written in assembly language, and assembled on a PC.

The programming in assembly was a bit tricky in several ways. Most difficult was to create reliable timing and enough speed. Hardware interrupts solved here a great deal. Further difficulties were found in mathematical operations, where the microcontroller, which supports only byte by byte division, had to perform divisions with 32 bit long words and 16 bit words.


Usefull information can be found at:

The chin rest fitting system

Download a full version of this -German- essay as a pdf file (2.8 MB)