Help with a silly stupid simple circuit....

Thread Starter

crackinx

Joined Jun 6, 2017
10
Ok, so I'm going to start off by saying I am in no way an EE, I have built quite a bit of small circuits in my time, but this issue is driving me nuts. With that being said here is the story. I have a rasberry pi with an HS38BD IR sensor, I have a separate IR power board to shut the system down, and for the sake of being tidy I am attempting to only use one IR sensor. I started with the easiest route and just bridged the signal lead between the 2,
crack_direct_pin.png
this almost worked it functions correctly with the pi and the other board will power off the system, now the issue is that when the pi powers off it drops the GPIO pin to ground, so now the power board can not see the signal. So next I tried to use an N-channel MOSFET as sort of a switch to cut the signal off after the PI has powered down
crack_FET_set.png
and this has not worked at all. I know there is a simple solution to this and just can't seem to figure it out.

Thanks in advance!

Moderators note : copied images from site, it does not allow direct linking
 
Last edited by a moderator:
I'm not sure but I reckon the Raspberry Pi input will go high resistance when the board is turned off so shouldn't affect the signal, but is there a pull up resistor on that pin. If so, that only works when the board is on.

Otherwise, just connect the IR sensor output to 2 buffers (logic gates, op amps or transistors) and the outputs of the buffers to each board
 

Thread Starter

crackinx

Joined Jun 6, 2017
10
Yes, there is a pull up on that pin of the PI, I'm not 100% sure how to use buffers like you are saying, I have a bunch of 2n4401 transistors that I could use, but again not sure how I would work them as a buffer. Thanks so much for the help


So something like this?
 
Last edited by a moderator:
Exactly like that, but connect a 10k (for example) resistor from the emitter to the 0V rail

But don't forget that can only source current not sink, so if there's a pill up resistor on the pin connected to the transistor emitter the voltage on that pin during a logic 0 input will not be 0V

Pill up? Pull up sorry!
 
Last edited by a moderator:

Thread Starter

crackinx

Joined Jun 6, 2017
10
I will have to play with this more. I have hooked up a test circuit and it seems the pin on the pi is high, and the signal pin on the ir pulls it low. I was thinking it was the other way round and the ir was sending voltage as a signal, is is not.

I think I will try an NPN transistor. Emitter to ground, collector through the load to the positive supply. A 10K resistor at the base to limit current and isolate the circuit from the load. Because all I have to do is cut the connection to the pi when it is off
 
Last edited:
Just try disconnecting the Pi board from the IR detector & see if the power board still works. If it doesnt connect a pull up resistor between the +ve rail (make sure you don't connect it to a supply rail of higher voltage than logic 1 on the Pi board) & the IR input of the power board leaving the Pi disconnected. Try 10k again. If the power board works now connect it all back together & it should work

The problem with using an npn transistor with the emitter to ground is that it inverts the data ie a logic 1 input gives a logic 0 output. But you might be able to configure your software to cope with that

Or use 2 transistors, connect the base of the 1st (Tr1) to the IR detector via a resistor, its emitter to 0V, its collector to the base of the 2nd transistor (Tr2) with a pull up resistor to the +ve rail, the emitter of the second transisitor to 0V and its collector to the Pi. With a logic 0 input the Tr1 is off, Tr2 is biased on via the pull up resistor, taking the pi input to logic 0. Logic 1 input turns Tr1 on, Tr2 goes off so the pi input floats high. I can't draw it at the moment cos Im walking the dogs!
 
Last edited by a moderator:

Thread Starter

crackinx

Joined Jun 6, 2017
10
I think I understand what you're saying, and will give it a try on the test board. My concern with that is (and I could be wrong) you're no longer sending the ir signal to the pi, but basically copying it from the base and inverting it then copying and inverting it back again. I would be worried about signal degradation and not having the pi recognize the inputed ir hex code, but only one way to find out!
 

crutschow

Joined Mar 14, 2008
25,645
....I would be worried about signal degradation and not having the pi recognize the inputed ir hex code,.........
That's the beauty of digital processing.
As long as the circuit can detect a distinct 1 or 0 for each bit, degradation of the signal doesn't affect the signal information or signal recovery.
 
That looks fine, you could increase the value of the 1k resistor especially if you're on battery power. Is your IR receiver just a photodiode or is it a module with built in signal processing? If it's just a diode you may need to couple it to the 10k resistor via a capacitor to remove the dc component due to background infrared
 

Thread Starter

crackinx

Joined Jun 6, 2017
10
It is not on battery, but I did intend to have that a 10k resistor, and it is a 3 pin ir receiver with signal processing, the app I used to crush that out real quick only had a symbol for a 2 pin LED.
 

Thread Starter

crackinx

Joined Jun 6, 2017
10
Well that didn't work, it seems to not pull the signal to the pi, I tried it with pull up, pull down, and neither on that pin of the pi via software. I think that maybe a simple diode may work to stop the back flow to the pi when it's off.
 

Thread Starter

crackinx

Joined Jun 6, 2017
10
SUCCESS!!! a single diode cathode towards the pi did the trick. I now have full functionality of everything. thanks so much for all the help!
 
Turns out I wasn't much help. Odd though, as those transistor circuits would have given complete isolation. But that suggests the pi needs an input that sources current and the pi sinks the current. That's not consistant with the pi input having a pull up resistor and being at logic one until pulled down by the input because the diode actually prevents that happening. But this should mean that your first single transistor circuit, collector to +ve and emitter to Pi input should work. Tho not necessary, if you get a spare moment it might be worth just trying that circuit quickly to see if it works. It is of course possible that the input to the pi has been damaged and isnt behaving normally. Ive had odd behaviour from microcontrollers in the past when Ive damaged input ports without realising, usually by putting a voltage above the supply rail on them
 

Thread Starter

crackinx

Joined Jun 6, 2017
10
I don't think the PI is not behaving normally, if I remove the power board and just hook up an IR sensor the way it should be, everything works perfectly. Not sure why this works with a diode blocking voltage from the pi, I would assume myself that the pi does not output to any pins while in a power off state with the power board hooked up. It cuts the power off fully, so it's not like the PI is in a low power state...
 
Top