5595

I use from the HC595 shift-register the first 5 bits as DAC and the three other for changing Uref from 2V to 800mV, swifting between n-/ p-devices and changing from current to voltage-mode ( I-base / U-gate) . The output is isolated from the controller (with cheap opto-coupler PC817) and from power with DC / DC converter. . The polarity of the output can be changed with Opto-relais like Omron G3VM61.

For testing I used the rapid developmment board ( look at: https://www.elektormagazine.de/labs/rapid-development-board-for-raspberry-pico ).

I will use the current-source for a transistor curve-tracer.
With this device it would be easy to test devices with different polarity like npn/pnp transistor or 
n/p J-Fet or n/p Mos-Fet.

I have used only cheap parts, only the DC/DC 1W converter (5V to 30V isolated) is more expensive (and if you want to change the polarity with electronic switches you nead 5 mos-relais (2-3 €) each.

Description:

5 Input-pis for Gnd, + 5V (about 120mA), Clock, Latch Data,
Isolation Power with DC/C,
Isolation logic with Opto-coupler (non inverting !, collector to + 5V).
5V-Reference ( 2k Ohm from +30V), also used +5V (HC595) and Opamp (in currentsource).
Outputs from HC595 to Mosfets (inverters) for switching the resistors from DAC to Gnd (bit 0 to 4).
bit 5 to 7 for swiching Vref (currentsource) from 2V to 0.8V, switching n/p device and current to voltage.

The 4 Mos-Relais work like a dual-swich.   

The currents go from 0µA, 50µA, 100µA ... to  1.55 mA (reference = 2.0V )
                        or from 0µA,  20µA,   40µA ... to  0,62 mA (reference = 0.8V )
The voltages for J-/Mos-Fets similar, depends from resistor at switch current to source.