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

Inter pin resistance


  • Please log in to reply
14 replies to this topic

#1 Rod Lopez

Rod Lopez

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • LocationSweden

Posted 13 April 2011 - 08:57 PM

Hi all, I am trying to debug a simple yet specially tricky situation, I am trying to measure both voltage and current going through a certain circuit. The voltage is no big deal, resistor divider: Vcc----1M---+A0---470k---GND ..and I measure across A0 and GND, all good. The problem is the current, I add an extra resistance, so things look a bit like Vcc----1M----+A0---470k--10---+A1----GND At that point, though I get a decent reading for current, my reading for voltage goes to hell... My guess is that the internal resistance between A0 and A1 is lower than I expected (acording to the change in result it should be around 500k), so that one would appear in parallel with the 470k resistance and kill my reading. I can throw an opAmp (or lower the divider's resistors)and be over with it fairly quickly, but I would like to make sure I understand what's going on. Does anybody know what the internal inter-pin resistance should be? thanks!

#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 14 April 2011 - 03:50 AM

Rod, I am not sure to understand the problem. Anyway, accordingly to the MCU datasheet, an ADC input have a 1uA leakage current, that is an equivalent resistance above 1MegOhms. The inter-pin resistance is the equivalent R from each input to a common ground (better call as "impedance"). That is the double of the value above. Your voltage divider could be modeled as an ideal voltage generator of about 1/3 of Vcc and a series-resistance of about 360K = 2/3 of 470K (parallel of 470K and 1M). Supposing the leakage resistance of the input is "exactly" Radc = 1M (just for simplicity), the actual voltage to the ADC is the result of another voltage divider: the 360K and the Radc. Is that the problem?
Biggest fault of Netduino? It runs by electricity.

#3 Rod Lopez

Rod Lopez

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • LocationSweden

Posted 15 April 2011 - 09:29 PM

@Mario: It has been a really strange trip that one. I have finally managed to get things running, but I'll look for a trivial case that can reproduce the error I've been having (maybe it is some combination of software and hardware) My basic assumption is that, under normal circumstances, connecting an analog pin to a circuit where another analog pin is connected shouldn't change the value returned by the first pin. That assumption was broken in my Netduino circuit (where as I was having perfectly valid reading on an Arduino version). One of the main issues, I think, is that the analog sampling happens in a given moment in time, and I have a couple of switching circuits that could be producing parasitic frequencies, with a bit of luck I ended up sampling a few of those peaks. Your answer made me rethink the whole approach and eventually to figure out what was going on :) I will, though, try to document the issue if I can get a good repro case, I am sure the guys at Secret Labs would be interested.

#4 Rod Lopez

Rod Lopez

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • LocationSweden

Posted 13 May 2011 - 09:27 AM

Finally I have had a bit of time to create a repro case.

What I have set up is very simple, an external power supply with a voltage divider (22k/10k), ground to Netduino ground and the divider being fed to an analog analog pin.
What I get is super funky:
-using any analog input but for a3 things seem to work all the time the way you'd expect.
-Reading from analog3 does actually (pretty much exactly) half the sampled value, but not only from the Netduino side (as in not a software-scaling problem), if you put a voltmeter to the divider, the divider's voltage does drop the moment the divider is connected to a3, otherwise the value is what you'd expect.
Is a3 special in any way? Is my board broken in the strangest manner? Qui lo sa? :)

#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 13 May 2011 - 10:11 AM

Hi Rod, That's really quite interesting. A3 should be pretty much identical to A0-A2...they're all digital pins with analog input. Is it possible that pin A3 has been overvolted accidentally or something like that? Chris

#6 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 13 May 2011 - 10:13 AM

@Rod: is it the +3.3V >= VRef >= Vin? Cheers
Biggest fault of Netduino? It runs by electricity.

#7 Rod Lopez

Rod Lopez

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • LocationSweden

Posted 13 May 2011 - 10:34 AM

Hi guys, Chris: That was my assumption too, it is good to know. An overload is definitely possible (though I encountered the issue from early on proting from an Arduino setup) I am dealing with both robotics and power sampling so it seems reasonable a cable would have touched something it shoudln't. One question on the "damage", what are the chances the issue might be consistent (as in, would I be able to add a multiplier to the incoming signal and sure, loose precision, but use the pin ) or can it become totally random? Mario: The ref is plugged to 3.3. Seems a bit funky to have to connect physically though, is there any way to wire those internally? Software maybe? I might be answering the wrong thing though, I don't quite get what you mean by "+3.3V >= VRef >= Vin" if I read that a-la software it doesn't quite make sense to me :)

#8 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 13 May 2011 - 10:46 AM

Hi Rod,

One question on the "damage", what are the chances the issue might be consistent (as in, would I be able to add a multiplier to the incoming signal and sure, loose precision, but use the pin ) or can it become totally random?

It all depends on the specific situation unfortunately. Do you have a consistent (yet adjustable) analog input source that you can test on A2 and A3 at various levels--and compare the results?

I know that we test every analog input after Netduinos are assembled but before they ship to resellers. We allow a small range, as we've found that sometimes analog pin readings can vary a bit from their neighbors--but they should be consistent within a pin.

Chris

#9 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 13 May 2011 - 11:51 AM

