Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

ADC reads show unexpected values


  • Please log in to reply
1 reply to this topic

#1 jmanuel

jmanuel

    Member

  • Members
  • PipPip
  • 12 posts

Posted 06 November 2012 - 01:26 AM

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?

#2 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 06 November 2012 - 02:06 AM


Dim senstemp As New AnalogInput(Cpu.AnalogChannel.ANALOG_1)
Dim Temp As Double = 0


JManual,

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

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.