two sources to control a inputpin (by ISR)

Hi all,

i have a nextion enhanced HMi and a ESP32 in one project
at a certain time i push a momentary button to signal the ESP32 to do something for me (start a routine), but on the nextion enhanced there is also a extension board with 8 GPIO pins on it (also at 3.3v high level output mode, thus the same as the ESP32 high level output from a button)

Is it safe to just connect the button and the output signal from the nextion extension board to the same one pin on the esp32....?
so i can choose to push a button or do the same thing on the display with the same effect...
or do i need to put diodes at some point to prevent the high signal going from the button to the nextion or vice versa...
i am just affraid that the 3.3v from the nextion would harm the ESP32, or the 3.3v from the button would harm the nextion, as the two signals come together at one and the same input pin on the ESP32.

all grounds are connected to the same 12v power source and some step-down modules to provide the different voltages i need (12v,5v,3.3v) in this project.

Hope i explained this clearly... :slight_smile:

Grtz,
Yves

If they are both powered from the same 3.3V, yes you can share the button.

Hi MarkT,

Well the nextion is powered on a 5.0v source, the ESP32 also, but the button is powered directly from the ESP, and that's on 3.3v (but al the gear is powered from one single 12v source), on top of that the nextion give's a 3.3v output on the GPIO's (so that's actually the same voltage as the ESP32)

I thought it would do no harm, since everything is on the same GND rail...

I just was not sure if a 3.3v pulse from the nextion GPIO outputpin would harm the ESP32 buttonpin (set as OUTPUT), and if the 3.3v pulse from the ESP32 button output would harm the nextion GPIO outputpin (also set as OUTPUT), as both of them are configured as output GPIO's

since both nextion GPIO outputpin and the ESP32 buttonpin are set in output mode... the only pin set on input mode is the ESP32 pin that receive's a pulse (from the button OR from the nextion) to start a routine.

Grtz,
Yves

Naamloos.jpg

Well, you obviously cannot connect two outputs together. That's it.

Perhaps you need to describe in more detail, what you are actually trying to do.

And you makes some reference to interrupt service routine. You do not use interrupts to monitor pushbuttons or switches; that suggests you do not understand what you are doing at all.

Hi Paul,

in fact the ISR was a mistake to mention, as my ISR's are in fact used to monitor a photosensor and certainly not to monitor buttons (i use digitalRead() to trap that pulse). Sorry, my mistake.

If i cannot put two (or more) different outputs together on one input than my question is fully answered...
my thought was that i had to use diodes to prevent a pulse from one output pin going into another output pin, and so only to arrive at the input pin (see attachment in lower post)

Thanks,
Yves.

Well, I said you cannot connect two outputs together.
Your diagram e164ebd55d1491c4cb61776bac8bdb0630705caa.jpg uses unconventional symbols which do not necessarily mean anything to us.
Yes, you can "diode-OR" two outputs into another input with due care. You need to provide a pull-down at the input if the diodes are "pointing" toward it, or a pull-up if pointing away. For CMOS logic a 47k resistor will be quite sufficient. A pull-up always needs to go to the Vcc of the device to which it is an input, while you cannot use diodes "pointing toward" a device input, if the output device has a higher Vcc than the input device.

So your description was very confused! You mentioned a button as well and I see it somewhere in that diagram, but I am not sure what it is supposed to do and whether you have one ESP32, or two, and why. Mind you, I have no idea what a "Nextion" is either - it is a good idea to explain what such things are.

Perhaps have another go at explaining the project with an full description of the nature and function of each part.