ADC Reading wrong?
#1
Posted 08 May 2011 - 05:15 PM
#2
Posted 08 May 2011 - 08:33 PM
To be or not to be = 0xFF
Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life
Follow @nevynuk on Twitter
#3
Posted 08 May 2011 - 08:48 PM
Yes Roughly 700 mV, I am hooking it up exactly the same way as well.Is the reference voltage the same on both platforms?
Regards,
Mark
#4
Posted 08 May 2011 - 09:08 PM
When you say that the reference voltage is 0.7V, do you mean the external AREF or the voltage going to the analog input?Yes Roughly 700 mV, I am hooking it up exactly the same way as well.
P.S. The allowable external reference range for the microcontroller is 2.7V to 3.3V.
Welcome to the Netduino community,
Chris
#5
Posted 08 May 2011 - 09:14 PM
Hi sism3477,
When you say that the reference voltage is 0.7V, do you mean the external AREF or the voltage going to the analog input?
P.S. The allowable external reference range for the microcontroller is 2.7V to 3.3V.
Welcome to the Netduino community,
Chris
The Voltage going into the analog input. Im unsure of how to check the AREF i have a meter handy if you can tell me ill let you know.
#6
Posted 08 May 2011 - 09:36 PM
Yes Roughly 700 mV, I am hooking it up exactly the same way as well.
After some research I found that you mention the AREF multiple times and that on the new netduino plus rev. b boards, which I have, include a internal AREF. I have been assuming that the netduino also used a 5v AREF as the arduino does but I was wrong as it is as you stated 3.3v. Now that i know this the math works out properly sorry to waste your time.
#7
Posted 09 May 2011 - 12:43 AM
#8
Posted 09 May 2011 - 12:51 AM
I found that it takes about 10 seconds for the values to stabilizethe only problem that I am having is that the readings bounce all over the place. From 85-65F after i calculate it or 210-230 ADC value its reading.
Could it be that the current heats things up and it takes a while for everything to stabilize ?Any ideas what could cause this?
#9
Posted 09 May 2011 - 01:04 AM
Now that I have the proper VREF the only problem that I am having is that the readings bounce all over the place. From 85-65F after i calculate it or 210-230 ADC value its reading. I have tried using the Internal VREF as suggested in another thread and the external VREF by connecting the 3.3v pin to VREF and it still dosnt keep it from floating. Any ideas what could cause this?
The problem is that the values never stabilize they they jump very rapidly. This is a copy of the feed look at field two. I had it set to update every 5 seconds to get more data. Here is a link http://api.thingspea...I0VEBVMVFVVFCXH
#10
Posted 09 May 2011 - 01:29 AM
#11
Posted 09 May 2011 - 01:37 AM
I looked at it using http://api.thingspea...ls/637/charts/2 and it looks relatively stable ... have you tried to see the average over a couple of readings to eliminate the jitter ?
The problem is im trying to get accurate readings. The arduino's readings are much more stable. Looking at the chart doesn't do it justice how off it is because of that -6.3 spike you see.
#12
Posted 09 May 2011 - 01:58 AM
The problem is im trying to get accurate readings. The arduino's readings are much more stable. Looking at the chart doesn't do it justice how off it is because of that -53 spike you see.
Are you powering via USB? I believe it works fine when using external power supply other than USB. I am unsure if this is an issue with certain USB ports or all.
#13
Posted 09 May 2011 - 02:03 AM
Indeed, it was stable when powered by an external 9VAre you powering via USB? I believe it works fine when using external power supply other than USB. I am unsure if this is an issue with certain USB ports or all.
#14
Posted 09 May 2011 - 02:25 AM
The problem is that the values never stabilize they they jump very rapidly. This is a copy of the feed look at field two. I had it set to update every 5 seconds to get more data. Here is a link http://api.thingspea...I0VEBVMVFVVFCXH
I just tried it again using the a 12v power supply and it gives the same results. I cleared the previous data and have it updating now.
#15
Posted 09 May 2011 - 04:42 AM
You should expect a jitter of at least +/-1 step on the best chance.
On the other side, it is easy having noise on the supply and on the ADC input itself: that could count for several steps high and low.
Assuming you don't own a scope to analyze where is the noise, I'd suggest to apply a digital-filter to the ADC readings.
Often I use this formula:
Vnew = (Vold * (N-1) + ADC) / N
Where:
- ADC is the current reading;
- Vold is the result at the previous calculation;
- Vnew is the current result to keep as were the ADC unfiltered;
- N is a constant and it is a kind of "responsiveness"-factor: the higher is the slower will react to a change: I'd try from 3 to 8.
Bear in mind that:
- the sensor itself it is NOT responsive to a temperature change, so don't be worried about the slowness of the function;
- just use floats in the formula, even the ADC is given as an integer: the calculation using integer could not converge properly. However you may cast to int after the Vnew has been calculated.
PS: I built some circuit based on the ADC reading and I have some suspect on the accuracy of the hardware/firmware around the ADC itself. So, perhaps, it could not your fault all that jittering.
#16
Posted 09 May 2011 - 10:13 AM
#17
Posted 11 May 2011 - 03:00 PM
#18
Posted 11 May 2011 - 08:12 PM
If you want to use the ThingSpeak API to normalize the data you have some options. Just add to the query string some additional parameters:
average=10 (this will average the data into 10 minute increments)
median=10 (this will take a median)
You can also set some ranges, so you can filter out data that does not fall into a range you are interested in or to filter our bogus data.
As an example...
min=100
max=200
I understand that I can use thingspeak can do this but this is not something I want to do in software. The netduino's hardware should not be giving such noisy readings with such a simple sensor. I have yet to find a solution for this but I don't want to move forward on any of my projects while I am questioning the accuracy of the ADC.
#19
Posted 12 May 2011 - 12:49 PM
Odd question, but if you flash your Netduino Plus with the regular Netduino firmware (bootloader using SAM-BA and then the .NET MF runtime using MFDeploy)...do you get more consistent results?
Chris
Ok I finally got a chance last night to flash my Netduino Plus with the regular netduino firmware as you suggested and now the readings are perfect. So does that mean this is a firmware issue?
#20
Posted 12 May 2011 - 02:05 PM
Ok I finally got a chance last night to flash my Netduino Plus with the regular netduino firmware as you suggested and now the readings are perfect. So does that mean this is a firmware issue?
That's very helpful feedback.
The analog inputs do not block the Ethernet interrupts when they measure readings. We may need to tweak this so that all interrupts are disabled temporarily. That's not a bad thing to do if we're conducting a quick operation--but for extended readings it could be troublesome.
We'll explore it. Thank you again for the testing.
Chris
- sism3477 likes this
1 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users
-
Bing (1)