I had to add a 12V controlled output for my raspberry Pi to connect a radio frequency system to my Pi. This system just need 12V to start transmitting but it needs 12V ! The raspberry can offer 5V or 3.3V. The solution is to use a currant elevator system. The one I built is based on a Texas Instrument component TPS6734, able to deliver 120mA / 12V with a 3.3V input.
This soic-8 component have a Enable signal to activate the 12V generation, when not activated, as the output is connected to Vin through an inductance, the Vout = Vin when the enable pin is connected to the ground. This was nos acceptable for my system so I added in front of the Vin a BC848C NPN transistor to drive the Vin current. This transistor is controlled by a RPI GPIO to enable / disable 12V out.
Here is the schema of this circuit, use it at your own risk.
With this schema the output will be limited to 17mA / 12V ; the input will require about 90mA to deliver this current on output. The BC848C have a Beta coefficient around 20 which limiting the input to 100mA corresponding to what is measured (90mA) assuming different approximations.