# Digitally variable zener diode reference

I'm trying to use a digital signal (3.3V or 0V) to set a voltage reference for a comparator (4.7V and 6V.)

I've come up with the circuit below but it doesn't seem to be very precise and I can't seem to fine-tune the output for either 4.7V or 6V.

Is there any flaw in the design that wouldn't work in reality?

The comparator used is the MAX9038 if that helps.

Edit: I'm going to edit my question whenever I get some time, thanks for all the help so far already!

Edit2: Below is my full circuit. This circuit is meant to measure the current, compare against ref and limit the current going through the load. It will be used for a flyback power supply I'm designing. The power supply can be upgraded by adding a module which expands its current from 3A to 6A. Without a module this circuit has to protect above 3A, with module it has to be 6A. Since im using the MAX4172 to measure the current aswell i need it to be as precise as possible. The measured current will go into an ADC to a microcontroller. I haven't exactly looked into this yet, but i think to make it as precise as possible i need to get the output of the MAX4172 as close to the supply voltage of the ADC as possible (3.3V). at the moment the R1 resistor sets the output voltage to 3.3V at 6A. So i was thinking that the only way to make this adjustable is to change the ref voltage, is my thinking here correct? If so, what would be the easiest way to make this happen (voltage divider with a MOSFET?)

• This seems overly complicated and lacking any very obvious theory of sound operation. Could you simply use an NFET to ground (or not) the anode of the lower voltage zener? Or perhaps you should consider using two comparators (or the dual version) and apply your digital logic to selecting one of their outputs. Also, why are you using a comparator IC with its own reference but ignoring that? Nov 25 '20 at 15:41
• This almost looks like sketching, though it appears it could be done with a Vref, four resistors and a MOSFET. Please edit your question and explain what your thinking was - where you started from and how your circuit evolved. The better the quality of your question, the better the quality of the answers it will attract. Nov 25 '20 at 16:14
• If you want an adjustable voltage reference, I would think you could do something with a TL431 much more easily. Nov 25 '20 at 16:23
• Looking at the answer from @Spehro Pefhany i've gotta change the design a bit. I'm gonna work on an update. My goal is to be able to limit a current at 6A or 3A depending on a 0-3.3V signal from a microcontroller using the MAX9038 as comperator (or a similar IC). Using the reference of this IC is preferred, but i still gotta be able to adjust it. Nov 25 '20 at 16:38
• Or you keep the reference constant and you scale the voltage going to the comparator. But I'm afraid none of this whole scheme sounds right, it's fundamentally shakey... Can you do the thing you probably don' want to do: edit your question and explain what you are making and why, plenty of detail. Take the time :-) If you're just toying with the simulation, hoping to improve it, you won't get a good circuit. Nov 25 '20 at 16:43