How to simulate sigma-delta adc pulse train in LTspice

Thread Starter

ak52

Joined Oct 15, 2014
230
Hello Experts,

I am trying to simulate a complete current sense path of a motor phase, right from the shunt resistor to the MCU in LTspice. We are using an AMC1303 (50mv differential)(MPN:AMC1303M0520DWV) sigma-delta adc to measure the current. The pulse train coming out of the ADC is filtered to get (0 to 3.3v values) , and then it is sent to an internal ADC of an MCU.

The problem that I am facing is that the duty cycle of the pulse train is not changing with time. (Net : duty_cycle, DOUT)

But if i give DC values from I1, it works perfectly.

Digging a little further I found that .params in LTspice cannot be evaluated as a function of time.

Is there any other way to simulate the pulse train correctly?
1677472412270.png
 

ericgibbs

Joined Jan 29, 2010
18,766
hi ak,
The problem is with the Shunt Resistor?
Created an asc file for only that section
E
WARNING: Can't resolve .param dt=((vsh*771.2)+49.6667)/100
WARNING: Can't resolve .param vsh=current*shunt
Questionable use of curly braces in "b1 duty_cycle 0 v={dt}*100"
Error: yet unevaluated parameter in: "[dt]"
Questionable use of curly braces in "r1 vshunt 0 {shunt}"
Error: undefined symbol in: "[shunt]"
Questionable use of curly braces in "i1 0 vshunt sine(0 {current} 1k)"
Error: undefined symbol in: "[current]"
Circuit: * C:\Users\ericg\Desktop\Draft1.asc

Fatal Error: B1: -- Syntax Error --
Unknown symbol: dt

EG57_ 638.png
 

Thread Starter

ak52

Joined Oct 15, 2014
230
you have to set their values {current} and {shunt} before hand?
Add these parameters:
Code:
.param current=-100
.param shunt=500u
 
Last edited:

Thread Starter

ak52

Joined Oct 15, 2014
230
Let me explain my problem here:
Change I1 to a DC source(not sine), and step the currents, (ex use 100A, 0A,-100A)
1677492697385.png
Ideally as per the datasheet:
For 100 Amps current (which corresponds to 50mv across the shunt resistor, i.e vshunt), The duty cycle(DOUT) should be 89.06%.
For 0 Amps current (which corresponds to 0mv across the shunt resistor, i.e vshunt), The duty cycle(DOUT) should be 50%.
For -100 Amps current (which corresponds to -50mv across the shunt resistor, i.e vshunt), The duty cycle(DOUT) should be 10.94%.

Here is the relevant snippet from the ADC datasheet:
1677491875851.png

I do get the above mentioned values correctly.(Net: duty_cycle)
1677493106856.png
The problem comes when I change the current source to a time varying signal , ex sine, the duty cycles should update as per the sine wave current (ex: 89.06%-->70%-->50%-->60%-->10.94%-->50%-->89.06%...etc), but this is not happening.. :(,
I want to see DOUT varying similar to how the Pulse train is varying in Fig46 above.! and B1(duty_cycle) should look like this:
1677493280495.png

Once the above happens correctly, the filter offsets the analog value by 1.65v, so -100 to 100 Amps flowing through the shunt corresponds to 0 to 3.3v.

I hope I have explained my problem in detail, let me know if you need anymore information.
Thanks,
AK
 

Attachments

Last edited:

ericgibbs

Joined Jan 29, 2010
18,766
hi ak,
Thanks for the addition information explaining the problem, I will look it over, let you know if I get that Eureka moment.;)
E
 

crutschow

Joined Mar 14, 2008
34,280
Here is one way to generate a PWM signal similar to the delta-sigma signal with a chip model available in LTspice, if that helps:
The input signal and polarity are different, but that can be corrected with some added circuitry if needed.

1677511897423.png
 

ericgibbs

Joined Jan 29, 2010
18,766
hi ak,
Modified your circuit, it's still incomplete, very messy, suggest you use a suitable chip model as shown post #9.

Let us know how it goes.

E
 

Thread Starter

ak52

Joined Oct 15, 2014
230
Hello everyone :)
@Alec_t , I hadn't thought of that !! That's brilliant, just what I needed..
1677520971305.png
1677520996888.png

One question though,in your simulation, what opamp have you used? is it a universal opamp?, I ask this because I have used a universalopamp4, and if I increase the carrier frequency to a higher value I don't get the DOUT pulses properly,
Ideally I would like the carrier frequency to be 20 MHz as the delta sigma adc gives out the pulse train with a frequency of 20 MHz only.
If the carrier is upto 5 MHz it works fine, but if I give anything more , it starts clipping. This is an example of a 20 MHz carrier:
1677521856109.png
I tried increasing the opamp bandwidth and slew rate but if i give it too high i get a sudden spike in KV at the dout net.
1677521967499.png
 

ericgibbs

Joined Jan 29, 2010
18,766
Hi ak,
This is another option, the building blocks for your version of the original circuit.
It is not my original work , but I have modified it to suit your current measuring application.
E
EG57_ 641.png
 

Attachments

Alec_t

Joined Sep 17, 2013
14,280
One question though, in your simulation, what opamp have you used? is it a universal opamp?
It's not an op-amp. It's the differential input Schmitt 'A' device in the LTS Digital folder and is being used effectively as a comparator to trip when the shunt voltage exceeds the triangle voltage from V1. The trip point is set by parameter vt and the hysteresis by vh. It works fine with V1 providing a 20MHz triangle wave. I haven't tested to see what the upper frequency limit is. I suspect it is much higher.

Edit:
Yup. Tried 1GHz. It's perfectly happy at that.
 
Last edited:

Thread Starter

ak52

Joined Oct 15, 2014
230
Thanks, once i switched it to a differential input schmitt trigger , it worked.
Eric, will check the pwm idea .
Thanks again ,everyone
 
Top