Blocking 5V inputs until board power is present?

Hi all,
I’m building a project to use a GemmaM0 to turn on/off a sound bar when the TV is turned on and the Sound Bar is on/off. So I’ve got two inputs on the GemmaM0, one from TV, one from Sound Bar, going through a pair of voltage dividors (1.2k + 1.2k) to make sure the inputs don’t see more than approx 2.3V from the 5V coming out of each device’s USB port. The Gemma then uses an IR LED to send power toggle commands to the Sound Bar to turn it on or off, depending on whether the TV is on or off. Works pretty darn well except for a couple of minor problems.

The first problem I have with my bread board test unit is that if the Gemma is not powered by it’s 5V USB input, the TV and Sound Bar seem to back-feed power into the Gemma and it gets confused, seeming to power up into a wierd half-state.

So when I designed an actual PCB using KiCAD, based off the GemmaM0 breadboard layout, I added in a pair of transistors to the input path from the two 5V sources, so that they would only be enabled when the 3v3 pin on the Gemma was enabled. The schematic below will make it clearer what I was trying to do:

But for some reason, I’m always seeing approximately 1.2V on the input pin, no matter whether or not I have 5V on the input pin. So I must have done something totally wrong in my layout, but I’m not sure what. And here’s a shot of my PCB layout, sorry it’s a bit crowded. The whole idea is to make it all fit into a GemmaM0 footprint so I can stack them with standoffs to make it look really nice.

So my questions are:

  1. Is there a better way to pull all inputs to 0V until the GemmaM0 is powered up and ready to read the inputs?
  2. Do you see anything wrong in my schematic for how I’m doing this? Right now I use the 3v3 pad for turning on/off my input transistors (the bottom two in the schematic).
  3. Should I be instead just using Diodes to clamp down the inputs to the range I want? I basically just want a binary signal whether there is 5V coming in on the two inputs from the TV and SoundBar, and I figured transistors made the most sense.
  4. Should I have put a resistor inline with the Base of the two input Transistors to limit the current there? When I put a 1.2k resistor in there, it dropped the voltage in my new breadboard test setup, but didn’t seem to make any other difference. But I admit I didn’t measure the current through it.

Any suggestions would be appreciated! And I’ll be happy to share my KiCAD PCB base of the GemmaM0 layout if others wanted to use that as a template for other projects.


Another option would be to use opto-isolators. That would solve both the level shifting, and the need to avoid back-powering the Gemma by accident.

1 Like

That might be the solution, especially if I can find a dual channel through hole module, then I could replace two of the transistors and four of the resistors. The 5V inputs from the TV and Sound Bar should have more than enough amperage to run the OptoIsolators.

Ideally I’d like to not care which pin the 5V and GND on the input side are, so that wiring and hooking up the connections is trivial… time for some reasearch!

I just did a search on Digi-Key, and here’s one, for example.

I think you would still need two resistors, though: each input would need a current-limiting resistor for the LED.

The outputs also need pull-up resistors, but I assume the M0 has internal pullups that can be turned on, so you wouldn’t need to put resistors on the board for that.

You could put a bridge rectifier on each input, before the opto-isolator, but I don’t know if you have enough space on the board to put two bridge rectifiers.

Or, since the inputs are ultimately coming from USB, another possibility would be to put two through-hole micro-USB connectors on your board, and then just use USB cables to wire everything up. Then there would be no possibility of getting the polarity wrong.

Yeah, using the Micro USB connectors (though hole!) should work pretty well if the 8 pin DIP for the Dual OptoIsolator takes up less room than the four resistors and two 2N3904 Transistors I used before. I’ll have to try to make it work and see how it all fits.

But… I’m still not sure why my original PCB layout is mucked up like this. I must have done something wrong and I just don’t see it properly.

Does your circuit work correctly when you breadboard it?

As long as your PCB passes DRC, it should faithfully match the schematic. So I would be very surprised if there is an error in the layout, if the schematic is correct and it passes DRC.

Use SMD. Don’t worry about assembling it. I have switched from standard resistors to 1206 when only they become accessible for me. As soon as 0805 were offered I switched to them and later to 0603. So since I suppose 1997 I use mainly 0603, and those times it happened to assemble them by hand. IC with raster higher then probably 0.8mm is also rather easy to assemble by hand.

Very, very interesting input. It has 1.2V even when it has 5V. Miracle?

Use a part like the 74HC4050 buffer. This has an unusual input protection with no diode to Vdd, so 5V inputs don’t power the board

@Nia_Mishra I see we have the same history even living probably at oposite sides of globe :slight_smile:
And what about 0402?

A good magnifying glass and tweezers!

After just doing my first surface mount soldering by hand ( PissOff project, neat stuff!) I’m not nearly as terrified of doing this type of work.

So right now I’m thinking I’ll get some LTV-827 dual optoisolators in a 8 pin DIP package to do some testing and playing around. Or maybe the NTE3223−2 would do the trick too. I’m not too picky really.

Thanks for all the input!

Hmm… that’s interesting as an idea, but I don’t think it’s quite what I want. I suspect that going with an Optoisolator is really the path I should take for resiliency. But thanks for the input! I’ll certainly look over the data sheet more closely and try to figure out how it would work.

Ideally I want something I just just drop in iwthout any external components if at all possible, because I’m short on space. Though going Surface Mount for some parts could work…


While your internal device is unpowered, there is nothing that pulls the transistor bases to ground. Just add some resistors.

I can not make sense of what you talking about input, output, and the schematic make it event more confuse to me that are you talking about. All be BJT configuration don’t seem to make sense. And what are J* for ? Short Jumper? …

I think you get the “wierd half-state” because your divider resistors are too small.
Make them 50K (and if too high try 22K) and I think that’s the simplest solution you can have.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.