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.

schematic

simulate this circuit – 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.

schematic

simulate this circuit


The circuit you describe is an emitter follower - the emitter voltage follows the base voltage and is always about 0.7 volts negative of the base. The transistor doesn't care where you think "ground" is, its operation only depends on the voltages between its pins.

If you ground the emitter, and put your load between the collector and the positive supply, you will be able to get very close to the supply voltage across the load when the Arduino output is high. You should have a resistor of 1K or so between the Arduino output pin and the transitor base, to limit base current and loading of the Arduino output pin.