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

Disable Pull-up resistors


  • Please log in to reply
23 replies to this topic

#1 Marius

Marius

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationCenturion RSA

Posted 07 November 2010 - 04:59 PM

Hi All Does anybody know how to disable the pull-up resistors on the Analog input pins. The standard library does not seem to do so and unless the pin is driven very hard, the voltage reading is never correct.
If at first you don't succeed, then try and try again.

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 07 November 2010 - 05:27 PM

Hi Marius,

I just looked at the AnalogInput code in the Netduino firmware, and it disables the pullups when the AnalogInput is enabled. [I also hooked up an LED to the analog pin to make sure that the pull-up resistor turned off when the AnalogInput was turned on.]

void AnalogInput::ADC_Enable( CLR_RT_HeapBlock* pMngObj, UINT32 param0, HRESULT &hr )
{
    // ...

    if (channel < 4)
    {
        // switch this GPIO pin to the alternate B function (ADC)
        AT91_GPIO_Driver::DisablePin(param0, RESISTOR_DISABLED, 0, GPIO_ALT_MODE_2);
    }

    // ...

}
A few questions to help figure out what's going on:
1. Which AnalogInput pin are you using?
2. Are you using a Netduino or Netduino Plus? Rev A or Rev B?
3. If you open up all 6 analog inputs and wire the other 5 to Ground, does your sensor still give weak readings?

Chris

#3 Marius

Marius

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationCenturion RSA

Posted 07 November 2010 - 05:39 PM

Chris, I am using A0 for a humidity sensor an A1 for the LM35. The Netduino revision is REV A and I dont think it is a PLUS. It looks like the one on the your web page. I have tied all the remaining inputs to ground, no change.
If at first you don't succeed, then try and try again.

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 07 November 2010 - 05:42 PM

Chris,
I am using A0 for a humidity sensor an A1 for the LM35.
The Netduino revision is REV A and I dont think it is a PLUS. It looks like the one on the your web page.
I have tied all the remaining inputs to ground, no change.


Marius,

Could you also create AnalogInputs for each input A2-A5 (while still tying them to ground)?

Also, what are the exact part #s of your two humidity sensors? And what do you have hooked to your AREF pin header (specifically)?

Chris

#5 Marius

Marius

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationCenturion RSA

Posted 07 November 2010 - 06:49 PM

Chris I enabled all the analog inputs and tied them to gnd. No change. The humidity sensor is a HMZ-333A.I attached the data sheet.

Attached Files


If at first you don't succeed, then try and try again.

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 07 November 2010 - 07:03 PM

Marius, How do you have your circuit hooked up? The humidity sensor in the datasheet is a 5V analog sensor and the LM35 is a 4V+ sensor. The Netduino's microcontroller is 3.3V. It tolerates 5V digital inputs, but analog inputs are limited to 3.3V. Anything over 3.3V can theoretically damage the board. How do you have your circuit wired? Are you using a set of resistors as a voltage divider to cut down the voltage? Or have you wired the sensors to the 3.3V power header? Chris

#7 Marius

Marius

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationCenturion RSA

Posted 07 November 2010 - 07:07 PM

Chris, They are wired directly but if you look at the data sheet you will see that the Humidity sensor cannot have an output higher then 2.5v. Both devices are powered by the 5v rail with the outputs connected directly to the analog inputs. I tested the inputs recently with a pot and they worked just fine so I dont think there is any damage at this time
If at first you don't succeed, then try and try again.

#8 Marius

Marius

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationCenturion RSA

Posted 07 November 2010 - 07:09 PM

Chris, Sorry I meant to add. The humidity sensor is connected to A0 and the reading is 100% correct always. The output from the humidity sensor is however driven by a chip on-board.
If at first you don't succeed, then try and try again.

#9 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 07 November 2010 - 07:14 PM

So just to make sure I understand this correctly... 1. The humidity sensor is working fine. 2. The temperature sensor is the one you've getting bad readings on. Is that correct? If so, let's build something really simple which just involves the sensor that's having troubles. Chris

