# Using transistors as switches.. problems

Hi. I am trying to control the switches on a old musical keyboard. I had planned to put a npn transistor across the switch and use the arduino to control the base through a resistor. It didn't work. The keyboard is powered by a split rail 15v supply. One side of the switch measures -15 volts the other ground i think. My electronics knowledge isnt that great, i had a go at trying to work out if i could use a pnp. but i think the miss match between the 0 to -15 and wanting to use 5v from my arduino mega to control the base is beyond what i can work out my self or with the internet. Any idea? basically how do i switch the with some kind of transistor aragment or something. Cheers

The Arduino deals in voltages between 0 and +5V, the circuit you are trying to switch is -15V to 0V, so there is no overlap.

This won't work with a transistor unless perhaps you have Arduino gnd connected to -15V (in other words different ground references for the Arduino and keyboard).

But we don't know enough yet - you have measured the voltage at each side of the switch when its open, we need also to know the voltage its contacts are at when closed. If that voltage is -15V then an NPN transistor and Arduino ground at -15V would work. If 0V then a PNP transistor with Arduino +5V at keyboard ground would work.

You also need to measure the current between the switch contacts - hopefully this is nice and small (10mA or so) in which case using an opto-isolator would be both feasible and most sensible.

In general having two units with different ground voltages can lead to problems and the opto-isolator route avoids that completely - we also don't really need to know anything about the circuit being switched other than its polarity and how much current.

Thanks MarkT that's good advice the opto isolators are the way to go.

The switch actually measures -11 volt when open and -9 when closed. A npn and a opto isolator?

This could be a reasonable application for analog switch IC’s… like the DG211. The DG211 will provide an analog switch closure between 2 points based on a TTL level control input. The device is rated to work with up to +18/-18V power source (which you will likely find in your instrument to be controlled). With a common GND and a TTL level control signal from the Arduino, you can create switch closures that tolerate your voltages recorded.

4 switches to a package. http://datasheets.maximintegrated.com/en/ds/DG201A-DG211.pdf

Prices seem to vary between \$1 to \$5 with the DIP package being the most expensive.

EVP: Hi. I am trying to control the switches on a old musical keyboard. I had planned to put a npn transistor across the switch and use the arduino to control the base through a resistor. It didn't work. The keyboard is powered by a split rail 15v supply. One side of the switch measures -15 volts the other ground i think. My electronics knowledge isnt that great, i had a go at trying to work out if i could use a pnp. but i think the miss match between the 0 to -15 and wanting to use 5v from my arduino mega to control the base is beyond what i can work out my self or with the internet. Any idea? basically how do i switch the with some kind of transistor aragment or something. Cheers

Often then I needed to interface logic level circuits to control external circuits of unknown or awkward voltages at unknown current flows, I have favored using simple reed relays so that there is complete isolation between the logic circuits and the circuit being controlled. Many small +5vdc reed relays can be powered directly from a arduino output pin, (but do install a reversed diode across the relay's coil terminals). Here is an example of a SIP packaged +5 vdc relay that allows for pretty dense construction if needed, only draws around 25 ma of output pin current. http://www.allelectronics.com/make-a-store/item/RLY-496/5-VDC-SPDT-REED-RELAY/1.html

Lefty

MarkT: The Arduino deals in voltages between 0 and +5V, the circuit you are trying to switch is -15V to 0V, so there is no overlap.

To switch between -15V and 0V controlled from the 0V to +5V signal out of the Arduino, use a PNP transistor in the common base configuration, if the current to be switched is below the 40mA rating of the Arduino.

That assumes the -15V side of the switch is supposed to go to 0V, whereas it might be that the 0V side will fall to -15V.

Also you would need an emitter resistor (which would protect the pin anyway) and would take signal up to +0.5V or so which might be an issue.

For my money I'd use an Opto... somehow the measurement from -15 V to -9V seems wrong... but If the contact is more negative than the common an NPN opto, Emitter to the contact and collector to common would work. It would "Pull up" the contact to the common. Several of the Organs I worked on in the 70's used Pmos circuitry for the tone generator controls and they did have weird switching... PNP's in the voicing controls too. Most frequent complaint was dirty switches in little used devices. The switches on the keys were self wiping and usually Very reliable as they were the norm for the Pipe Organ consoles I worked on. There with the pipe organs the worst I ever had to deal with was a major mouse infestation. I just made the keys work for the Organ Tuner... he had to fix the damage to the air plenum... All Kid skin suede. The droppings had to be cleaned up first... and a total Mess.

Bob

All interesting and useful suggestions. i like the analog switch ic’s but don’t have any i do have various transistors so i might give it another go before i but some ic’s. It’s a polyphonic analog keyboard nothing very expensive (which is good). A multivox mx-65 a bit of an obscure company that had some similarity’s and dealing with Roland in the early days. Any way here’s a picture of a section of the switches and oscillators i think. Someone mentioned organs i think this is some kind of frequency divider arrangment, it’s defiantly not a matrix of any sort. Thanks for the ideas guys

seems best to open the image in a new window

Wow, hand-laid-out PCB traces! Takes me back.