Analog input fluctuations
#1
Posted 06 October 2010 - 12:21 AM
Any suggestions?
Some notes:
1. I have vref tied to the 3.3v pin
2. I am using a 47k resistor in my voltage divider, with one end to 3.3v, one to ground, and the analog input in the middle
3. The circuit runs are as short as physically possible, with the longest wire (besides the thermistor probe's actual cable) no longer than the distance between 3.3v and vref.
4. Using an external power supply makes the problem much worse - with our without usb hooked up
5. I've tried several external power supplies including rechargeable batteries
6. I've tried also tying all the other analog inputs to ground just in case
I vaguely remember reading somewhere to do something to an analog input pin before using it as an input, but I cannot find that post and think it might be for some other microcontroller. Using a multimeter, the voltage seems much more stable than the analog input would suggest.
Any ideas would be appreciated! Thanks, --Bill
#2
Posted 06 October 2010 - 12:35 AM
#3
Posted 06 October 2010 - 12:56 AM
#4
Posted 06 October 2010 - 01:44 AM
#5
Posted 06 October 2010 - 02:16 AM
#6
Posted 06 October 2010 - 02:23 AM
#7
Posted 06 October 2010 - 03:51 AM
This is not a solution, but a workaround.I'm seeing fluctuations +/- 4 'steps' if that is a sensible way to describe it. For example: if the reading should be "610" out of 1024, it is varying from 606 - 614, rapidly. On one of my computers, using only usb power, it fluctuates 1 step, which is fine - but not how I need to use the board.
I'm not concerned about the accuracy, but "repeatability" is important.
You can use the SetRange(0,100) method of AnalogInput. This would effectively divide it by 10 and masked the fluctuation.
Depending on how accurate the sensor is, you may or may not loose accuracy.
#8
Posted 06 October 2010 - 05:39 PM
This is not a solution, but a workaround.
You can use the SetRange(0,100) method of AnalogInput. This would effectively divide it by 10 and masked the fluctuation.
Depending on how accurate the sensor is, you may or may not loose accuracy.
I use a temperature sensor from Microchip. This is a short excerpt from a PDF that might be relevant to your issue. I had a very similar problem with my circuit (not with the Netduino but on a standard microcontroller) where everytime I would run motors the analog values would go nuts. I added two resistors and a capacitor to smooth out the noise in the circuit and that made all of the difference in the world...
"IC temperature sensors use analog circuitry to measure
temperature. Unlike digital circuits, analog circuits are more
susceptible to power-supply noise. It is recommended that a
bypass capacitor CBYPASS of 0.1 μf to 1 μf be placed at close
proximity to the VDD and VSS pins of the sensor. The capacitor
provides protection against power-supply glitches by slowing
fast transient noise. However, the effectiveness of the bypass
capacitor depends upon the power-supply source resistance.
Larger source resistance provides RC network with the CBYPASS
and adds a corner frequency to filter out the power-supply
noise. Adding a series resistor to the power-supply line is
adequate to increase the source resistance."
source: http://ww1.microchip...eDoc/21895d.pdf (Page #5)
#9
Posted 06 October 2010 - 11:18 PM
#10
Posted 06 October 2010 - 11:50 PM
#11
Posted 07 October 2010 - 12:24 AM
#12
Posted 07 October 2010 - 02:41 AM
#13
Posted 07 October 2010 - 02:52 AM
#14
Posted 07 October 2010 - 07:14 AM
#15
Posted 07 October 2010 - 01:25 PM
#16
Posted 08 October 2010 - 02:03 AM
#.5V...3.3V.VIN.....Powersource
1 4.73 3.29 1.26....PC USB - short cable
2 4.22 3.26 1.08....PC USB via long cables and usb hub
3 4.99 3.30 11.79...Lipo Battery
4 5.05 3.29 1.56....Motorola Droid USB Charger
The only scenario where the analog input has been stable (+/- 1 step) is #2... oddly enough.
I still don't have a scope, so this is the best I can do at the moment.
As a recap, I have a wire going from 3.3V to Vref, and a voltage divider using a 47K resistor and a thermistor. I also have three LEDs for indicators. Attached is a badly drawn schematic.
Any more suggestions? Thanks!! --Bill
Attached Files
#17
Posted 14 October 2010 - 02:08 AM
I borrowed a Rigol DS1052E -- the screen capture is below. I'm still trying to figure the scope out, I've never used a digital one before.
Anyway, is seems only on external power, there's fairly regular pulses of noise on the 3.3V line, regardless if the source is a battery or my 12v regulated supply.
I built the noise reducing circuit in this article, using an inductor and a bunch of caps:
http://www.arduino.c...Lib/Thermistor4
That is the blue line in the picture... so I've at least filtered it out, now, but my readings of the thermistor are certainly slowed.
Any ideas where the pulses are coming from and how to eliminate them, besides the inductor, etc?
Thanks!
#18
Posted 14 October 2010 - 05:37 PM
For any unused ADC input pins, it's best to set their pullup resistors so they don't mess with
the others (pinMode(myPin, INPUT); digitalWrite(myPin, HIGH)).
#19
Posted 14 October 2010 - 06:01 PM
Is this applicable to the Netduino? (From the Arduino playground linked above)
For any unused ADC input pins, it's best to set their pullup resistors so they don't mess with
the others (pinMode(myPin, INPUT); digitalWrite(myPin, HIGH)).
Technically, it's always best to tie unused ADCs to ground. If you try setting them to InputPorts with pullup resistors enabled, let me know if that affects things for you...
Chris
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users