Slow and Simple ADC Object
william chan
Posts: 1,326
Sorry Andy,
I tried using the rayman's DualADC object for the whole day but couldn't get it to stabilize.
So I wrote my first Propeller Object using SPIN since I don't know propeller assembly. ( See attached file)
Surprisingly, this object just works, and is stable, but there are still some rough edges to be ironed out.
1. Does anyone know how many samples per second can this ADC do? ( at 10bits )
2. Can I upload this object to OBEX?
3. When testing with a 5K potentiometer, the max value is 1023 but the min value is about 130. ( even when the signal is zero volts )
Is this to do with the un-symmetrical drain and source of the Propeller IO pins?
Thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
Post Edited (william chan) : 3/11/2008 12:19:37 PM GMT
I tried using the rayman's DualADC object for the whole day but couldn't get it to stabilize.
So I wrote my first Propeller Object using SPIN since I don't know propeller assembly. ( See attached file)
Surprisingly, this object just works, and is stable, but there are still some rough edges to be ironed out.
1. Does anyone know how many samples per second can this ADC do? ( at 10bits )
2. Can I upload this object to OBEX?
3. When testing with a 5K potentiometer, the max value is 1023 but the min value is about 130. ( even when the signal is zero volts )
Is this to do with the un-symmetrical drain and source of the Propeller IO pins?
Thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
Post Edited (william chan) : 3/11/2008 12:19:37 PM GMT
spin
939B
Comments
congratulations to your code first. I myself have made some experiments with the sigma-delta system too, so I want to answer.
1. Perhaps you want to include a waitcnt command into your code. Because the time after a switch to low should be exactly the same as after a switch to high to get better linearity.
2. Perhaps you are interested to experiment with a minimal addition of one single resistor to get significantly less noise. Look at: http://forums.parallax.com/forums/default.aspx?f=25&m=248578
If yes, I would be interested in your results.
You can find more threads about adc in the forum.
Good experiments, Christof
In my opinion, using higher resistor values and lower capacitive values ( up to the limit ) will reduce the noise level.
The additional 33K resistor you mentioned may reduce noise a bit to other parts of the circuit but may reduce stability of the input reading.
I think the 6.8uF cap is too large and may cause difficulties in sampling moving signals. ( AC ? )
Also electrolytics may not be recommended for this type of circuits.
I am also interested in an unsymmetrical setup where the feedback resistor is of higher resistance than the signal resistor.
This may give the effect of signal amplfication.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
@william - This link will direct you to the Counters Lab. I strongly recomend the LAB as it's invaluable to the possibilities of using the counters as opposed to using "dira[noparse][[/noparse]x] & outa[noparse][[/noparse]x]" statements which are SPIN but very slow in execution. You can create a much faster A/D sigma-delta converter by using the two specialized counters that are in each COG. By utilizng the counters alone in spin you could increase the speed of the prog seven fold, EASILY! I think it was Paul who first had his Sigma-Delta ADC running in assembly somewhere around 20MHz conversion rate, i'm wrong, but i know it was in the "ten-thousands" MHz range.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
E3 = Thought
http://folding.stanford.edu/·- Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.
The http link does not work.....
Can you post an example of using the counters in spin?
Thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
http://forums.parallax.com/showthread.php?p=617192
go down to Counter Modules and Circuit Applications
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Aka: CosmicBob
Therefore please read 6.8nF.
The resistor has the effect of holding the input out of the nondefined region between high and low. Within this region, the counter input seems to count strange things "....but couldn't get it to stabilize". A small capacitor and a low feedback resistor will have such effects too, but then the·integration of current, which is done by the resistors and the capacitor will be less accurate. I myself found, that the small changement of adding a single resistor had rather great effect, but of course it was only a suggestion after I read, that you want to be faster than your spin code. With the resistor you could try the assembler version again. But of course it's up to you.
The sigma delta system works in such way, that sum of the charge flowing into the capacitor by the input resistor and by the feedback resistor is always zero. The charge flowing trough the feedback resistor is time*Voltage/R. It therefore has advantages·to have an exactly known time for both low and high voltages at the feedback pin.
Christof