I'm trying to build a circuit for controlling the speed of a fan from an ESP8266 MCU. I have a PN2222 transistor with the base connected through a 1K resistor to a digital out of the MCU. The voltage at the digital out is +3.3V when it's high and I verified that I can successfully set it high and low on the MCU reading it with a DMM. So that part seems to be working.
The power supply for the fan that is being switched by the transistor reads ~18V unloaded using a DMM. However when I read the voltage of the emitter of the transistor using a DMM it reads 8V no matter whether the base is high or low.
simulate this circuit – Schematic created using CircuitLab
I was expecting it to read 18V when the base of the transistor was high and 0V when it was low.
Clearly there is something I am misunderstanding here with my first foray into transistors being very new to electronics in general.