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

Understanding input/output pins


  • Please log in to reply
12 replies to this topic

#1 MarkWill

MarkWill

    Advanced Member

  • Members
  • PipPipPip
  • 34 posts

Posted 18 September 2010 - 08:24 PM

I am trying to come to terms with the various pins on my spanking brand new Netduino. Some of these are probably basic electronics page (I am a software chap, with limited hardware experience).

  • What is the maximum output on the digital I/O pins? I see 3.3V mentioned on the specs page but when I take a voltage I see no more than about 2.5V
  • What is the high voltage for a digital pin supposed to be? This is where I get the 2.5V from - I put an LED in and ensure that pin 13 is on and read 13.
  • am I right in saying that ALL the pins can be used as "simple" on/off pins (programmed with OutputPin) but some of the pinds offer additional capabailities (such as PWM on pins 5,6,9 and 10)?
  • What is a typical application for a UART pin?
  • Same question for SPI MOSI - in what scenarios might I use these?
  • Same for I2C
  • Why no analog out pins? For variable output like a motor where I might want to vary the speed that seems like a problem. Or am I supposed to use PWM in such a situation?

Thanks.

Mark

#2 Chris Seto

Chris Seto

    Advanced Member

  • Members
  • PipPipPip
  • 405 posts

Posted 18 September 2010 - 08:41 PM

What is the maximum output on the digital I/O pins? I see 3.3V mentioned on the specs page but when I take a voltage I see no more than about 2.5V

3.3V

What is the high voltage for a digital pin supposed to be? This is where I get the 2.5V from - I put an LED in and ensure that pin 13 is on and read 13.

3.3V

am I right in saying that ALL the pins can be used as "simple" on/off pins (programmed with OutputPin) but some of the pinds offer additional capabailities (such as PWM on pins 5,6,9 and 10)?


Almost, some of the analog ports are only analog, I think.

What is a typical application for a UART pin?
# Same question for SPI MOSI - in what scenarios might I use these?
# Same for I2C


Serial connection to an LCD, they are all just communication protocols.

Why no analog out pins? For variable output like a motor where I might want to vary the speed that seems like a problem. Or am I supposed to use PWM in such a situation?


You shouldn't ever try to run a motor directly from your Netduino, it can't supply enough power. There really isn't any reason for a real AnalogOut.

Hope this helps. :)

#3 MarkWill

MarkWill

    Advanced Member

  • Members
  • PipPipPip
  • 34 posts

Posted 18 September 2010 - 08:51 PM

Thank you, Chris - much appreciated. Some follow up questions. Any thoughts on why I am only seeing about 2.5V on pin 13? I haven't seen above that yet on any pin. Regarding the use of a motor, if I plug the motor into the 3.3v pin it works fine. If the digital pins are 3.3V (or at least to be - see above) what is the issue with using the motor off a digital pin? Beyond that, if I want to embed some logic for when the motor kicks in within my C# code (based on some sensor, for example), what is the preferred approach for hooking up the motor so that a) I can turn it on and off and B) I can also control the speed? Told you I'm a newbie :-) Thanks. Mark

#4 Chris Seto

Chris Seto

    Advanced Member

  • Members
  • PipPipPip
  • 405 posts

Posted 18 September 2010 - 09:07 PM

Hi Mark, If you are pushing a PWM freq over pin 13, you may not see an accurate voltage when reading with a multimeter. Otherwise, I don't know why. If you wanted to control a motor, the recommended way would be through an H bridge or something similar. See: http://www.sparkfun....products_id=315

#5 MarkWill

MarkWill

    Advanced Member

  • Members
  • PipPipPip
  • 34 posts

Posted 18 September 2010 - 09:11 PM

Hi Mark,

If you are pushing a PWM freq over pin 13, you may not see an accurate voltage when reading with a multimeter. Otherwise, I don't know why.

Thanks again. The only line of code I have releted to this pin is:

OutputPort ledcheck = new OutputPort(Pins.GPIO_PIN_D13, true);

So, a bit confused about why I see only 2.4 volts (on this or any pin, for that matter).

Thanks.

Mark

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 September 2010 - 11:01 PM

Thanks again. The only line of code I have releted to this pin is:

OutputPort ledcheck = new OutputPort(Pins.GPIO_PIN_D13, true);

So, a bit confused about why I see only 2.4 volts (on this or any pin, for that matter).


Hi Mark,

What are you using for your ground reference? How are you powering your Netduino?

Chris

#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 September 2010 - 11:05 PM

Almost, some of the analog ports are only analog, I think.


You can use all 20 pins (digital 0-13 and analog 0-5) as digital input/output pins.

