You don't want the resistor in the emitter circuit, with it there the voltage drop across it will depend on the current through it and that will be dependent on the transistor parameters such as beta, \$V_{BE}\$ and \$V_{CE_{SAT}}\$.
Ground the emitter and put the bottom divider resistor in the collector circuit like this:

simulate this circuit – Schematic created using CircuitLab
Now the transistor acts like a switch and you can calculate the resistance needed.
You have a 5k resistor in the top of the divider and you need 4.5 V drop across it if you want 0.5 V at the output, so that works out to:
$$\frac{4.5 V}{5000\Omega} = 900 \mu A$$
Now you know the current you need in the divider, you can find the other resistor, but you'll need to know \$V_{CE_{SAT}}\$, the collector-emitter saturation voltage. For a 2N3904 that might be something like 30 mV, so you take that into consideration and the voltage across the divider becomes
$$ 5V-30mV=4.97V$$
and the total resistance for 900\$\mu\$A would be
$$\frac{4.97}{900\mu A}=5522\Omega$$
So subtract the existing 5k and you need a resistor of 522\$\Omega\$
There will be a bit of error, depending on the transistor parameters but it should be close, and you'll also have to take into account the load on the output of your divider, if it's not a high impedance load you need to figure out the resistance that in parallel with the load will get you approximately 522\$\Omega\$ (or whatever the resistance works out to with the \$V_{CE_{SAT}}\$ your transistor has).
As someone else pointed out, at 900\$\mu A\$ you probably don't need a transistor, you can use an MCU output directly. In that case you calculate the resistance the same way but use the MCU output low voltage instead of \$V_{CE_{SAT}}\$.