IO34 & IO35 with Reed Switch & ESP32

ESP Lover
Posts: 5
Joined: Tue Aug 27, 2019 12:37 am

IO34 & IO35 with Reed Switch & ESP32

Postby ESP Lover » Sat Sep 28, 2019 1:17 am

So I know IO34 & IO35 are read only on the ESP32. However, when I try to attach a reed switch to the pins, I'm unable to read anything but a 0. Using them as interrupts doesn't work either. Moving the reed switch to pins IO32 & IO33 works fine. You can see the 10k resistor attached to the reed switch in the schematic.

Any idea what I need to do to get those pins to work?

I'm not doing anything more than the following to read them:
Serial.printf("REED_NC: %d\n", digitalRead(REED_NC));
Serial.printf("REED_NO: %d\n", digitalRead(REED_NO));
Attachments
reed.png
reed.png (3.04 KiB) Viewed 7614 times

mikemoy
Posts: 627
Joined: Fri Jan 12, 2018 9:10 pm

Re: IO34 & IO35 with Reed Switch & ESP32

Postby mikemoy » Sat Sep 28, 2019 10:03 pm

From your schematic, this is not how you want to wire up your pull up resistor.
Doing it this way can cause the pins to pick up stray interference because they are floating.
Also, why use 2 IO pins when you can use one to do the same thing.
Tie REED_NC to +3.3v, and tie REED_NO to GND. From the Com. side of the reed (the side you have going to 10k then to +3.3v) take that to your input pin.

TomWS1
Posts: 21
Joined: Wed May 01, 2019 2:50 pm

Re: IO34 & IO35 with Reed Switch & ESP32

Postby TomWS1 » Sun Sep 29, 2019 12:03 pm

mikemoy wrote:
Sat Sep 28, 2019 10:03 pm
Also, why use 2 IO pins when you can use one to do the same thing.
Tie REED_NC to +3.3v, and tie REED_NO to GND. From the Com. side of the reed (the side you have going to 10k then to +3.3v) take that to your input pin.
Good suggestion, but considering that the reed switch will always be positioned on N.O. OR N.C. pin, wiring just one pin is sufficient to know which.

mikemoy
Posts: 627
Joined: Fri Jan 12, 2018 9:10 pm

Re: IO34 & IO35 with Reed Switch & ESP32

Postby mikemoy » Sun Sep 29, 2019 1:20 pm

TomWS1 wrote:
mikemoy wrote:
Sat Sep 28, 2019 10:03 pm
Also, why use 2 IO pins when you can use one to do the same thing.
Tie REED_NC to +3.3v, and tie REED_NO to GND. From the Com. side of the reed (the side you have going to 10k then to +3.3v) take that to your input pin.
Good suggestion, but considering that the reed switch will always be positioned on N.O. OR N.C. pin, wiring just one pin is sufficient to know which.
If you wire just one pin you will need to add a pull-up / pull-down resistor to the circuit. Otherwise there will be no way to detect the changed state.

ESP Lover
Posts: 5
Joined: Tue Aug 27, 2019 12:37 am

Re: IO34 & IO35 with Reed Switch & ESP32

Postby ESP Lover » Sun Sep 29, 2019 11:35 pm

The pins are tied to deepsleep wakeups. I need the ESP32 to wake up when either state is selected. So, I'm not just monitoring the state, I'm using it for an interrupt.

Who is online

Users browsing this forum: No registered users and 55 guests