Switching 9V using a NPN transistor and an Arduino
What you're doing is "high-side switching". The voltage across the base and ground is much lower than the voltage across collector and ground, so that's what you're switching, minus the drop across the transistor. Since the voltage drop across base and emitter (VBE) is typically 0.6 at saturation, you're seeing the voltage from the Arduino (approximately 5V) minus this drop.

Since you're using a N-type device, you want to perform "low-side switching". The emitter is tied to ground, and the voltage is measured between the high supply and the collector.







simulate this circuit &ndash; Schematic created using CircuitLab

R1 should be sized so that enough current is allowed through to saturate the transistor without allowing VBE to cause the supply voltage to sag too much.

If you still want to perform high-side switching of a higher voltage then you should switch to a P-type device instead and put a N-type device in front of it to switch it.







simulate this circuit