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

Analog input resolution &


  • Please log in to reply
4 replies to this topic

#1 engvidal

engvidal

    Member

  • Members
  • PipPip
  • 10 posts
  • LocationGuarulhos - SP - Brazil

Posted 30 July 2013 - 12:09 AM

Hi

 

If the ADC resolution is 12 bits (from 0 to 4095) why I only obtain a 10 bit result (0 to 1023) ?

 

and more: Why the line in red (reference [color=#ff0000;]pot1[/color]) do not compile ?

 

using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

[color=#ff0000;]AnalogInput pot1 = new  AnalogInput(Pins.GPIO_PIN_A1); // DO NOT COMPILE ! ![/color]

 

  SecretLabs.NETMF.Hardware.AnalogInput  pot =

  new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A1);
 

// using the full path compiles, even with the 'using SecretLabs.NETMF.Hardware'

 

 

Thank You.

 

 



#2 Fahdil

Fahdil

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationJakarta, Indonesia

Posted 28 January 2014 - 12:55 PM

Hi

 

If the ADC resolution is 12 bits (from 0 to 4095) why I only obtain a 10 bit result (0 to 1023) ?

 

and more: Why the line in red (reference [color=#ff0000;]pot1[/color]) do not compile ?

 

which literature that explain the analog input has 12bits? as i know Netduino has limit the analoginput to 10bits. see Hardware Specification.

[color=rgb(255,0,0);]AnalogInput[/color] pot1 = new AnalogInput(Pins.GPIO_PIN_A1); // DO NOT COMPILE ! !

 

it's bcoz you're using both:

using Microsoft.SPOT.Hardware

using SecretLabs.NETMF.Hardware;

 

the netduino with 4.2 framework has the ambiguity. try to delete "Microsoft.SPOT.Hardware".



#3 ShVerni

ShVerni

    Advanced Member

  • Members
  • PipPipPip
  • 138 posts
  • LocationNew York, New York

Posted 28 January 2014 - 04:51 PM

As I understand it, the original Netduinos had 10 bit ADCs, while the Netduino 2 and the Netduino Plus 2 (and maybe the Netduino Go?) have a 12 bit ADC.

 

If you're worried about cross platform compatibility, you should use the Microsoft AnalogInput class, the Read method for which returns a number between 0 and 1 based on the reading, essentially a percentage of the maximum voltage.

 

To use the Microsoft class you need to use AnalogChannels not Pins:

AnalogInput pot1 = new  AnalogInput(AnalogChannels.ANALOG_PIN_A1);

Check out this thread for more details:

http://forums.netdui...etduino-plus-2/

 

Hope that helps!



#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 31 January 2014 - 03:48 AM

Fahdil -- as ShVerni said, switch over to the new Microsoft.SPOT.Hardware.AnalogInput class and you should be good to go. [Or you can pull in SecretLabs.NETMF.Hardware.AnalogInput if you want to use older code samples.] ShVerni -- thanks for responding to this. P.S. ADCs on Netduino Go vary by module (based on the best precision available on the particular module). Shield Base does have the same 12-bit ADCs as Netduino 2 and Netudino Plus 2.

#5 ShVerni

ShVerni

    Advanced Member

  • Members
  • PipPipPip
  • 138 posts
  • LocationNew York, New York

Posted 31 January 2014 - 05:15 AM

ShVerni -- thanks for responding to thisG. P.S. ADCs on Netduino Go vary by module (based on the best precision available on the particular module). Shield Base does have the same 12-bit ADCs as Netduino 2 and Netudino Plus 2.

Glad to help, and thanks for the clarification!






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.