Analog Input Readings - LM35 Attached
#1
Posted 04 October 2010 - 05:34 PM
#2
Posted 04 October 2010 - 05:36 PM
#3
Posted 04 October 2010 - 05:39 PM
Hi Muyinteresting,
Netduino's ARM processor supports analog inputs (and AREFs) up to 3.3V. You will need to switch the AREF to 3.3V and use 3.3V with your analog sensor...
Chris
I have tried that. I have powered a single sensor from the netduino 3.3v and bridged the ARef to 3.3v, I get the same result as using 5v, albeit with a reduced range.
I confirmed that the ARef is there as my values hold at 1023 without it (as it should). The sensor is being grounded by the netduino.
#4
Posted 04 October 2010 - 05:41 PM
I have tried that. I have powered a single sensor from the netduino 3.3v and bridged the ARef to 3.3v, I get the same result as using 5v, albeit with a reduced range.
I confirmed that the ARef is there as my values hold at 1023 without it (as it should). The sensor is being grounded by the netduino.
Have you tried using the AnalogInput.SetRange(...) method to calculate your results instead?
Chris
#5
Posted 04 October 2010 - 05:47 PM
Have you tried using the AnalogInput.SetRange(...) method to calculate your results instead?
Chris
I haven't used setrange to calculate my results, however, based on all the readings that I could find, it shouldn't be required. The raw number from IOPin.Read() should be sufficient.
I'll try that when I get home after my classes are done (5pm today! >:\) and experiment with AnalogInput.SetRange().
#6
Posted 04 October 2010 - 06:10 PM
I haven't used setrange to calculate my results, however, based on all the readings that I could find, it shouldn't be required. The raw number from IOPin.Read() should be sufficient.
I'll try that when I get home after my classes are done (5pm today! >:\) and experiment with AnalogInput.SetRange().
Just FYI...if you haven't used Analog.SetRange(...), your default range should be 0-1023.
Chris
#7
Posted 04 October 2010 - 06:19 PM
I'm just running a loop for right now:
AnalogInput AP0 = new AnalogInput(Pins.GPIO_A0); while (true) { Debug.Print(AP0.Read().ToString()); Thread.Sleep(500); }
With that, I get a constant print out of numbers usually hovering at around 88 (with the aref at 5V) and a little bit lower on 3.3v. I touch the sensor and it takes about 5 seconds to reach a higher value. You can watch the values climb by 1 or a little bit more every pass of the loop.
#8
Posted 04 October 2010 - 06:44 PM
With that, I get a constant print out of numbers usually hovering at around 88 (with the aref at 5V) and a little bit lower on 3.3v. I touch the sensor and it takes about 5 seconds to reach a higher value. You can watch the values climb by 1 or a little bit more every pass of the loop.
If you connect analog 0 to GND, do you get a reading of "0"? If you connect analog 0 to 3.3V, do you get a reading of "1023"?
If not, please attach a quick photo so we can see the setup more clearly...
Chris
#9
Posted 04 October 2010 - 10:08 PM
So, as I expected, I jump A0 to GND and I get a consistent 0 across the board.
ARef is connected to 3.3V on the netduino.
I remove the ARef and keep A0 -> GND and I get random periods of values of 127, 255, and 1023. Just as an aside.
I connect my sensor output to A0. Sensor Vin is also on the 3.3V, GND is to a GND pin on the netduino.
I get the following values, it is around room temperature in my room at the moment:
They don't look right at all. I will do more research though.
71 71 71 70 71 70 71 71 70 70 71 70 70 70 70 71 70 70 70 70 70 69 71 71 70 68 71
I am using the following code to pull my values as a test application:
using System; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; namespace NetduinoApplication1 { public class Program { public static void Main() { AnalogInput AP0 = new AnalogInput(Pins.GPIO_PIN_A0); AP0.SetRange(0, 1023); //Define the default just in case. while (true) { Debug.Print(AP0.Read().ToString()); Thread.Sleep(250); } } } }
Pictures are attached of my wiring.
IMG00017-20101004-1743.jpg 325.25KB 199 downloads
IMG00018-20101004-1743.jpg 375.95KB 212 downloads
IMG00019-20101004-1744.jpg 439.27KB 144 downloads
#10
Posted 04 October 2010 - 10:19 PM
#11
Posted 04 October 2010 - 10:28 PM
#12
Posted 13 January 2011 - 02:19 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users