Are the internal pulldown resistors on Teensy 3 for digital input only (not analog)?

Status
Not open for further replies.

billtubbs

Active member
I assume the answer to this is yes (only for digital input) since I can't find any reference to using a built-in pull-down resistor on the analog input pins here or here or on this forum.

If someone could confirm that, it would be great, before I go ahead and permanently install a 10k resistor onto my project.
thanks.

[I'm using a Teensy 3.1 and a light sensor and here is my test code at the moment:

Code:
// Reads analogue signal on pin A0 every second
// and sends the value to serial port

// Define display refresh rate (ms)
#define INTERVAL 1000

// Pin number for on-board LED
#define BOARDLED 13

void setup()
{
  Serial.begin(38400);
  
  // Setup pins
  pinMode(BOARDLED, OUTPUT);
}

int val;

void loop()                     
{
  val = analogRead(0);
  Serial.println(val);
  
  digitalWrite(BOARDLED, HIGH);
  delay(50);
  
  digitalWrite(BOARDLED, LOW);
  delay(INTERVAL - 50);
}
]

160108photo_teensy.jpg
 
Last edited:
Thanks @tonton81 but can you please confirm exactly how to implement that in the code? Do you mean use pinMode(14, INPUT_PULLDOWN); in the setup() part of the code? Will that add a pulldown resistor to analog input A0 then? That's what I wasn't sure about because normally you don't need a statement in setup() when using analog inputs. You just use analogRead().
 
Sounds like two things going on in this..

1) You can use most of the Analog pins as digital pins. In these cases you can enable the internal Pull up or down resistors as mentioned.

2) You are using the Analog pin for Analog input. In this case I am not if you can or would want to enable the PU on the port register. Normally when I use analog inputs there is a voltage coming in from the circuit I am trying to read in... You might be able to by going to Port Pin config register and enabling PORT_PCR_PE.

But wonder what you would do this for?
 
Normally when I use analog inputs there is a voltage coming in from the circuit I am trying to read in... You might be able to by going to Port Pin config register and enabling PORT_PCR_PE. But wonder what you would do this for?

I'm not too good with electronics but I was reading a tutorial on using a light sensor and it suggested using a 10k resistor in series with the light sensor. I think this is to avoid excessive current/power drain if the resistance of the light sensor drops too low. This works well and I'm happy to implement it (as shown in the photo above) but then I heard about internal pull-up/down resistors and wondered if I could avoid using an external one (less soldering).

So that is what I am trying to use this for. Please advise!
 
you said "series" 10k, that is neither pullup nor pulldown... if its in series with the pin its not a pullup, so you do need to keep it, id recommend using a 220ohm instead of a 10k in series, thats more of a pin protection
 
you said "series" 10k, that is neither pullup nor pulldown... if its in series with the pin its not a pullup, so you do need to keep it, id recommend using a 220ohm instead of a 10k in series, thats more of a pin protection

Okay. Sounds like I don't know what I am talking about... I guess I need someone to tell me how to do this.

Here is the tutorial that I was following that lead me to the idea that I needed a pull-down resistor. I don't know if "in series" or "pull down" are the right words to use but the diagram in this tutorial is exactly how I have the sensor and 10k resistor connected right now.
 
a photocell .. okay I will recommend you keep the 10k pulldown as the intrnal one is not of same value, and may affect your analog readings...
 
Status
Not open for further replies.
Back
Top