TLDR; I have a digital input signal of unknown voltage. I do have a known reference voltage available. I would like to combine the two in a way to get a digital signal with the same content as my input, but with the high/low potentials determined by my reference voltage. Basically I want a relay but without the clicky stuff...
Hi!
I decided I wanted to learn more about (analog) electronics and decided an R2R DAC with an INA125 for the ladder input voltage and amplification was as good a place to start as any. The actual R2R part, amplification and low pass filter were drawn up pretty quickly, but I didn't manage to figure out how to deal with the inputs. If I want the output range of the DAC to be independent of the digital high voltage I need to somehow also control the voltages that go into the ladder, right? I thought """ANDing""" together the digital signal and my Vref would be trivial (and it kind of is with relays), but after two days of banging my head against a wall I'm ready to ask for help.
RequirementsInputs: GND, 1bit digital input, Vref
Output: if digital input is high Vref, else 0V
Other:
- low current drawn from Vref source (if necessary I could always an opamp and circumvent this
- fast-ish would like to do at least 20KHz switching, ideally 100KHz
- no "cross-bit" contamination (ie preserve linearity of the R2R stage)
- voltage of high input should not impact output
What I triedBeing a physicist not an electrical engineer, a FET looked a lot like a relay to me (from far away that is), so that was my first idea. (The 4 5V AC sources at the top are configured to put out square waves at 1,2,4,8 Hz to simulate every possible input in a ramp shape. After testing these will probably become a shift register.)
It looked sensible, but I decided to simulate it with SPICE in Fusion. It told me that adding FETs like this (also tried P-type) would completely destroy my linearity.
As a sanity check I ran the same simulation without the FETs and that had a linear output. The same issue also arose with transistors.
One thing that I thought was very weird: the non-linear contribution seems to depend more on how many bits are active than the output voltage (though that seems to contribute, too). A working hypothesis was that maybe when the output voltage gets close to the input voltage the potential drop between gate and source becomes too low, but dropping Vref or increasing the digital input voltage doesn't help. And that wouldn't have fit the pattern anyway.
I also thought it might be an issue with the source to ground resistance being so different between the FETs, but that also didn't fit the pattern, and trying to alleviate the issue with diodes and resistors also didn't work.
Then I tried connecting the low potential of the digital inputs to the output of the R2R ladder. That makes it better, but it doesn't solve the issue completely and it's also not really doable with the physical circuit as I don't want my arduinos ground to become 5V relative to earth.
Ready to give up on individual FETs for a moment, I considered using an LS compatible bus transceiver, inverter or some other simple logic chip and just driving that with Vref as VCC. In simulation that obviously works, but there is also magical DTOAB and ATODB involved. I am concerned about that solution since
A: What is a logic chip other than fancy FETs and transistors, so who tells me the issue isn't going to occur there? And
B: I don't have the equipment to measure it yet, but I doubt stability and accuracy of output voltage are a huge design concern for logic ICs.
Since what I want is basically an amplifier deep in the saturation regime I also read a bit about FET amps and decided to try a more normal FET amp layout
The issue persisted.
What I tried to findAfter some time I decided to look around for other peoples' solutions. But I don't know what the thing I'm trying to do is called, so all I could think of is looking at circuit diagrams of other DACs. Issue is R2R seems not the most popular one for actual builds and most of the circuits people draw online just skip this step. Or they do it like TI and draw switches... Also ended up watching two community college lectures on R2R DACs that were on YT, but they also didn't deal with that.
Where I'm at nowGiven all that, I think I need something that behaves even more like a relay. If I don't find a good solution, I'll probably end up using relays themselves. But this feels like the sort of problem with a well known solution... If you happen to know one or understand the weird non-linearity of the spice output, I'm very willing to learn
Level of knowledgeI know very little about AC stuff, circuits that can't be represented well using complex voltages and impedances are black magic to me, so if your answer involves anything regarding the high frequency content of a square wave, please be gentle. I don't have much experience with FETs, I mostly treated them as slightly weird transistors that need a charged capacitor instead of a current. But I'm pretty comfortable with some maths in my learning, especially when it's (complex valued) Kirchhoff's or Ohm's laws in disguise
I strongly suspect however that the answer is going to be something really stupid....
Thanks for reading this overly long blurb of my
! Looking forward to your answers