VCO as ADC
deSilva
Posts: 2,967
Common request here in this forum have to do with ADC. In addition to complex devices to be addressed by parallel or serial (SPI or I2C) protocols, there is the low cost variation of PWM.
Voltage controlled oscillators (VCO) are a special kind of PWM generators, easy to read and terribly low cost:
Some CMOS ICs have a VERY broad range for voltage supply. As the threshold for Schmitt trigger inputs is rather proportional to that and also proportional to the frequency when used as an RC oscillator, this is a most ingenous way to simply measure higher(!) voltages (upto 15 V). For details see the link, to be varied according to your and the Propeller's needs.
www.discovercircuits.com/PDF-FILES/4584vco.pdf
Voltage controlled oscillators (VCO) are a special kind of PWM generators, easy to read and terribly low cost:
Some CMOS ICs have a VERY broad range for voltage supply. As the threshold for Schmitt trigger inputs is rather proportional to that and also proportional to the frequency when used as an RC oscillator, this is a most ingenous way to simply measure higher(!) voltages (upto 15 V). For details see the link, to be varied according to your and the Propeller's needs.
www.discovercircuits.com/PDF-FILES/4584vco.pdf
Comments
But many times people just want to measure their battery voltage or such....
As a CMOS chip configured for 1 to 10 kHz it has very little current consumption, but of course it needs more than a megohms resistor network...
Wouldn't this make it susceptible to noise? Even just thermal noise in the resistors?
Nevertheless ADC accuracy is determined by MANY CAUSES and needs a specific analysis with respect to noise, linearity, drifts, local temperature effects in every single case. For the hobyist there is rarely a true improvement in quality when changing from 8-bit converters to more bits
But I don't think that this solution is easier and cheeper than a SigmaDelta ADC. An advantage of the VCO solution can be that you don't need a seperate Cog for slow frequencies and low sample rates (just measure the pulslength on time).
Andy
The AD7400 reads a +/- 200mv analog signal and outputs its data as a 'density of ones' at a fixed output bitrate of 10 Mhz
Advantages I see are 1) it offers full isolation 2) single wire input per channel 3) trade off sampling rate vs accuracy just by changing the length of the time bucket
Not quite sure what to use it for but its certainly a different chip from the norm!
----
Edit: Well, you can boost its output and connect it to a set of loudspeakers
Post Edited (deSilva) : 2/17/2008 3:54:53 AM GMT
The standard CMOS versions however might not exceed 100kHz @3.3V
The HC is more expensive...
But they need a precise supply voltage to be precise - this is the beauty of the solution in my OP: It does not
The 4584 costs also around a quarter...
Love the topic... have a lot of questions, but I'm sure they will get answered without me having to ask[noparse]:)[/noparse]
I've been approaching the whole area of ADC very gingerly... I have the very vague impression that if I get the right instrument amplifier and actually know what it is doing, the ADC problems will magically disappear[noparse]:)[/noparse]
This is a little OT, but I for one wish that you would put all of your best work and ideas into a package... sort of an advanced education kit... include a dozen of your favorite chips, a little code and a healthy dose of your enthusiasm. You could probably get the chips as samples and sell them for a modest profit.
Then rather than saying a polite thank you, we could show our appreciation by ordering one of your packages... and learn whatever it is you are interested in teaching... what a deal[noparse]:)[/noparse]
Rich
Thank you Rich, but it will not be that easy. However I am thinking in that direction from time to time...
I have looked through the excellent Parallax books for the Basic Stamps...
There is nothing like that for the Propeller!
Also - and no offence intended! - some of those books are a little bit "Don't ask - just do it." This especially avoids an easy switch to the Propeller for the unexprienced reader... And of course they are centered around Parallax products...
In my impression the number of "Propeller-Newbies" is growing now. Some of them do the most extraordinary things and spend a lot of money for useless parts...
They are looking for "boards"... But they do not need a board.... They need some basic instructions, starting with Ohm's Law and "What's in a repeat loop?" and "How to cut wires with a wire cutter"
The Propeller is a most extraordinary device - as we all know. It works best with nothing but caps and resistors around it. But it also interfaces with more complex devices... But be aware that this is not what it is created for... It is created for to DO all the things those external complex devices do.
This however needs understanding WHAT that is in the first place....
There are limits however (CAN, Ethernet,..) Or have a look into a modern Flash-ADC... You either buy it, or you don't
But there is an intermediate level... "Well, I know how to connect LEDs, I can even multiplex a 7-segment display, and I send serial data to my PC by a self programmed VerySimpleSerial. What now?"
Yes, I see what you mean...
Some of these have a beautifully linear voltage vs flash frequency characteristic.
Slow, obviously, but should do for battery level measurement (~3 to 15v). And has a built in 'status' feature...
Thanks again for all of your submissions... a Herculean effort!
Tubular... Very innovative suggestion: Flashing LEDs. It never occurred to me that there would be (as you said), "Some of these have a beautifully linear voltage vs flash frequency characteristic." Do you have any measured data and/or suggested part numbers? A flashing LED as ADC would not only provide A to D but the frequency of flashing may be useful as a front panel display if the flash frequency changes significantly over the voltage range of interest. I agree with you that flasing LEDs may be slow as an A/D, but that's ok for many apps.
Rgds, David
The "voltage control" in 7555 works against 66 kOhms = 50µA, sinking a similar current as the original proposition as well as in the 4046 case....
Post Edited (deSilva) : 2/18/2008 7:39:06 AM GMT
Well, this works fine with the 4584; there is no need for additional signal conditioning, except a 100k serial resistor for higher voltage.
The chip works down to 2.2 Volts, delivering a convenient 2V signal for the Prop.
I took 470k/1nF for the oscillator (but 2M2 and 22p will do as well..) This gave 500 Hz for 2Volts and 6kHz for 8 Volts. Current usage was 300µA corresponding to 20kOhms which is not high-impedance but acceptable for many usages...
It must be calibrated of course and I have no idea how large the variance between chips might be ...
Determining the period of the signal is simple and 6kHz have a nominal resolution of > 12 bits
Note that the signal is no longer symmetric at lower voltages, so high and low level must either be added to find the period or you count from riosing egde to rising egde..)
I just connected 4 inputs to ground and used just one gate for the oscillator and one for buffering.
The 14 pin case is a little bit bulky, but for 50 cents (chip, 2 resistors, 1 cap) this is really nice.
Note: One should add a low pass filter at the input = power supply to reduce the danger of unwanted oscillation. As 2Volts gave a 500 Hz signal, this needs a larger cap... so it might be better to increase the signal frequency (say x10 with a 100p cap)
Post Edited (deSilva) : 2/26/2008 12:17:02 AM GMT
Brian L I think the temperature stability is probably "the issue" with the vco's. An NP0 rated capacitor will certainly help. The flashing LEDs have a similar issue (but more due to self heating which does even out quickly). It may be possible to have a dummy vco connected to the well regulated 3v3 supply to factor out temp effects using the prop to calculate the required compensation.
I haven't had time to do detailed temp checks on the flashing LEDs but will post the initial results as soon as I work out how
you put sawtooth waves in one input and analog to measure in the other and the output is PWM,
so simply count the pulse-widths (not the frequency which doesn't change).
Good sawtooth waves can be made with a constant current source and a capacitor and a transistor
to discharge it after it's full. An LM555 can also be used very simply as the whole sawtooth wave generator.
-Phil
A colleague offered me a 74VHC14 as an alternative which should reduce the input current downto 30µA, equivalent to 100k input resistanc! We'll see...
A simple slope converter as described by Virand will even work for multiple channels (with a 4x comparator). This however will be the limit for SSI solutions, as the next step (channel multiplexer) will exceed the budget
Note that all principles of ADC depend on DAC pus comparator. The reconstruction of the DAC time basis in the Propeller works more reliable for PWM than for V/F, as Phil described. This is not unexpected, as PWM has two degrees of freedom (period and duty cycle)
Also following Virand's suggestion how bad would a "slowish" prop generated sawtooth be? With a long long reset period to drive it back towards gnd.
I've found quite a few dual schmitts in 6 pin packages. Surface mount but for 6 pins this should be ok.
to get a single low frequency beat tone that's readable without ADC.
You can also read a keypad with well chosen resistors on it as you suggested.
Speaking of slow prop generated sawtooth, it should be excellent to generate the sawtooth with the Prop
using PWM output and an R/C filter, if well chosen it shouldn't take long to fall back to ground. Should look
perfect on an oscilloscope. The RC time constant should be just enough to turn the flat looking PWM out into
a nice smooth diagonal line by holding the energy of the pulses up for just over one PWM duty cycle.
-Phil
-Phil
(Why did I even post this?)
To see the signal it has to be decoupled by a cap and pushed up to around 2V by a pair of resistors, as you know it from every audio transistor amplifier..
Now also adding an input low pass we need:
- inverter chip
- 5 resistors (or 4 and 1 diode)
- 3 caps
Still "lowcost" but SOME parts