It is better to use MOSFET.
Also, about the use of GPIO2 : beware that GPIO2 needs to be pulled-up for proper boot mode, therefore you should consider that idle state of the relay driver should be OFF when GPIO2 is HIGH, so the driver would need an inverting stage, which mean a second MOSFET.
The PN2222 isn't the best part to do a relay driver, especially if the relay coil requires a lot of current.
It is better to use MOSFET.
Thanks it is a 5V relay, is there any particular MOSFET that is best to purchase? For instance would this one be OK?
http://www.ebay.es/itm/2-Unidades-IRF32 ... SwuAVWu4Vy
Also, about the use of GPIO2 : beware that GPIO2 needs to be pulled-up for proper boot mode, therefore you should consider that idle state of the relay driver should be OFF when GPIO2 is HIGH, so the driver would need an inverting stage, which mean a second MOSFET.
Could you provide a link that goes into more detail of how to accomplish this as I am unsure how to achieve it.
I would rather use something like AO3402, or 2N7000 if you don't want surface mounted.
The circuit look like, although I would use another MOSFET instead of the 2N3903, with pulldown on its gate :
Beware that some people reported activities on GPIO2 during Reset, but I'm not convince yet, it is known that such activities are present on GPIO0, but for GPIO2, I need to verify. Maybe by adding a capacitor between both MOSFET can prevent that.