Hi everybody
I´m trying to read a temp sensor TMP36 on my Netduino Plus at A1 input, with VB 2010.
my declaration code is:
Dim senstemp As New AnalogInput(Cpu.AnalogChannel.ANALOG_1)
Dim Temp As Double = 0
and my reading and print code:
Private Sub temperatura()
Temp = CDbl(senstemp.Read() * 1000)
Debug.Print("Temp: " + Temp.ToString())
End Sub
On my initial tests,when I apply 3.3v to A1 the debugger prints "1000", thats Ok, but when I conect A1 to ground I expect to read "0" but the debugger prints:
Temp: 14.66275659824047
Temp: 12.707722385141741
Temp: 7.8201368523949171
Temp: 8.7976539589442826
Temp: 7.8201368523949171
Temp: 14.66275659824047
Temp: 11.730205278592376
Temp: 7.8201368523949171
Why?
And other question
Why in my instruction senstemp.Read() reads values between 0 to 1 and not between 0 to 1024?
![Photo](http://www.gravatar.com/avatar/a52739740227641847faaf0cdc6b2c61?s=100&d=http%3A%2F%2Fforums.netduino.com%2Fpublic%2Fstyle_images%2Fmaster%2Fprofile%2Fdefault_large.png)
ADC reads show unexpected values
Started by jmanuel, Nov 06 2012 01:26 AM
1 reply to this topic
#1
Posted 06 November 2012 - 01:26 AM
#2
Posted 06 November 2012 - 02:06 AM
JManual,
Dim senstemp As New AnalogInput(Cpu.AnalogChannel.ANALOG_1)
Dim Temp As Double = 0
Try something like the following:
Imports SecretLabs.NETMF.Hardware Dim TempSensor As New SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0)
Also I have some code listed in Visual Basic for the Netduino Go and shieldbase.
Just search for TMP36, should help with averaging the temperatures and conversion to different scales.
Just remember that the shieldbase has a 12 bit ADC (3.3vdc / 4096) while the other Netduinos use 10 bit ADCs (3.3vdc / 1024).
Hope this helps,
Chuck
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users