Well, i got an preliminary version here. I have to find a way to improve the performance of the current source.
R4 will be a potentiometer to calibrate the voltage set current to 3mA.
R7 will be a 10K potentiometer to set the output voltage.
R12 will be the current set potentiometer. But i have not calculated it yet.
Diode D4 blocks when the current control output is positive.
I need the -5Voltage after all in this first version to get the output to zero when the current control circuit becomes effective.
But i have one more trick up my sleeve for that.
If i exchange the inverting input and the non inverting input of the current control opamp, i might get it to work by using a mosfet with an open drain.
I then no longer need a -5V supply.
The transistors are not the ones i will be using but this is a first attempt.
The relay circuit i have not added yet.
LTspice is wonderful for trying things out. And later on by making an actual prototype, the wrinkles can be ironed out.
That's looking pretty good, for a first shot at it.
Ignoring the fact that you are going to alter/improve it anyway. I hope you don't mind if I say a few quick things about it, given the way it is at the moment.
The voltage control potentiometer (R7), can be slightly noisy and intermittent, for a tiny fraction of a second. Usually much less so, if it is a quality, multi-turn one. But even so.
Because you have a wiper, e.g. Metal, in contact with the resistive material. As it moves along it, it can briefly disconnect.
E.g. Think of worn out volume controls on some equipment, where it makes loud pops and noises, as you move the volume control up and down.
This brief (e.g. 3.5 millisecond) disconnection (which if you are lucky does not occur. But it can and might), would cause the output voltage to rise to maximum (ignoring the relay centre tap selector) voltage.
If there were brief 30V (approx), voltage spikes, for a few milliseconds, when it is set to say, +5V for a PIC project. It could easily break your external devices.
In the circuit you have got now, putting in a capacitor to minimise that effect, would mess up the constant current circuitry. But there are ways of doing it, which I will leave you to consider.
Old single turn, carbon potentiometers, were notoriously bad at doing this. So I stand corrected, if modern, quality ones, don't need this capacitor and/or other solutions.
I think expensive equipment in general (VERY top end), may use optical turn detection devices (going WAY over the sophistication of your project, and WAY too expensive/complicated). Which largely eliminates that problem. Since a microcontroller, simply watches the up/down pulses (or whatever), from the optical turn device.
There are other ways of doing it.
Q3 2N5550, may be in danger of having its Emitter/Base junction, damaged by exceeding the 6V maximum, "reverse" voltage, applied to it.
E.g. Imagine the output is peacefully at exactly 15 Volts.
There would be 15 Volts, almost directly connected to Q3's Emitter. So if the Op-amp U1, suddenly turned off (ok, swings towards -5V/negative rail). E.g. The output current, suddenly exceeds the set limit.
U1's output would drop to about -5 volts (rail to rail), which connects to the base (via a resistor) of Q3.
So Q3 would (briefly), be at 21 Volts between the Base and Emitter, in the "wrong" direction. As well as being more than the +6V allowable on the datasheet. It would probably rapidly, or sooner or later, damage/destroy the device.
If it was me, I would probably put in a small signal diode, to eliminate the problem. Being careful to NOT effect other circuit functions.