MIDI Footsteps
MIDI Footsteps
Introduction
This is a project I made as part of a large installation, however the rest of the installation is defined by software so I just want to present the hardware aspects here.
The requirements were simple, I wanted to detect someone treading on a pressure sensor and transfer that information back to a computer through a MIDI interface. I was only interested in the step / no step event but I decided to make a system that would respond to different amounts of pressure.
Finished unit
Foot Sensors
The key to this all is the foot fall sensor. You can get switch mats used for burglar alarms but these were far too big and quite expensive once you have to buy sixteen of them. So I decided to make my own sensors out of conducting foam. This is material that is used to pack semi conductors and is normally thrown away. There are several types but most look like black foam rubber. A quick prod with a resistance meter will soon show if it is conductive. You can expect to see anything between 100K and 1M resistance between tow probes about an inch apart. Now here is the interesting part, as you compress the foam the resistance goes down, that is the effect I wanted to capitalise on. The trick is to get an electrical contact onto the foam. Being a plastic it is not very amenable to being soldered, so the trick is to get it in contact with something you can solder. I have used copper tape and a solder lug through a bolt an an aluminium plate in the past but they both have there problems. Short term they work a treat, however over several months the surface oxidises and the contact is less secure. You can use conductive glue to attache the copper foil or plate but I didn't have any and while you can make your own with a mixture of liquid tape and powered graphite, I didn't have any of that either. What I did have was access to a skip at work where they were throwing a way all sorts of samples. I spied a set of gold plated pin headers, there should be no trouble with gold oxidising. These headers were a double row but I only needed one row, so I snipped off all the connectors on one side. Next on the top row I snipped of the short end of every even numbered pin, then on the bottom row I removed every odd numbered pin. Then it was a simple matter to connect together all the pins sticking out on the top and bottom rows to give me an interlocking mesh of connections. Just like threading together the fingers of each hand, I had in effect a number of parallel conductors to lay the conducting foam onto. Each footstep sensor I made from a piece of 6mm thick 35cm x by 16cm MDF, and I routed two resilience that would fit the tops of the headers in, and finally another recess to the edge of the board. Then I got some more ridged plastic foam from some packing waste an using hot melt glue surrounded the connections, however I left 3cm clear at each end so I could duck tape it to the floor. The packing foam is because the mechanical recovery of the conducting foam is not too great and the packing waste gave me more resilience. Then I cut a piece of conducting foam and placed it in the hole. Finally to top it off I placed a piece of curtain material from a sample book over the whole thing and attached it with more hot melt glue. With this arrangement I was able to get a contact resistance that went from 200K down to about 5K when compressed. This was proportional with the amount of compression so I could have used these as continuous peddles if I wanted.
A foot sensitive MIDI interface
By Mike Cook
Electronics
Now we come to the electronic part, There are only 6 analogue inputs on a standard Arduino so I had to multiplex the analogue signals into the existing analogue inputs. I used two 4051 multiplexers, each one switches one connection from 8 possible others. It is a bi-directional multiplexer so you can't really talk about inputs or outputs but in mi case I only needed the signal to go in one direction so I used it as 8 inputs connecting to one output. That output is then connected to an analogue input of an Arduino. The input that is selected depends on the binary value you put on the three select pins. As I was using two Arduino analogue inputs then I could make the select pins common on each multiplexer.
The multiplexer inputs are then connected to the foot sensors through a phono socket. As the sensor only changes the resistance I needed a pull up resistor of 100K on each input. Then I added a 0.1uF capacitor on the output of the sensor to cut down on any noise pickup. Finally I added a bit of protection in the form of a series 100R resistor and a 5V1 zener diode. It is always a good idea to include protection on any connection going to a socket or terminal, its a cruel world out there.
I also wanted an indication of when each sensor was being triggered, this would help in setting things up and would aide in any trouble shooting, should it be necessary. This isn't a functional requirement so you can leave this part off if you want to simplify matters. I used a 23016 port expander, this gives 16 inputs or outputs hung off the I2C bus and I could drive an LED direct from the outputs.
Finally it needs to generate a MIDI output and this is simply done by using a PNP transistor driving the MIDI socket.
There are two schematics for this project, one uses an Arduino board and the other is for a stand alone system. In order to programme the stand alone system I used a program header that I connected to a USB to TTL serial board. When the project was complete I could remove this board and use it on other projects, that was minimising wastage and making things as cheap as possible. I also had a power select jumper on the stand alone system so that I could power if from the USB port when developing and switch over to a conventional regulator when making the project permanent. Both schematics can be downloaded here Schematic.zip.
Construction
I made the interface on strip board using a combination of through hole parts and surface mount parts. I use the surface mount parts for convenience more than anything as they were to hand but it did make for a slightly smaller final system. Also decoupling capacitors work better as surface mount as there is no lead inductance to spoil the capacitive effect. The eagle eyed amongst you might notice the photograph of the LED current limiting resistor are 270R and the schematic shows them as 330R, there is not much difference in brightness between the two. The strip board was mounted in U channel aluminium with a plastic sheet top and bottom. The hardest part was getting the holes for the phono sockets in the right position. I used a pin header and socket to attach the LEDs to the man board so that I could easily remove the LEDs during construction and debugging. The most tricky part was getting the correct LED aligned with the correct phono input. I resorted to numbering things with pencil as you can see on the photographs.
Software
The software is fairly straightforward, and can be downloaded here Footsteps Software.zip. After initially setting up the pins and port expander the main loop, reads all the analogue inputs from the sensors and puts them into an array. Then it looks for any change and sends the appropriate MIDI control message if required. Finally it copies the values just read into a store so that next time round the loop it can see if anything has changed.
The sensor scan has to output a binary number from 0 to 7 on the three output pins connected to the multiplexer's select lines. I does this by using bit manipulation on the loop index to isolate each bit in the index and perform a digital write of that value to the pin. Then analogue inputs 0 and 1 are read and put into array position given by the index and the index plus 8. In this way the first multiplexer provides the values for the inputs 0 to 7 and the second multiplexer provides the values for inputs 8 to 15.
The look for change function is a bit more complicated. First it looks at each of the input values and compares them to a threshold to decide if they are on or off. It builds up a bit patten in a variable where a 1 in a bit position indicates the sensor is on and a indicates it is off. This makes two things simpler, one is that to see if anything has changed you only need compare this one number with the one you got last time and second it is this number you need to send to the port expander to get turn the appropriate LED on or off. If something has change you then need to update the LEDs and send the approbate MIDI control message. I have written the software so that the sixteen sensors send MIDI control message 16 to 31, with a value of 0 if the sensor is off or 127 if it is on.
In practice the interface behaved itself very well, allowing be to construct a large circle of foot step sensors. You can of course change the software to send notes rather than MIDI control messages and have a giant foot operated keyboard.