Sharing input/output GPIO without frying anything

hertugen
Posts: 10
Joined: Thu Jan 06, 2022 10:22 am

Sharing input/output GPIO without frying anything

Postby hertugen » Fri Jun 16, 2023 6:47 am

Hello experts.

Newbie here. I have this little project, which I'm working on - it features an ESP32-WROVER, as well as a e-ink display.
It wakes up, updates the screen every hour, then goes back to sleep.
Image

My problem is that I would like to add an interrupt-based, freely programmable button or maybe even a 5-point joystick, which should "do something", like show the next/previous page, but all usable pins seems to have been taken and since the chip contains FSRAM, fewer are available than usual. Datasheet can be found here: https://www.espressif.com/sites/default ... eet_en.pdf

Is it possible to hijack pins, used for the screen? Since the software controls, when a screen is drawn, I thought about configuring pins as inputs per default and change to output when the screen updates. Is this the "usual way"? I mean, it won't potentially cause short circuits or anything, if the screen updates and the button is pressed at the same time? If so, which pin would you use? Can I just use TDX0/RXD0 freely, as long as the chip isn't flashed?

If I go for a 5-way joystick, what would you recommend? Some kind of multiplexer, so that I only need one GPIO?

General recommendations, hints and do's and don'ts would be really appreciated.

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: Sharing input/output GPIO without frying anything

Postby ESP_Sprite » Fri Jun 16, 2023 8:43 am

Are you using SENSOR_VP/SENSOR_VN for anything? Those can be (input-only) GPIOs. You might be able to use the datalines to the EPD as well if the EPD doesn't drive or ground them when it's sleeping; if you're afraid of the buttons shorting the lines if you're sending data, you can add some small resistors (1K or so) between the buttons and the data lines.

hertugen
Posts: 10
Joined: Thu Jan 06, 2022 10:22 am

Re: Sharing input/output GPIO without frying anything

Postby hertugen » Sat Jun 17, 2023 8:54 pm

Hello ESP_Sprite

I'm not using SENSOR_VP/VN for anything anymore - thank you for pointing that out.
Also, yes I'm afraid to have a short circuit, so I might go for for your solution at some point, but I've decided to go for the simple solution without the 5-way joystick and just a simple button, so using the available pins should be quite adequate.

Thank you for your assistance.

MicroController
Posts: 1741
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Sharing input/output GPIO without frying anything

Postby MicroController » Mon Jun 19, 2023 7:58 pm

You could connect buttons to the data lines and GND via e.g. 5-10kOhm resistors. This protects against frying anything and should allow to switch the GPIOs to output for display data to input (with pull-up enabled) to read the button states. This may even provide enough headroom to not corrupt the data sent to the display if a button is pressed during transmission.

boarchuz
Posts: 610
Joined: Tue Aug 21, 2018 5:28 am

Re: Sharing input/output GPIO without frying anything

Postby boarchuz » Tue Jun 20, 2023 5:24 am

Conveniently, SVN and SVP are ADC pins, so you could also use one or both to handle all 5 inputs using ADC reads and carefully-sized resistors.

Who is online

Users browsing this forum: No registered users and 65 guests