Safe to apply positive voltage to an output GPIO held low? - Page 1
Forum section: electronics / beginners

author: SlowBro
author_rank: Regular Contributor
timestamp: October 30, 2017, 02:28:00 am
content: I've got an ESP8266 (ESP-12F) that I would configure some GPIOs to be an output held low, connected to an L9110S H bridge. And I also have a SPDT switch with +3.3V that will also activate the H bridge manually. This is to provide a manual override for the logic coming from the ESP, so that the user can manually operate the motor in whatever direction.According to the datasheetthe L9110S can handle this situation, but what about the ESP? Can the positive voltage coming in to the GPIOs held low fry the chip, or should I add diodes to the GPIOs to protect against this situation?Here is theFalstad schematic. Also attached a screenshot of the Falstad.

author: Ian.M
author_rank: Super Contributor
timestamp: October 30, 2017, 02:50:00 am
content: You can't pull an output pin high if its set low without risking damaging it. If the current you apply is less than the maximum current its rated to sink when low, the pin wont go high enough to reach a valid '1' level, and if its greater you risk blowing it. Switching a 3.3V rail directly to the pin will probably blow it.You'll have difficulty meeting the L9110S input threshold requirements if you use diodes. Noise immunity will certainly suffer. Either put a logic gate in between the ESP8266 and the H-bridge to combine the MCU and switch signals, or use a DPDT switch to switch between applying the output pin and 3.3V to the H-bridge input.

author: Mjolinor
author_rank: Frequent Contributor
timestamp: October 30, 2017, 05:39:58 am
content: Unless you have a lot more things going on just connect the switch to the ESP on a different IO line and have your software drive the H bridge.I just abandoned using the L9110. Even with a 4.7 K resistor in series with the two PWM lines the H bridge blew the ESPs. I had a quick look to see why, that's why I ended up going as high as 4.7K but couldn't find why, I just went for BTN7060s instead.

author: SlowBro
author_rank: Regular Contributor
timestamp: October 30, 2017, 12:09:21 pm
content: By the way the switch is to be a manual override for the logic control coming from the ESP. I'll update the OP to reflect this.It does make sense to have the ESP listen to the switch. Ties up two more GPIOs but I should havejuuuuuuuustenough.Also I'm not married to that particular H-Bridge. I'll consider alternatives such as the BTN7060.

author: Mjolinor
author_rank: Frequent Contributor
timestamp: October 30, 2017, 12:17:59 pm
content: Why two IO lines? It only needs one unless I am not understanding what you are doing which is quite likely.

author: SlowBro
author_rank: Regular Contributor
timestamp: October 30, 2017, 12:24:36 pm
content: Quote from: Mjolinor on October 30, 2017, 05:39:58 amI don't understand why you had an issue. The L9110 is used by many people. I myself have run it a few times on an ESP, a Pi, and an Arduino Pro Mini 3.3V. Its input is CMOS, according to the datasheet. Maybe needed more than 4.7K? I just put it bare on my Pi the other day, no resistors, and it ran like the wind.

author: SlowBro
author_rank: Regular Contributor
timestamp: October 30, 2017, 12:50:00 pm
content: Quote from: Mjolinor on October 30, 2017, 12:17:59 pmThe manual override switch permits running the motor in either direction, up or down. (The motor controls a door that goes up and down.) So there are three states: Up, down, or off.

author: SlowBro
author_rank: Regular Contributor
timestamp: October 30, 2017, 01:58:10 pm
content: I see where there was some confusion. Newbie error. I said DPST switch when I meant SPDT. Edited the OP.

author: ahbushnell
author_rank: Frequent Contributor
timestamp: October 30, 2017, 02:11:06 pm
content: Quote from: SlowBro on October 30, 2017, 02:28:00 amuse two diodes to make a diode "OR" gate. Connect one to the switch and one to the output of the ESP.Andy

