Hi folks,
I am attempting to modify existing hardware and software to implement an LM335AZ temperature sensor as well as interface a Maxbotix ultrasonic sensor. The uC is a Silicon Labs C8051F121 . The ADC0 is 12bit and has 8 analog channels available for input as well as an 9th channel which is a built in on chip temperature sensor. The existing code has a scale factor to convert the "count" values from the AtoD into mV values. I had to change this number quite a bit to get accurate values. The previous code did not need great accuracy. Also the analog inputs seem to top out (4095 counts) at 2.65V, even though the VREFA is 3.28V. The VREFA appears to be very noisy when sampling is occurring, almost 200mV Pk2Pk. We implemented a software average to help smooth out the output.
My questions:
1. Why am I unable to get the AtoD to read the full range of voltage? 2. What is the PCA gain and when/how should I use it? 3. Is the "noise" on the VREFA during sampling normal? 4. Should I continue to use the slowest sample clock possible? if my math is right its 1.03125MHz 5. Would it help to lower the SYSCLK from 66MHz is we find we can deal with a slower clock?
Thanks,
Noisy voltage reference (or noisy measurement signal) will create a significant measurement error. And that means you will not get the full scale you expect.
How is your VREF stabilized? A capacitor? Any coils?
VREFA is a 3.3v Zener fed 5V through a 22.1K resistor. No coils or capacitor. The 3.3V goes straight from the Zener to VREFA.
First off, it's way better to have a voltage reference based on a band-gap - basically a "super-zener". But there really should be some filtering on that signal.
With 8-bit ADC, there isn't much need to care. But the extra 4 bits do add a bit to the requirements.
So if i can make the range of my sensors output broader I could probably dump the extra 4 bits? Its rather limited at the moment, especially the temp sensor.
What type of filtering would be best? I have tried a .1uf from the zener output to AGND without much effect.
I'll look up a bandgap reference.
Thanks for the tips!
Wait a minute. Are you saying that you have a 12-bit ADC, but are only using a small part of the range?
You should obviously try to make your measured signal span as large part as possible of the full range of the ADC since that will reduce the effect of noise, linearity errors etc associated with the ADC.
Notice that when you buy a multimeter, it may have a precision specified as 0.2% + 4 digits. 0.2% is an important value for a full-range signal. But for small signals, the "4 digits" will be very important - it indicates problems with the ADC ticks, zero reference etc. So a reading that is +/- 4 ticks off can represent a huge percentage error for a signal only spanning a small part of the full range.
You need to consider capacitors/coils based on what frequency of noise you want to filter away. A big capacitor is no good blocking high-frequency noise while a small capacitor is no good blocking low-frequency noise.
So I discovered the "zener" is in fact a band gap voltage reference: ZRC330F03TA made by Zetex. Would I still need filtering? the datsheet seems to suggest not.
The Temp sensor gives its output as 10mv/degree Kelvin. It will primarily be used out of the sun reading air temperature to compensate the Ultrasonic sensor. It is rated from -40C to +100C which would equate to 2.73V to 4.00V output. The actual air temperatures in the application will most likely be between 0-40C which would be 2.73V to 3.10V. That's obviously not a very wide range.
The Ultrasonic sensor has an output scaled (VCC/1024) per cm. It can range up to about 600cm. We will probably be measuring somewhere in the 100-300cm range with the actual range distance being very steady (+/- 2cm?) for most of the process time. The range is expected to increase about 100cm for a period of about 30 minutes once every 2-5 days. If the actual process range only varies by 100cm the corresponding output voltage will only vary by 0.322V. I think I can a 5V source for the Ultrasonic sensor which would get the voltage difference up to 0.488V
What is the accepted method for interfacing these type sensors to an AtoD?
Also the analog inputs seem to top out (4095 counts) at 2.65V, even though the VREFA is 3.28V. if you have the internal reference selected the max count is at 2.43V
Erik
I checked and the Internal Ref was being used. I have now changed that, but its still acting the same. REF0CN= 0x06. A/D channel 6 has 0.448V input. A sample from CH 6 = 0x290. If I try to calculate the reference voltage based on the counts and the input Voltage I get 2.786V. WTH?
publish your a/d code including the initialize on the SILabs forum, some there work with the f12x A/D almost daily. Remeber USE pre and /pre
www.cygnal.org/.../Ultimate.cgi