Here is the variable high voltage dc power supply circuit, which we can customize the output voltage from 0 to 311Vdc, and it is protected the current over limit that we define at about 100 mA.
In the circuit you can see the T1 is a mains transformer with a ratio of
1:1, for security reasons , and reduces noise signal as well. Then the
mains voltage from the T1 is rectified to DCvolt with bridge diode D1-D4, We use a No. 1N4007
that withstand voltage as 1,000V at the current 1A and and this DCV is
filtered through the capacitor C1 – 220uF 400V be the big size
electrolytic types, by the voltage drop across C1 is about 311VDC.
The power MOSFET Q1 is controlled the current output, with using the resistor R3 – 500K adjust the voltage gate pin of Q1. The ZENER diode ZD1-12V is available prevent over voltage at gate pin of the Q2 if we not has it when high volt the Q2 may be damaged.
The transistor Q2-BC337 and the
shunt resistor R2 – 3.3ohm are added for as a current limiter. When the
current output is too increased, the Q2 will stop the gate pin of the Q1
immediately, which will be guard the higher current output. The degree
of R3 gets from testing in this circuit, which depending on the gain of the transistor or the hFE value, so you may need to tune the value of R2