# Differential Square Current generator LTspice

I am trying to model a square wave differential current generator in LTSpice for MAX30001 IC, refer page 6 for the specs.

Specifications: Differential Square wave, Amplitude : 8 to 96 uApk and Frequency : 0.125 to 131.072 KHz. Also, there is DRVP/N Compliance Voltage spec.

I know the way to model Single ended square wave generator in the tool, But, not sure how to proceed ahead to model this particular Current generator, with various specs to meet! Any suggestions/help would be really helpful.

P.S. : Basically, I am trying to model the whole Bio-impedance AFE for the IC.

--------------EDIT-----------------------

The Measurement setup is as below The Electrode impedances be of the order of Kilo ohms and body impedance(Zbody) be of order of ohms.

simulate this circuit – Schematic created using CircuitLab

• Do you mean you want to model the whole IC? That's quite a task ahead of you, respect! You could try to use two current sources with those specs. Jun 25, 2021 at 13:19
• Basically, the behavioral model for Bio-impedance AFE :) Jun 25, 2021 at 13:32
• Do you mean Impedance Spectogram, Fourier Analysis of odd harmonics? Gain and phase response? CMRR using RLD output? – The specs are 1 GΩ input impedance, CMRR > 100 dB with 300 Hz LPF, DC a offset calibration? BTW 96uA into what impedance of electrodes+ target.Define your load , you can probably use a differential voltage source with a matched pair of high R resistors. – Integrated 300 Hz anti-aliasing low pass filter… why 131kHz. Jun 25, 2021 at 15:39
• Main intention is to have the Current driver modelled with the given spec. The sensing part is not of major concern right now. For the modelling, The signal flow be DRVP--Electrode(1K)--100Ohm(body impedance)---Electrode(1K)--DRVN. Also, across the 100Ohm additional electrodes of 1K going to let's say Volt meter. I am not sure how to exactly model the differential current source for the spec in Spice tool.. Jun 25, 2021 at 15:49

What you need is a device that has a variable frequency based on the command input, and a variable amplitude output also based on a command input. This is one way to do it.

There already is a built-in AM/FM modulator in [SpecialFunctions]/modulate(2) which can be used for both of these, but you need the output to be pulsed, so a simple [Digital]/buf can be used.

The modulator require setting the mark and space parameters, while the buffer only needs ref=0, since the output of the modulator is a sine. To handle the gain use either two behavioural sources with their expressions involving multiplying the outputs of the buffer with the controlling amplitude command, or [SpecialFunctions]/mota. The latter might prove more useful.

A1 is the modulator converting V(freq) to frequency in a 1:1 ratio, A5 converts sine to unity amplitude, complementary pulses, A3 and A4 multiply V(p) and V(q) by V(amp). The outputs can be either common or differential. I used iout because that gives a tanh() limiting, which should be more convergent-friendly than very sharp spikes. Alternately, replace iout=1 with linear rout=1 and use either tau=<...> in A5, or Cout=<...> in the ota. The readings are in mV because the load is 1k.

You could simplify this with to behavioural sources, only:

I=sgn( [+/-] sin(2*pi*idt(V(freq))))*V(amp)

But if you're building this as a model then try to avoid too complicated expressions for the behavioural source(s), since they are a special kind of element: simply because you only see one element and one node in there it doesn't necessarily mean that the schematic will run faster. In particular, sgn() here is a discontinuous function and may bite you. May not, but the temptation will be there.

• Not lastly, it's LT$\color{red}{\mathrm{s}}$pice. Jun 25, 2021 at 16:41
• @a concerned citizen : indeed it's LTspice. Also, really appreciate you taking time out and suggesting the Driver part model. Please refer the updated question with the measurement setup. How to model it in this context ? I would finally want to measure electrode impedance variation sensitivity and being slightly greedy! how would you model the sensing part? to get the demodulated wave? Jun 25, 2021 at 17:40
• @seeker The same way you would do it in real life, and that would depend on the type of the modulation. I don't know what you're using so I can't recommend anything, but I'm sure you'll find plenty of examples for any type. When you're using the ping operator, @, use @<TAB> to select between the available names, and there should not be any spaces. In this case I was notified because you replied directly under my answer. Jun 25, 2021 at 20:33
• Thanks, I am clear on the driver and moving forward to the BIP/N. I gathered from the datasheet that removal of the harmonics is partially achieved with the analog HPF at the input of the BIP/N channel, Following the HPF, an InAmp with a programmable power mode amplifies the input voltage. Next, the signal is demodulated to shift the signal of interest to DC. After that, a 2nd-order AAF with fc = 600 Hz is applied. then, a PGA amplifies this signal. After amplification, the signal is digitized by ADC, sampling at ~32 kHz. Would appreciate any suggestions for modelling it in LTspice ? Thanks. Jun 26, 2021 at 18:47
• @seeker It's a 20 bit quantizer, which means you'll be fighting a dynamic range of uV:V, and that's problematic for SPICE, in general. And if the levels are mV or lower, you'd be dealing with nV or lower... You could force some *tol settings, but that would mean a high penalty in simulation time for little added benefit. Therefore, simply skip the $\Sigma\Delta$ part. IMHO the best advice is to not model the real device, but its behaviour. Unless you really need the fine details, in which case you'll almost never come close to the real part since everything in SPICE is an approximation. Jun 26, 2021 at 20:02