Rod, my question is whether the following constraints are satisfied: +3.3V >= VRef >= Vin It means that Vref must be not greater the MCU supply, that is +3.3V. Additionally, the voltage on any analog input must (should) not be greater than Vref. You've got reason: I missing a constraint! Vin >= 0 Avoid negative inputs on any of the pin (even normal ports). A tip, as long you may provide for. Assuming you have a decent multimeter, disconnect the voltage divider from the analog pin. Now set your multimeter to milliamps measurements: connect the positive (red) cable to the divider junction, and the black one to the N's analog input. How much current do you read? Cheers
Biggest fault of Netduino? It runs by electricity.

#10 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 13 May 2011 - 12:43 PM

Seems a bit funky to have to connect physically though, is there any way to wire those internally? Software maybe?

You only need the connection for Rev A boards. The Rev B boards connect to 3.3V automatically. There's a message in this thread to show you how to turn that off should you need to use an external reference.

Regards,
Mark

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#11 Rod Lopez

Rod Lopez

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • LocationSweden

Posted 13 May 2011 - 02:56 PM

Hi again! @Chris: The measured/real ratio seems to be fairly stable at 0.43 no matter how low or high the incoming sampled value is, can I take that as I-can-use-the-pin? Btw, I do have a similar but lower-scale issue with analog reading in other pins (ratio being around 6%) even in pins I have never used, is that within acceptable Netduino precision?. The offset also seems to change when the power drain through the Netduino (Vin->5V output) increases (about .8%) when drain increases from 5mA to 80mA. @Mario: I still don't get it, the way I read +3.3V >= VRef >= Vin is: 3.3v has to be greater or equal than VRef, which should be greater or equal than Vin, the signs should be the other way around, or am I a bit confused? The idea of checking the power drain was great, through a3 I get 0.2 mA, in other pins it is too low to measure (I am using about 1.3v) @Mark: Thanks for the tip, I have noticed that vRef connected-and-non-connected where giving me the same values and I was wondering if it was a coincidence or something. What you mention would make ton of sense. Btw, how do I know if I have a rev a or b board?

#12 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 13 May 2011 - 05:10 PM

Hi Rod, The revision is marked in the bottom-right corner of the boards. If you're getting consistent readings on the pin, you should be OK. If it's off a bit from where you except, use can the AnalogInput.SetRange property or a bit of math to compensate. And if for some reason you feel like your board is defective, the hardware does have a 30-day warranty when purchased from an authorized reseller. Chris

#13 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 13 May 2011 - 05:40 PM

3.3v has to be greater or equal than VRef, which should be greater or equal than Vin, the signs should be the other way around, or am I a bit confused?

Exactly what I mean and what the specs wants.
Why are you confused?

The current that you read is quite interesting.
You have connected a voltage-divisor made with 2 resistors: 10K and 22K.
After you write that the voltage read on a "working" input is about 1.3V.
We could idealize the circuit as an ideal voltage generator of 1.3V, with a series resistance of R1//R2 = 6.9K.
Now, if you read a current of 0.2mA flowing through the input pin, it means that we may calculate the voltage drop across the series resistance:
Vr = I * R = 0.2m * 6.9K = 1.3V (approx)
It seems to me that *all* the voltage available is dropping on the equivalent resistance. In practice, the input looks at a short to the ground.

You may try another test, even it is not a good practice.
Detach the "defective" input pin and also another "working well".
Be sure to unplug the Netduino and it power supply too.
Use your multimeter to Ohms measurements, let's say for a 2K resistance.
Now, try to measure the resistance between ground (black wire) and one of the inputs (red wire).
If you read a resistance very low on the defective pin, it means it is probably blown.

Cheers
Biggest fault of Netduino? It runs by electricity.

#14 Rod Lopez

Rod Lopez

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • LocationSweden

Posted 17 May 2011 - 02:51 PM


3.3v has to be greater or equal than VRef, which should be greater or equal than Vin, the signs should be the other way around, or am I a bit confused?

Exactly what I mean and what the specs wants.
Why are you confused?


The reason why I am confused is that it sound like Vin is to be 3.3 volts or lower, which isn't enough to feed the Netduino in any case. That's what +3.3V >= VRef >= Vin tells me, anyway.

Btw, I did measure the resistances of all the pins, across ground and different pins, the input resistance returned by the multimeter is very high (non-measurable really). My guess is that some magic inside the AD has gone off, possibly not blown (I can measure in a fairly deterministic way) but definitely not in the right range.

There's one thing that puzzles me, though. It feels like the Netduino reports a lower voltage than it should. It is normally a bit lower (in any pin) than the voltage reported by either power source or multimeter, but, as the load increases (let's say the LCD screen that's fed by the Netduino goes on), the voltage reported by the Netduino decreases much faster than what's reported by the multimeter.
We are not talking about massive value offsets, mostly in the order of one-two tenths of a volt; but I am keeping track of battery charge and it gets sensitive to small voltage changes :)

#15 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 17 May 2011 - 03:12 PM

Now I understand! "Vin" is the label used as the power supply! I am *really* sorry: I mean "V-input" of the ADC port...shame shame on me! OK...better in late than never... Cheers PS: as latest test, try this (if you didn't yet)... detach the failed input from the voltage divisor and connect together to the another ADC input that is working well. What do you read on both the ADCs? What do you read by measuring the voltage on the inputs couple? Re-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.