Almost all pins are HIGH - not just on startup but constantly?

Started by espethuser, March 08, 2023, 06:42:31 PM

Previous topic - Next topic

espethuser

I'm trying to wire up two AM312 PIR sensors to a single ESP32-POE. By chance I hooked up my first one to pin 35 and it works flawlessly. The second one I hooked up to a few different pins, including pin # 13, but the sensor always reads 'HIGH'. Testing with a multimeter I found the GPIO pin is always HIGH. I tried setting the mode in Esphome to pullup:false but this wasn't allowed to compile. In testing I've found that the ONLY pins on the board which aren't HIGH constantly are 35, 32, 33 and 04. I am so confused.

I've tried attaching a 10K resistor between the pin and ground and this has the effect of lowering the voltage, but only by a small amount. It doesn't seem to be a floating pin. The pin mode is set to INPUT, not INPUT_PULLUP.

Anyway. I am very confused.

Thank you

LubOlimex

Overall I'd recommend checking the schematic. Some of the pins are pulled up. Check the schematic around the UEXT you can see four pins pulled up:

Same around the SD card connector you can see pins pulled up.

If you wish to remove a pull up, simply unsolder the resistor that is on the pull up...

If you wish to convert pull up to pull down place 1/10 of the resistor value of the pull up and connect to GND. For example, if R31 is 2.2k if you place 220Ohm to GND on the same line it would become a pull down.
Technical support and documentation manager at Olimex

espethuser

Thanks LubOlimex for answering. I guess I'll try  It's just confusing as I hadn't seen anywhere that the pins were sort of (semi)permanently hardware pulled up. I'm used to Arduino and Particle (formerly Spark) boards I guess where you can set a pin as input or output and it'll respond accodingly.

I was going via the PNG rather than the schematic and didn't see there anything suggesting that I would need to pull down pins with a physical resistor to make them usable.

There's no way I have either the skill or equipment to desolder those teeny tiny resistors without damaging the board so I'll give adding a 220Ohm resistor a go. I tried adding a 10K resistor and it lowered the voltage a bit, but not much.

Thanks again.

EDIT: Here's what gets me. When I configure pin 13 as a output (a switch), it's instantly 'LOW'. Something in software tells the pin to be low. Why am I not able to do that when using it as an input??

LubOlimex

> Here's what gets me. When I configure pin 13 as a output (a switch), it's instantly 'LOW'. Something in software tells the pin to be low. Why am I not able to do that when using it as an input??

Exactly because what we discussed before. There is pull up and when it is set to input it is affected by the pull up.

When it is set to output it is not affected to what is connected on it.
Technical support and documentation manager at Olimex

SteveMann

Quote from: LubOlimex on March 09, 2023, 09:16:15 AMSome of the pins are pulled up. Check the schematic around the UEXT you can see four pins pulled up

WHY??

The 2.2K pullup resistors on SDA/SCL are appropriate for most, but not all, I2C bus networks.
In an I2C bus you usually want the pullups closer to the I2C devices, not the controller. However this cripples GPIO13 and GPIO16 for any positive-true GPIO devices. This is simply the wrong place for I2C bus pullup resistors.

A hard pullup or pulldown on any GPIO pin makes that GPIO pin difficult to use and limits the usefulness of the board.

So, again, why?

LubOlimex

It had been our design choice for years due to the UEXT that allows customers to easily connect extension modules. We always place pull ups on UEXT I2C lines on our boards with UEXT. Also it is easier to remove pull up resistor than add one. You just place the soldering iron over the resistor for 1-2 seconds and scrape it away.
Technical support and documentation manager at Olimex