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 Quirk


  • Please log in to reply
20 replies to this topic

#1 J Wilson

J Wilson

    Advanced Member

  • Members
  • PipPipPip
  • 30 posts

Posted 11 October 2011 - 02:49 PM

I don't know if anybody documented this quirk before, but if you put 5 volts on an analog pin, ALL of the analog ports will read 1023. If you put a maximum of 3.3 volts on analog pins, they work properly.

#2 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 11 October 2011 - 02:54 PM

I don't know if anybody documented this quirk before, but if you put 5 volts on an analog pin, ALL of the analog ports will read 1023. If you put a maximum of 3.3 volts on analog pins, they work properly.

Oh dear, please don't feed the analog ports with 5V, they won't like that at all!

From http://www.netduino....duino/specs.htm :

analog reference: 2.6 - 3.3 VDC
*snap*
digital i/o are 3.3 V--but 5 V tolerant

only digital I/O is 5V tolerant, analog inputs absolutely not!
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#3 John Dybowski

John Dybowski

    New Member

  • Members
  • Pip
  • 5 posts

Posted 13 October 2011 - 03:42 AM

Oh dear, please don't feed the analog ports with 5V, they won't like that at all!

From http://www.netduino....duino/specs.htm :
only digital I/O is 5V tolerant, analog inputs absolutely not!


I believe if you run I2C and you pull up to +5, it has the same effect.
JD

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 13 October 2011 - 04:22 AM

Hi John,

I believe if you run I2C and you pull up to +5, it has the same effect.

Very interesting. Can you reproduce that? The I2C pins (A4/A5) are switched and the analog pins should be disconnected from them when used in digital mode.

Chris

#5 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 13 October 2011 - 04:44 AM

As the specs state, the two-wires interface (aka I2C) has a pair of pull-up resistors to the Vdd (+3.3V). The lines themselves are +5V tolerant, meaning the chip won't suffer. By the way, by using a +5V (or else) based I2C-bus there are useless/tedious currents flowing into the Netduino MCU. The ADC behavior is different. Unless very special designs, any silicon chip has a pair of "invisible" diodes for any I/O: one is toward the Vss, and the other toward Vdd. Obviously, they are reverse-polarized until the voltage is falling within the bounds Vss..Vdd. In the case of the ADC, any input will begin to flow current as soon its voltage rises over Vref (plus a little). Over this threshold the current will flow anywhere in the circuit because it is a danger condition that should be avoided (as long the dual case when the voltage drops below Vss). So, I don't think the behaviors are the same. I wonder why the Atmel's guys did not provided any bit to disable the internal pull-up, though. Cheers
Biggest fault of Netduino? It runs by electricity.

#6 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 14 October 2011 - 04:35 AM

Just a note on the I2C-Bus upper voltage limit.

I didn't realized that either on the Netduino standard and Plus version there is a multiplex-chip to share the I2C-Bus lines with two ADC inputs.
That multiplex-chip is 3.3V powered, thus:
IT WILL NOT POSSIBLE TO USE RELIABLY THE I2C-BUS WITH VOLTAGES OVER +3.3V.

In other words: THE NETDUINO STANDARD/MINI CANNOT USE +5V-BASED I2C-BUS.

I apologize for the late news: probably I was sleeping.
Cheers
Biggest fault of Netduino? It runs by electricity.

#7 Stefan W.

Stefan W.

    Advanced Member

  • Members
  • PipPipPip
  • 153 posts

Posted 14 October 2011 - 07:26 AM

Why should it not be possible? The datasheet of the chip says that the switch voltage may be exceeded if the maximum diode current is not exceeded. so the data lines will be @3.8V or something, so as long as the logic high thresholds of each chip is below that, it shouldn't generate problems.
I believe that no discovery of fact, however trivial, can be wholly useless to the race, and that no trumpeting of falsehood, however virtuous in intent, can be anything but vicious.
-- H.L. Mencken, "What I Believe"

#8 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 14 October 2011 - 07:45 AM