Technical details: Netduino muxes I2C-capable digital lines onto AD4/AD5 (which provides digital capabilities on pins that would otherwise be analog-only--and which also provides pin compatibility with Arduino shields).

Chris

#8 MarkWill

MarkWill

    Advanced Member

  • Members
  • PipPipPip
  • 34 posts

Posted 19 September 2010 - 11:38 PM

Hi Mark,

What are you using for your ground reference? How are you powering your Netduino?

Chris

Hi Chris,

I am powering with a USB connection to my PC. Should that not get me 5V? I am just using the GRN pin for the ground reference.

Thanks.

Mark

#9 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 19 September 2010 - 11:42 PM

I am powering with a USB connection to my PC. Should that not get me 5V? I am just using the GRN pin for the ground reference.


The USB port on your PC will generally give you somewhere between 4.5V and 5.5V. If you're powering your Netduino from your PC, you can measure the PC voltage by proving the 5V and GND pins on the Netduino.

I know this will be a silly question...but have you tested your multimeter with other devices to ensure that its readings are accurate?

Chris

#10 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 20 September 2010 - 06:27 AM

  • What is the maximum output on the digital I/O pins? I see 3.3V mentioned on the specs page but when I take a voltage I see no more than about 2.5V

Please note the voltage levels for a logic high ('1'): min VDDIO - 0.4 V @ IO = 8 mA, so you should see at least 2.9 V (VDDIO = 3.3 V).

  • What is the high voltage for a digital pin supposed to be? This is where I get the 2.5V from - I put an LED in and ensure that pin 13 is on and read 13.

What LED? What is the resistance of the current limiting resistor? Please note the max output current for most Netduino pins is only 8 mA, so they cannot drive a LED directly. The exception is three digital pins 2, 3, 7 which can provide up to 16 mA and analog pins 0 - 3 that can provide only 2 mA in digital output mode. In all likelihood, you are overloading the pin.

I am powering with a USB connection to my PC. Should that not get me 5V? I am just using the GRN pin for the ground reference.

Netduino microprocessor absolute maximum operating voltage is 4.0V, so the 5V from USB is regulated to 3.3V by onboard regulator. This implies the max voltage of output pin is also 3.3V, but the inputs are "5V tolerant" so they can accept up to 5.5V. This means you can connect a device with 5V outputs directly to Netduino input pins, but you need voltage level shifter (e.g. resistor voltage divider, or a transistor) to output 5V signals from Netduino.

#11 hari

hari

    Advanced Member

  • Members
  • PipPipPip
  • 131 posts

Posted 20 September 2010 - 05:42 PM

Any thoughts on why I am only seeing about 2.5V on pin 13? I haven't seen above that yet on any pin.

It puzzles me how you only get 2.5V, so I did a simple test, and I'm getting 3.3V.

Possible explanations:
- You do not allow that pin to be on HIGH long enough for the multitester to register the actual voltage.
- You have other load on that pin.
- That pin is setup as PWM.
- You are using your multitester incorrectly (Volts vs other), correct Volt range, probe in proper jack?
- You have a defective Multitester.
- You have a defective Netduino.

Here's my test code:

public static void Main()
 {
    OutputPort voltMeter = new OutputPort(Pins.GPIO_PIN_D13, false);
    OutputPort onboardLed = new OutputPort(Pins.ONBOARD_LED, false);
    
    while (true)
    {
        voltMeter.Write(true);
        onboardLed.Write(true);
        Thread.Sleep(3000);

        voltMeter.Write(false);
        onboardLed.Write(false);
        Thread.Sleep(3000);
    }
}

Here's what I see:
http://www.youtube.com/watch?v=jqnP1A10BuA

#12 Crispin

Crispin

    Advanced Member

  • Members
  • PipPipPip
  • 65 posts
  • LocationLondon, England, Earth

Posted 21 September 2010 - 07:23 AM

- You have a defective Multitester.


I would go with this option - I have 3 testers (Fluke), non of them measure 3.3 and they all differ. Given they all about 15-20 years old and had a hard life, it's not bad going. Time for new toys B)
--
Take a seat, I'll be right with you.

#13 MarkWill

MarkWill

    Advanced Member

  • Members
  • PipPipPip
  • 34 posts

Posted 21 September 2010 - 02:40 PM

Thanks everyone (especially Hari, for posting "evidence" in the form of the video :-)). I am pretty sure my multitester is good since I have never had a reading issue with it elsewhere. However, I subsequently tried (having rebuild the circuit, small as it is) on Sunday and I got a 3.3V reading, if I recall. It could be that I messed up somewhere, although I did double check at the time since I was confused. Still a bit confused. Anyway, I'll check it again at some point. Thanks again. Mark




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.