DEMO: Single Pin Sigma Delta ADC Driver v1
Beau Schwabe
Posts: 6,566
Name basically says it all.
This is a single pin Sigma Delta ADC. The Drive pin and Feedback pin functions have been combined into a single pin.
The code is very simple, you set the pin that you want to use, the number of Samples (or resolution), and the address of the variable that you want to update.
enjoy!
http://obex.parallax.com/object/697
This is a single pin Sigma Delta ADC. The Drive pin and Feedback pin functions have been combined into a single pin.
The code is very simple, you set the pin that you want to use, the number of Samples (or resolution), and the address of the variable that you want to update.
'Start(ADCpin,ADCsamples,VariableAddress) Start(0,8191,@ADC_Sample)
enjoy!
http://obex.parallax.com/object/697
Comments
Thanks Beau
With only one pin connected, is the circuit more tolerant of the length of the runs/traces? With A and B
timers, do you get two usable A/D channels per cog? Thanks!
Good Job Beau!
I wrote a quick program using this circuit in a four-channel ADC and noticed a problem with interference between channels, where the readings can change by +/-200 depending on the inputs to other channels.
Increasing the resistor values to 10K and 15K reduces the effect somewhat, but nothing I did could eliminate it. Here's what I found using variable power supplies on channels 1 - 3 and a battery with voltage divider on 4:
ADC 1-pin sigma_delta 4x parent - Archive.zip
WOW, thanks for doing that... I wonder if it's just parasitic capacitor cross talk. What if you went every other pin, and/or instead of changing the resistors, you changed the capacitor instead. In practice, I found that using different capacitor values was very forgiving (I tested up to 10uF), and would in fact affect the effects of external noise. For this type of ADC, the capacitor doesn't play as much of a role in RCTIME as it does just maintaining the voltage level at the I/O threshold. Using a 0.047uF might be too small when it comes to "sharing" some capacitance with an adjacent neighbor.
that 10k resistor on the right is actually connected?
That 10K resistor is depicting a potentiometer, with the wiper connected to the analog input of the ADC circuit.
Looking at your code is the source of the problem. You can have multiple ADC inputs, but each input needs to be in it's own loop and polled one at a time. The ratio of the resistors used actually is a reflection of this loop. When you combine multiple channels into the same loop, the timing get's thrown off and messes the channel value up. .... I'll look at your code later tonight and see If I can re-work it so that the individual loops are preserved and there might be a way to interlace the channels, but I need to get my head around it and working in a non-interlaced form first.
Note: The ideal resistor ratio should be 1:2.5 ... however the 1k and 2.2k are close enough and provide a little padding on either end when using a potentiometer to ensure the full range. The ratio is derived by the number of instructions required in the loop, and how much of the instruction is configured as an input versus how much of the instruction is configured as an output. In this case 2 instructions are outputs, and 5 instructions are inputs. So literally 2:5 or ... 1:2.5
To be fair, I wonder if there is a similar discrepancy from pin to pin with the 2-pin Sigma Delta. I looked over your code, and there is a reason why, based on the code ratio mentioned earlier, and the resistors used, why there is a certain place in your code to make the ADC pin an output that I see that you have made note of in your program. However, be careful that the resistors that you use are not too large in relation to the resistance of the pot. What seems like a linear response actually 'bulge" in the middle, but on either extreme it should converge. When the resistors are larger in relation to the potentiometer, the 'bulging' becomes more exaggerated. I suppose alternatively you could place two 2.2k resistors on each outer leg of the potentiometer... assuming that the 1k is still the lower ratio resistor. That would make the response truly linear, but may not be conducive to many applications.
The reason I wonder if there is a similar pin to pin discrepancy, is that I see similar differences using the exact same circuit in singular mode moving manually from pin to pin. So regardless of adjacent pins, there is enough I/O threshold difference from pin to pin that shows up and can be detected with this ADC.
Crosstalk did look to be the weakness of this circuit, when I glanced at it. Good to see someone measured that.
It is not just parasitic C, but common mode (shared) impedance in the die metal, and direct drive into a Cap, is going to create some serious current spikes.
200 in 4096 is around 5% of cross talk, which is significant.
I would expect this effect could be lowered, by choosing pins either side of Vcc/Gnd, (and QFN over DIP) and maybe also a small series resistor added to the Cap.
"...and direct drive into a Cap" ... It's not direct drive, there is a series 1k resistor to the cap from the I/O pin.
The variance also occurs if you use a singular version rather than the Quad, and manually move it from one pin to the next using the same circuit, just changing the pin. This is a result of the I/O threshold being slightly different from pin to pin. I am willing to bet that the "Drive/Feedback" ADC that we are all familiar with that uses 2 pins will show similar behavior.
If I'm understanding the problem right, it's to do with the total power dissipation of the Prop and every picowatt making a difference?
And there absolutely are differences between prop pins, just moving the ADC between pins causes large changes in the readings.
Chris
Actually the loop time for four ADCs in series is only about 11.5ms compared to about 6 ms for the parallel routine.
Just out of curiosity, why'd you go with 13-bit sampling?
http://forums.parallax.com/showthread.php/149216-DEMO-IR-Heartbeat-detector
You might want to expand on that ? Above, you mentioned one ADC reading changed, merely as another channels voltage varied ?
( ie classic cross talk, which is caused by unwanted couplings between channels).
That can include charge injection, or shared impedance, or timing jitter.
What package are you testing ?
Thanks, Chris.
I was curious to see what the threshold on each channel actually was. At the risk of getting slightly off topic, I connected the output of an adjustable power supply through a current limiter to each pin--one at a time--adjusted the voltage until the pin was toggling steadily, and noted the voltage on a Fluke87 connected at the pin. And here's the code I used while adjusting the power supply until the serial terminal showed roughly 500: Chris
Are these unused pins turned as output?, 29 pins left floating can not be good.
Or supply ALL the pins with the same adjustable voltage and sample all the pins.
And show value as binary to visually show when some pins still register lows while others are high.
"and nothing connected to any pin Are these unused pins turned as output?, 29 pins left floating can not be good." - This is ok with a Sigma Delta. A pin left "floating" will seek the threshold voltage of the I/O. In this respect, it is no different than the feedback pin on a conventional Sigma Delta ADC requiring both a Drive and Feedback pin.
"Or supply ALL the pins with the same adjustable voltage and sample all the pins. And show value as binary to visually show when some pins still register lows while others are high." - That would work, but not with the current program due to the nature of the Sigma Delta conversion. As soon as the first pin detects the threshold, the he wins priority over all of the other pins rendering their readings invalid. You could do that experiment by simply looking at the entire INA register and displaying that on a terminal as a 32 bit binary as you slowly raise or lower the voltage attached to ALL of the pins your testing.
Plus if you are doing a ADC test on one pin, probably would be best to turn the other pins to output
as having all these pins floating can create noise on the power rail.
If the power rail is not clean how are going to judge an external voltage?
It could be Interesting to check how that 500 target, varies as other pins (adjacent, and more isolated) vary thru their thresholds.
The mask would need to target a single pin only.
I tried [Single Pin Sigma Delta ADC Driver].
This can convert analog from 120mv to 2.3V.
Not less than 120mv and more than 2.3V.
Why [Single Pin Sigma Delta ADC Driver] cannot convert analog from 0V to 3.3V?
I think because the Pin changes direction, the Time-Domain slicing comes into the picture too.
Unlike a conventional SDM D-FF where the FF.Q drives the feedback 100% of the time, this design time-shares between the charge balancing(output), with checking the pin level(input).