Why should it not be possible? The datasheet of the chip says that the switch voltage may be exceeded if the maximum diode current is not exceeded. so the data lines will be @3.8V or something, so as long as the logic high thresholds of each chip is below that, it shouldn't generate problems.

That's right, but it has no sense considering a strange voltage of 3.8V.
The actual meaning is:
don't use the I2C-Bus with 5V powered/pulluped devices (unless you add a level shifter).
Cheers
Biggest fault of Netduino? It runs by electricity.

#9 Stefan W.

Stefan W.

    Advanced Member

  • Members
  • PipPipPip
  • 153 posts

Posted 14 October 2011 - 08:01 AM

Why? I see no reason why it shouldn't work. There's power wasted, yes, but unless you're running on batteries one mA won't hurt you (or your equipment).
I believe that no discovery of fact, however trivial, can be wholly useless to the race, and that no trumpeting of falsehood, however virtuous in intent, can be anything but vicious.
-- H.L. Mencken, "What I Believe"

#10 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 14 October 2011 - 08:36 AM

Why? I see no reason why it shouldn't work. There's power wasted, yes, but unless you're running on batteries one mA won't hurt you (or your equipment).

So, you would feed a voltage above the recommended limit? Along this way, we may also feed the ADC inputs of the Netduino with +5V...
Moreover, do you think that would be reliable a I2C-Bus having one or more 5V powered devices, seeing voltage levels of 3.8V?

The Netduino designers could have chosen to power the switch with +5V, but it would have an useless move anyway. Either the ADC, and the TWI (I2C) lines are bounded for +3.3V, i.e. they are *NOT* 5V-tolerant.

No fight at all, but I find it a nonsense insisting to say that's a reliable usage.
The power waste is the very last thing in my mind, though.
Cheers
Biggest fault of Netduino? It runs by electricity.

#11 Stefan W.

Stefan W.

    Advanced Member

  • Members
  • PipPipPip
  • 153 posts

Posted 14 October 2011 - 08:52 AM

So, you would feed a voltage above the recommended limit? Along this way, we may also feed the ADC inputs of the Netduino with +5V...



The datasheet of the multiplexer explicitely says that it is okay to feed it a voltage above the recommended limit as long as you keep the current down, which is what the pullup resistor does.

Are you saying the datasheet is wrong?


Disregard that, it's talking about negative voltages, not voltages above the limit

Moreover, do you think that would be reliable a I2C-Bus having one or more 5V powered devices, seeing voltage levels of 3.8V?


As I said before, as long as the "logic high" thresholds are below that (and they usually are), why should it not?

Edited by Stefan W., 14 October 2011 - 08:57 AM.

I believe that no discovery of fact, however trivial, can be wholly useless to the race, and that no trumpeting of falsehood, however virtuous in intent, can be anything but vicious.
-- H.L. Mencken, "What I Believe"

#12 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 14 October 2011 - 09:30 AM

I really don't understand what's your point.

The "untold" message behind Netduino is: "make all your surrounding hardware working at +3.3V".
Since most of the people is coming from the "5V world" (e.g. Arduino), there's an attempt to give them the life easy...
Well, I may understand that the user should be helped in any way, but I personally find frustrating telling him/her that everything is possible, then -when something is not working- he/she couldn't do that.
What I see is that most of the people is going to mix the supplies with any/few cares, or choosing the most accomplish (maybe because the leds are brighter).
That is a wrong behavior!

This thread should be moved better under the "I2C voltage", where a similar consideration was made about the voltage of the chips.
When the people want to work with Netduino must bear in mind that:
  • the nominal supply voltage is +3.3V
  • a power supply of +5V (or similar) is *NOT* normal
  • some exception/workaround may be applied when they must(*) work with a +5V logic, but that should not be the normality!

(*) as "must" I mean there's no way to make the logic working at supply lower than +5V.

Hope it's clear now.
Cheers
Biggest fault of Netduino? It runs by electricity.

#13 Stefan W.

