Some time ago, someone asked whether the Arduino was compatible with lighted stop switches, and I gave assurance that almost certainly the answer is yes. Giving it some thought, I realized that there is one simple solution. In a matter of minutes, I had implemented it using Jeux d'Orgues on my iPad.
I programmed one Arduino using my Parallel Scanning program and a second with my Decoder program. I wired up four momentary switches to the encoder and four LEDs to corresponding pins on the decoder. I then connected the two boards to a MIDI shield. The encoder was connected to the Tx (transmit) pin and the decoder to the Rx (receive) pin. For this, the shield cannot sit on one of the Arduinos, so make sure it receives power and ground from one Arduino and that the Arduinos share a common ground.
I programmed four of the stops on the iPad organ to respond to the switches and set the stops to toggle mode. Next I set each stop to send out an On or Off signal as the stop toggles. And soon the lights were turning on and off as I turned the stops on or off, either through the touch screen or my external momentary switches.
The tabs on lighted stop rails usually have one momentary switch for On and another for Off. Even lighted drawknobs work this way with a pull being On and a push, Off. To operate in the toggle mode just described, the On and Off switches can be wired in parallel so that pressing either one causes the stop to toggle. Of course it is possible to code the scanner to respond properly to the On and Off buttons (so called "Normal" mode) thereby simulating a stop that physically toggles. Let me know if you would like to see the code for this and I'll see what I can do.
One problem arose, however, the lights did not properly respond to the general cancel button. Although the stops nicely retired, only one of the lights turned off. Any thoughts on why this might be would be welcome. Again, it is possible to have the decoder detect the cancel button and clear all the lights, but that strikes me as a wart.
About the lights: If the lights are incandescent, the most elegant solution is to replace them with LEDs in series with about 300 ohms. Although each pin can drive 40 mA, if many pins are on simultaneously, make sure the total current drawn does not exceed 200 mA. So if each LED draws 5 mA, say, then, at most, 40 can be on simultaneously.
If the lights are incandescent and running on 12 V DC, some kind of driver is needed. See my discussion on MOS FET drivers in my Decoder post, even though these units would be gross overkill. Check to see if the drivers already in the organ can be adapted.
John
I programmed one Arduino using my Parallel Scanning program and a second with my Decoder program. I wired up four momentary switches to the encoder and four LEDs to corresponding pins on the decoder. I then connected the two boards to a MIDI shield. The encoder was connected to the Tx (transmit) pin and the decoder to the Rx (receive) pin. For this, the shield cannot sit on one of the Arduinos, so make sure it receives power and ground from one Arduino and that the Arduinos share a common ground.
I programmed four of the stops on the iPad organ to respond to the switches and set the stops to toggle mode. Next I set each stop to send out an On or Off signal as the stop toggles. And soon the lights were turning on and off as I turned the stops on or off, either through the touch screen or my external momentary switches.
The tabs on lighted stop rails usually have one momentary switch for On and another for Off. Even lighted drawknobs work this way with a pull being On and a push, Off. To operate in the toggle mode just described, the On and Off switches can be wired in parallel so that pressing either one causes the stop to toggle. Of course it is possible to code the scanner to respond properly to the On and Off buttons (so called "Normal" mode) thereby simulating a stop that physically toggles. Let me know if you would like to see the code for this and I'll see what I can do.
One problem arose, however, the lights did not properly respond to the general cancel button. Although the stops nicely retired, only one of the lights turned off. Any thoughts on why this might be would be welcome. Again, it is possible to have the decoder detect the cancel button and clear all the lights, but that strikes me as a wart.
About the lights: If the lights are incandescent, the most elegant solution is to replace them with LEDs in series with about 300 ohms. Although each pin can drive 40 mA, if many pins are on simultaneously, make sure the total current drawn does not exceed 200 mA. So if each LED draws 5 mA, say, then, at most, 40 can be on simultaneously.
If the lights are incandescent and running on 12 V DC, some kind of driver is needed. See my discussion on MOS FET drivers in my Decoder post, even though these units would be gross overkill. Check to see if the drivers already in the organ can be adapted.
John