author: SlowBro
author_rank: Regular Contributor
timestamp: October 30, 2017, 04:34:59 pm
content: Quote from: ahbushnell on October 30, 2017, 02:11:06 pmThat was my initial thought, but Ian.M said, "You'll have difficulty meeting the L9110S input threshold requirements if you use diodes. Noise immunity will certainly suffer."However, the input threshold is 2.5V and if I use a Schottkysuch as thiswhich has a Vf Max of 340mV @ 1A (and even more at these lower currents) which gives me an input minimum of 2.84V. The output from the ESP is 3.3V, which gives 0.46V of buffer, at least.That leaves me with the second comment of noise immunity. I don't know if I'm vulnerable to this? The motor isn't driven by PWM; it's just full on, full off. Does running at the low end of the L9110S input voltage range mean that my motor will run at a lower speed? Both the GPIO and the motor are rated for 3.3V.A concern with an OR gate the manual override can set one side of the bridge to high and the other side can be set by the ESP as well, leading to both being high at the same time. This isgenerally not recommendedwith H-bridges but the truth tablein the datasheetdoesn't seem to have a problem with it. It describe a situation with both high and the output is both are low.I should have posted a schematic. Will update the OP.

author: Mjolinor
author_rank: Frequent Contributor
timestamp: October 30, 2017, 05:01:33 pm
content: Quote from: SlowBro on October 30, 2017, 12:24:36 pmI don't understand either but it was getting expensive trying to work out why.I will go back to it and work out what it was but like all the things that are £1 off ebay there is a high possibility that the thing is not built / designed correctly so first stage would be to draw out the PCB of the ones I have. Not something I can feel any enthusiasm for right now.

author: SlowBro
author_rank: Regular Contributor
timestamp: October 30, 2017, 05:08:29 pm
content: Here may be an option. I added some P-FETs on the switch inputs to cancel out the GPIOs, and the aforementioned Schottky diodes protect the GPIO from back feed on the switch.Voltage drop across the FET will be minimal because of the two 1MOhm resistors.Falstad circuit. See also the attached.Still have the question about noise immunity as mentioned by Ian.M. I don't know if I'm vulnerable to this? The motor isn't driven by PWM; it's just full on, full off. Does running at the low end of the L9110S input voltage range mean that my motor will run at a lower speed? Both the GPIO and the motor are rated for 3.3V.

author: SlowBro
author_rank: Regular Contributor
timestamp: October 30, 2017, 05:10:06 pm
content: Quote from: Mjolinor on October 30, 2017, 05:01:33 pmThere you go, it may have been faulty from the start. Anyways I'm not expecting you to work it out. If you have something that works go for it.I may switch out the driver for aZXBM5210-SP-13. Looks like it has a lot of intelligence built-in, for not much more cost.

author: Mjolinor
author_rank: Frequent Contributor
timestamp: October 30, 2017, 09:51:54 pm
content: Making assumptions here that you are using the ESP for a daylight open, nighttime close automatic operation with a manual override for whatever reason, foxes about etc etc.If so then as you have the wifi in there anyway why not use an android app to allow the manual override.

author: SlowBro
author_rank: Regular Contributor
timestamp: October 31, 2017, 12:20:32 am
content: I will do that too, but the idea is the person standing next to the device can control it right there. I think it will work to setup listeners on the pins and just run them through that.

author: Mjolinor
author_rank: Frequent Contributor
timestamp: October 31, 2017, 09:50:53 am
content: So a three way rotary switch then, up, down, auto and just disconnect the IO lines when in the appropriate positions.

author: Ian.M
author_rank: Super Contributor
timestamp: October 31, 2017, 10:22:12 am
content: So add a single button and a beeper or LED for confirmation and handle it in software.The operator on the spot can see the door state so you don't need multiple controls.Use a short press to interrogate the system and it reports its status by a LED flash code or beep code. Medium press for open/close (it reverses the current door state) and resumes the program at the next scheduled events, very long press to lock out the program and hold the door in the current state, and medium press again to return to the program from previously locked out, without changing the door state

author: SlowBro
author_rank: Regular Contributor
timestamp: October 31, 2017, 01:52:13 pm
content: Quote from: Mjolinor on October 31, 2017, 09:50:53 amHow would you disconnect the IO lines?

author: Ian.M
author_rank: Super Contributor
timestamp: October 31, 2017, 02:07:43 pm
content: If you want to go the rotary switch route, you'd need a two pole three way break before make switch (probably a 5 or 6 way one with the end stop set for three ways). You'd use one pole for each H-bridge input, and switch it between logic '1' or logic '0' (tied low) in the end positions for up and down and connected to the MCU output pin in the center position for auto. Depending on your limit switch setup, you might need to run the up and down position logic '1' feeds via a pole in the limit switch with a pulldown resistor so it cuts off at the end of the door movement.You can also get DP3T toggle switches which are electrically equivalent to the above rotary switch, and far easier to weather seal - just add a rubber boot over the toggle, though its advisable to protect the boot from direct sunlight.