this is the documentation for the piano stairs. any questions, please feel free to email bigchicken at alum. included in this archive: 1. eagle files, schematics, and gerbers for sensor boards 2. atmelstudio files for sensor code 3. arduino code for master 4. this file system overview --------------- the system is a transmit-receive geometry capacitive sensing scheme. the metal strip on the wall is the transmitter, and the tread protectors on the stairs are the recievers. there is a daisy chain, packet passing protocol to get the data from the top of the stairs to the bottom. this is controlled by the arduino, which then parses the data and sends out midi commands. transmitter ----------- this is a 200kHz sine wave @ 8Vpp generated by the arduino. it is a square wave run into a resonant LC tank. a higher amplitude sinewave might give a better SNR on the receive side, but as this voltage goes through the user, i wouldnt push it too much. as it is, it would be best if people with pacemakers or other embedded electronics did not use it. reciever -------- the reciever is a simple RC high pass filter followed by a diode and capacitor peak detector circuit. this goes to the ADC of the microcontroller, and is oversampled 64 times to create a 16b value. the sample rate is around 100Hz for the 64x oversampled data. data can be requested at a faster or slower rate if desired, as the oversampling is performed when data is requested. packet passing protocol ----------------------- the arduino acts as an SPI master, and sends a clock, and select line to all of the sensors. the sensors, when the select line is pulled low, send their data to each other. the master needs to clock 8 times for each step, in order for the data to get passed from one step to the next, and arrive at teh arduino. this is done twice, once for the MSB and then a second time for the LSB. if you only want the MSB, you only need to do this once. in order to discriminate between which packet to send, the sensors count how long it has been since the last packet was requested. if it was more than ~5ms, then its assumed that the MSB is desired. this means that the LSB needs to be requested less than 5ms after the MSB, and that at least 5ms must pass before requesting the next MSB. since oversampling happens when data is requested, a minimum of 600us must be given after pulling select low, before clocking the data. data should also be clocked around 250kbps. it could probably go faster, but the capacitance on the long data clock lines will start to degrade the signal. midi generation --------------- the midi generation code is pretty slack-ass. i only used 8b data, and all of the polyphonic aftertouch was commented out (and not really tested) as i didnt have time. basically, there is some setup to put some pins high for the data transfer and RF transmitter. then there is some calibration code that looks for peak values over a 30s period to set thresholds. during this period, someone should walk up the stairs without touching the strip, to set the max values (values are higher with people on the stairs versus not). then data is collected off the sensors, and debouncing is peformed (2 "on"s in a row for on, and 2 "off"s in a row for off). an array is used to keep track of state, and note on/off messages are sent appropriately. another array keeps the note values. there is some code to check if all notes are off, and send and "all notes off" message as a safety, but thats commented out and hasnt been tested. this is useful if a note gets stuck for some reason. the polyphonic aftertouch would allow sounds to be modified by body position on the step after notes turn on, but would require a synth that responds to these messages. things that need fixing (8/12/2019) ----------------------------------- 1. put the arduino in a box, mounted on the wall, with connectors for RF out, power in, sensors in, and midi out. 2. put a coax cable between the arduino and metal strip, run it nicely on the wall/cieling, and make a secure attachment to the metal strip (perhaps a large washer with screw and crimp connector on the coax). 3. attach the sensor leads more securely to the metal tread protectors. this could be done with a screw, or by lifting the tread protector, and placing the wire underneath. right now they are just taped, which aint gonna last. 4. get a synth and sounds system of some sort. if someone wanted to hack the synth that is there, it could be used. optical breakbeam modification ------------------------------ the original system was an optical breakbeam setup. this had a transmitter on one side, and a reciever on the other. the same hardware that is currently installed could also do this, if people preferred that method. the optical system has the advantage of not requiring touching the metal tape, and will work the same independent of who uses the system (and works with cats). the capactive system could probably also work without having to touch the strip (just calibrate it without someone walking on the stairs), and allows for another mode of expression (touching or not touching the strip). so, if an optical system is desired, replace the antenna with a photodiode or phototransistor, and a resistor to ground. connect the photodiode/transistor to +Vcc, its output to the antenna and a resistor, and the resistor to ground. be sure that ambient light does not saturate the photoreceptor. then, place a string of LEDs on the steps, and modulate them at 100kHz to 200kHz. other notes ----------- 1. the cables between sensors were all cut about 1" too long, so the cables are jammed in pretty hard. not the best situation, but shouldnt be an issue. if the cable raceway gets replaced at some point, it might make things easier if a slightly larger raceway was used, or a slightly longer path was taken with it. a lot of the raceway is no longer attached to the wall. 2. i have some spare boards and parts if they are ever needed. hope alls well with you