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

Problem with Analog input on Shield


  • Please log in to reply
5 replies to this topic

#1 Bill

Bill

    New Member

  • Members
  • Pip
  • 3 posts

Posted 03 October 2010 - 02:24 PM

I just recently purchased my netduino, and being fairly new to electronics purchased this starter kit for it. Using the shield included I've managed to hook up the LCD and digital add-ons and use them just fine. Currently I have a program that just displays the various inputs to the LCD. This works fine for the digital and serial ports, but I can't get a proper value form the analog ports.

When I read from the analog ports I always get 1023 as an output. Sometimes the value will flicker briefly but it is always less than a second and goes right back to 1023. I've tried the angle sensor, light sensor, and thermistor and no matter which analog port I use I always have an output of 1023.

Searching this board and the internet I saw that a common problem was cross wiring the AREF to the in use voltage, but given that this shield chassis uses all pins I don't really know what to try. Additionally, using analog ports 2-5 on the shield gives the output of 1023, but using the analog port 1 gives a runtime error while debugging. Here is an example of the code, currently using analog 5. If I change it to 0 or 1 I get a run time error. I guess I'm not really sure how the pins 0-5 are mapped to 1-5.

            AnalogInput tempSensor = new AnalogInput(Pins.GPIO_PIN_A5);

            // set up the LCD's number of columns and rows: 
            lcd.Begin(16, 2);

            // Print a message to the LCD.
            lcd.Write("Input:");

            while (true)
            {
                // set the cursor to column 0, line 1
                lcd.SetCursorPosition(0, 1);
                
                // print the number of seconds since reset:
                lcd.Write(tempSensor.Read().ToString());

                Thread.Sleep(100);
            }

I'm sure it's probably some newbie error, so I appreciate any help or suggestions anyone has to offer, hopefully I'm not making a glaring RTM mistake.

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 03 October 2010 - 02:40 PM

Hi Bill, Thanks for your post, and welcome to the Netduino community. Yes, you do need to wire 3V3 to AREF. The ARM chip used on the Netduino does not have an internal AREF like the AVR chip used on the Arduino. If you have some wires with spring-loaded hooks on the ends, you can insert those between the Netduino and the Shield (3V3 to AREF). Also, you'll want to make sure that the shield outputs 0.0-3.3V analog signals. The Netduino is 5V tolerant for digital inputs--but is spec'd to 3.3V on the analog inputs. This is due to the lower-voltage 32-bit ARM chip. Chris

#3 Bill

Bill

    New Member

  • Members
  • Pip
  • 3 posts

Posted 03 October 2010 - 04:17 PM

Thanks for your post. I don't suppose you have a link to an example of wires with a spring loaded hook? Something to go off of when I wander around the local hardware store/radio shack? As to testing the output of the shield, should I just use a multimeter on the shields connector pins and see what it reads? Thanks again for the info!

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 03 October 2010 - 05:01 PM

Thanks for your post. I don't suppose you have a link to an example of wires with a spring loaded hook? Something to go off of when I wander around the local hardware store/radio shack?

Here's what you're looking for:
http://www.sparkfun....products_id=501

As to testing the output of the shield, should I just use a multimeter on the shields connector pins and see what it reads?


Yes, that works really well--just test the analog pin against one of the GND pins. Also, the shield manaufacturer should be able to answer that question... Just be careful not to overvolt anything. In our tests, we haven't seen any short-term damage from feeding 5V to the 3.3V analog input pins...but Atmel specifically says not to do it :)

Chris

#5 Eric Burdo

Eric Burdo

    Advanced Member

  • Members
  • PipPipPip
  • 130 posts

Posted 03 October 2010 - 06:25 PM

Here's what you're looking for:
http://www.sparkfun....products_id=501


They had those at the local Radio Shack last week. So likely you can find them in your rShack...

They do come in handy. I have a set of those for my multimeter too... handy there also.
~ Eric D. Burdo ~ http://brick-labs.com/

Today LED's, tomorrow, the world!!! Well, OK, maybe servos.

#6 Bill

Bill

    New Member

  • Members
  • Pip
  • 3 posts

Posted 03 October 2010 - 10:55 PM

Yep, they had them at radio shack and now everything is working great. Thanks again for all the help!




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.