In the belief that a properly programmed Arduino can perform any function necessary to implement a VPO, at a cost much less than that of commercially available units, I decided to explore whether an Arduino Mega has enough digital inputs to parallel scan a 61 note keyboard. At first the answer appeared to be no, until I discovered that three of the four serial ports can be relieved of their serial port duties and reconfigured to yield an additional six digital input pins. It turns out, the Arduino can then scan 64 digital inputs and one analog input, the latter useful for adding an expression pedal. Two, three or more of these scan units, each with the identical program, can then be daisy chained together depending on the number of keyboards. What the limit is, I do not know.
To me, parallel wiring has always seemed attractive because of its conceptual simplicity; configuring and wiring diode-isolated matrixes, I find a nuisance. Here, however, one keyswitch is wired to one input pin, no diodes required. The other sides of the switches share a common ground. Analog input can be as simple as connecting the wiper of a 20k (+/-) potentiometer, connected across ground and 5V, to the analog input pin.
Two procedures are included for converting expression pedal voltages in, to controller commands out. Method 1, features an array of numbers that specifies which controller values are to be output for each input voltage in 0.31V increments. This array can be edited by the user to yield any response curve desired.
Method 2 , which I have commented out, provides a simple linear response but requires that you fit a straight line to two points based on the voltage with the swell pedal closed and the swell pedal open. This works well if the voltage change occupies only a small segment of the 0 to 5V range. Try this if you still remember your y = mx + b.
Daisy chaining the units requires that all the Arduinos be connected to a common ground. Then it is just a matter of connecting Transmit Out (Tx) of one unit to Receive In (Rx) of the next unit (via serial port 0). Each time MIDI data from one unit flows through another unit, its channel number is bumped up by one. This guarantees that data from each unit will have its own unique channel number at the final output. The last unit's output is connected using the standard 5 pin, DIN MIDI out configuration: connect pin 5 in series with a 220 ohm resistor to Tx, pin 4 in series with a 220 ohm resistor to +5V, and finally, connect pin 2 to ground.
The program code may be found on my website:
https://sites.google.com/site/casavantopus400/
Disclaimer: Although the scanners appear to work correctly on my test bench, that's no guarantee that everything will work in a full scale setup. If you find bugs, or have suggestions for improvements, please post a reply.
John
To me, parallel wiring has always seemed attractive because of its conceptual simplicity; configuring and wiring diode-isolated matrixes, I find a nuisance. Here, however, one keyswitch is wired to one input pin, no diodes required. The other sides of the switches share a common ground. Analog input can be as simple as connecting the wiper of a 20k (+/-) potentiometer, connected across ground and 5V, to the analog input pin.
Two procedures are included for converting expression pedal voltages in, to controller commands out. Method 1, features an array of numbers that specifies which controller values are to be output for each input voltage in 0.31V increments. This array can be edited by the user to yield any response curve desired.
Method 2 , which I have commented out, provides a simple linear response but requires that you fit a straight line to two points based on the voltage with the swell pedal closed and the swell pedal open. This works well if the voltage change occupies only a small segment of the 0 to 5V range. Try this if you still remember your y = mx + b.
Daisy chaining the units requires that all the Arduinos be connected to a common ground. Then it is just a matter of connecting Transmit Out (Tx) of one unit to Receive In (Rx) of the next unit (via serial port 0). Each time MIDI data from one unit flows through another unit, its channel number is bumped up by one. This guarantees that data from each unit will have its own unique channel number at the final output. The last unit's output is connected using the standard 5 pin, DIN MIDI out configuration: connect pin 5 in series with a 220 ohm resistor to Tx, pin 4 in series with a 220 ohm resistor to +5V, and finally, connect pin 2 to ground.
The program code may be found on my website:
https://sites.google.com/site/casavantopus400/
Disclaimer: Although the scanners appear to work correctly on my test bench, that's no guarantee that everything will work in a full scale setup. If you find bugs, or have suggestions for improvements, please post a reply.
John