#10 Marius

Marius

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationCenturion RSA

Posted 07 November 2010 - 07:23 PM

Chris I done that already. My prognosis is that the pin is pulled up. I say this because - the higher the voltage from the LM35, the closer it gets to the correct voltage. The lower we go the more does the LM35 struggle to pull the pin down. The error gets bigger. I did test that pin with a pot and it works fine. Oh and I did change the LM35 as well. This problem is particular to a device that does not drive the pin hard, I think. Am I the only idiot with this problem or has nobody used the LM35 in this configuration before? I remember using the LM35 with an opamp before but as I recall it was to improve the scale and offset not really the drive. I dont know the cpu that well to make any good suggestions but I am fairly convinced that the pin is pulled.
If at first you don't succeed, then try and try again.

#11 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 07 November 2010 - 07:29 PM

Marius, The A1 pin header is attached directly to the analog input on the Netduino's MCU. Do you have a multimeter? Can you measure the voltage between the pin header and ground when it's being used as an analog input? Your analog sensor does need to drive some sort of voltage--or else the analog input will be "floating" and you'll get bad readings. It's possible that there are some minimum requirements in the AT91SAM7X datasheet. Chris

#12 Marius

Marius

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationCenturion RSA

Posted 07 November 2010 - 07:33 PM

Chris, That is just the thing. What I measure on the pin is what the sensor gives but the reading is substantially lower than what is presented on the pin. Strange I know.
If at first you don't succeed, then try and try again.

#13 Marius

Marius

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationCenturion RSA

Posted 07 November 2010 - 07:36 PM

Sorry Chris, the reading is not lower but higher.
If at first you don't succeed, then try and try again.

#14 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 07 November 2010 - 07:49 PM

The LM35 seems to have given folks some trouble... I don't have one so I don't know how to fix it. Marius: what if you used a fairly high ohm pull-down resistor? It almost seems like very small output current of the LM35 has nowhere to go. Instead of the cpu acting like it has a pull up resistor, it simply has too high of a resistance to sink the current away. This is all wild guessing on my part.

#15 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 07 November 2010 - 07:53 PM

LOL i was going to link to the previous thread about the LM35 in case there were some hints ... but it's your other thread...

#16 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 07 November 2010 - 08:47 PM

Chris,
That is just the thing. What I measure on the pin is what the sensor gives but the reading is substantially lower than what is presented on the pin. Strange I know.


Sorry, I meant to measure the output on the pin...to see if there's any voltage being driven (via a weak pullup resistor) when the temperature sensor was not attached.

Chris

#17 Marius

Marius

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationCenturion RSA

Posted 08 November 2010 - 03:57 AM

Chris, Yes, 1.2v on any analog pin that is not connected. I also noticed that if I use more that one pin, they influence one another. I left the system overnight with just the LM35 in and it seemed to be ok. The temp reading went down lower that before but as soon as I add anything else the reading actually drops. So this is the latest findings: If I activate all analog inputs it make a difference If I earth the unused pins the reading is stable If I use only one pin at a time the reading seems OK.
If at first you don't succeed, then try and try again.

#18 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 08 November 2010 - 04:03 AM

Okay, that's really good info. The analog inputs will influence each other if there's not current driving the other ones to a particular level. The official recommendation for chips like this is to put all other analog inputs to ground if they're not being used. This should alleviate the "influencing each other" issue. Chris

#19 Marius

Marius

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • LocationCenturion RSA

Posted 08 November 2010 - 04:09 AM

Chris, The only problem is now I can only use one input. As soon as I put the second sensor on, the reading changes. It goes lower. I have also put 50ms delay between reading the pins but no change there.
If at first you don't succeed, then try and try again.

#20 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 08 November 2010 - 09:46 PM

Have you tried using a pull down resistor? Quickly looking at all the example circuits on the datasheet for the LM35, it looks to me like they have some kind of path to ground. Also, according to the neduino processor datasheet, only AD0-3 have pull up resistors, A4-7 do not?




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.