Controlling a MOSFET with a microcontroller
Correct: The voltage divider will not be necessary with the particular p-channel MOSFET, since its gate-source voltage is rated at +/-25 volts.

The NPN transistor is necessary, because you would not want to expose the Arduino GPIO to 18 volts.

What is even more necessary is a base resistor on the BJT. This is useful to ensure that the base-emitter current does not exceed the recommended operating current of the GPIO pin - 25&nbsp;mA is my personal preference, and 40&nbsp;mA is the datasheet maximum rating for the ATmega328. Other microcontrollers used in various Arduino models have different ratings.

Assuming the Arduino being used is a 5 volt model, the base resistor should be sized for 25&nbsp;mA maximum, thus: R = (5 - 0.7) / 0.025 = 172 ohms, so a 180 ohm resistor between GPIO pin and Q1's base would serve well enough.

One would also want to ensure that the collector current of Q1 does not exceed 200&nbsp;mA, the rated maximum for the 2N3904. Even with a 100&nbsp;mA current across R1, the resistor's current dissipation when Q1 is conducting will be an unhealthy 1.8&nbsp;watts. Hence limiting the collector current to around 10&nbsp;mA would be best: R1=1.8k, 180 mW power across resistor.