Stefan W.

    Advanced Member

  • Members
  • PipPipPip
  • 153 posts

Posted 14 October 2011 - 09:49 AM

If you want to say "it should be not the normality", then say that and not "it is not possible", because then the scientist in me forces me to find counterexamples ;)
I believe that no discovery of fact, however trivial, can be wholly useless to the race, and that no trumpeting of falsehood, however virtuous in intent, can be anything but vicious.
-- H.L. Mencken, "What I Believe"

#14 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 14 October 2011 - 10:04 AM

The scientist in you should tell you to read the specs. The specs are clear. I may even power a 220V bulb at 110V, but it will make a poor light which make it useless. I may even try to power it at 380V, perhaps it will light for a while, but...how long? Cheers
Biggest fault of Netduino? It runs by electricity.

#15 Stefan W.

Stefan W.

    Advanced Member

  • Members
  • PipPipPip
  • 153 posts

Posted 14 October 2011 - 10:07 AM

But it will light, so "it won't work" is a wrong statement. "You should not do it" is a true one. (Also, it's engineers that adhere to specs, scientists test the limits ;)) To make it clear: I agree with what you said in http://forums.netdui...dpost__p__19163 but I don't agree with you "It is not possible" and "you can not" statements, because it is very well possible - if there is even one case where it does work, "It is not possible" is a wrong statement.
I believe that no discovery of fact, however trivial, can be wholly useless to the race, and that no trumpeting of falsehood, however virtuous in intent, can be anything but vicious.
-- H.L. Mencken, "What I Believe"

#16 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 14 October 2011 - 10:22 AM

But it will light, so "it won't work" is a wrong statement. "You should not do it" is a true one.

That's is totally correct from a philosophic viewpoint.

Here the people aren't seeking for statement correctness, but for concrete guidelines to make their circuits working well (and reliably I'd add).
Cheers
Biggest fault of Netduino? It runs by electricity.

#17 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 14 October 2011 - 11:00 AM

Hi Stefan, Mario: Your contributions here are very much appreciated. I'm a bit worried that this thread might seem confrontational to some folks. We want to ensure that the community is a place where everyone feels safe and welcome. Can we start another (unrelated) conversation thread that everyone can benefit from? Thank you both, Chris P.S. The electronics industry is, by-and-large, moving to 1.8V/3.3V from 3.3V/5.0V. Even the new Arduino Due has lost 5V tolerance...so as a general rule I personally recommend using 3.3V electronics where possible.

#18 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 14 October 2011 - 11:35 AM

I apologize for my "passionate" way to express my opinions. I also would love to avoid any useless discussion, whereas not constructive. Cheers
Biggest fault of Netduino? It runs by electricity.

#19 Valkyrie-MT

Valkyrie-MT

    Advanced Member

  • Members
  • PipPipPip
  • 315 posts
  • LocationIndiana, USA

Posted 10 April 2012 - 05:41 AM

Mario, So, if I were to use a 2.2K pull up resistor on SDA and SCL with a pull down resistor of 4.7K, that appears to produce an output voltage of about 3.4V. I assume this is basically a voltage divider. I wired it up and the Netduino appears to work fine and the output voltage (3.4V) is close to the 3.3V. Is a voltage divider an acceptable way of using a 5V I2C device with the Netduino? Or is there something I am missing? Thanks, Valkyrie-MT

#20 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 10 April 2012 - 11:37 AM

What a shame on me reading this thread! Hello Valkyrie. A voltage divider made by resistors is fully acceptable. Saying Ru and Rd the pull-up and the pull-down, respectively... the resulting voltage is: Vdiv = 5 * Rd / (Ru+Rd) = 3.4 V using the values you describe. the parallel of the resistor is: Rp = Ru*Rd / (Ru+Rd) = 1.5k your solution is fully equivalent to hanging a Rp=1.5k pull-up to a Vdiv=3.4V supply. Hope it helps. Cheers
Biggest fault of Netduino? It runs by electricity.




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.