So I'm working on a project where I'm using two processors and one of the things that I want to do is use one bluetooth device and have two microprocs communicate with it or send data through it. Of course this is not at the same time.
One chip would be the main com device, the other would send stored data when instructed to. I don't want to use one device as a passthrough as this would seem a little inefficient. so I came up with a schematic of what I think might work.
If anyone has tried this or can look at the schematic and say, yes this will work, here is why, or no, that won't work because your thingy is connected to another thingy that won't do what you think it should do.
The schematic should speak for itself in terms of how it works but a quick over is such.
npn transistor. base is connected to both inputs and this base input is also tied to v+ through a pullup resistor to keep the signal high(serial active low so high is idle)
collector is connected to V+
emmiter is connected to the input of the BT serial device with a 10k serial resistor.
the two picaxes are connected to the serial input line through 2 diodes that are reversed. The idea is that when one of the picaxes communicates it pulls the line low both pulling the base of the npn low and also pulling the second serial line low along with it.
One thing I'm looking at is where the base and the pullup meet. should I add a resistor at the point where the npn base and the resistor meets?
So again, does this make sense, do people think this will work....
Hmm, I think I see a problem Or I completely mis-understand your circuit. Either is possible.
So your intention is that one of the Picaxe serial outputs goes Low, it will drop the voltage at the base of the NPN and turn it off?
Since the resistor between the collector and the base is the same value as the ones between the diodes and the serial interfaces, I think you have a voltage divider. When either serial 1 or 2 goes low, you have 0 volts (or close to it) at the bottom of the voltage divider. The diode will drop about 0.6V, of course, so that leaves about 4.4.V across the combined resistance of 9.2k.
V = I * R
4.4V / 9.2k = .48 mA
So the voltage drop across the upper resistor will be…
.00048 A * 4600 ohms = 2.2 V. The resulting voltage at the base will be 5 - 2.2 V = 2.7 V, which may not be enough to fully turn off your NPN.
If you lose the two resistors at the serial outputs, The voltage won’t divide. A low output will have the 0.6V from the diode added, but will likely be below 1V and will shut off the NPN. The 4.6k resistor at the collector should protect your serial output by limiting the current to less than 1 mA.
I see your point with the voltage divider issue which is why I mentioned adding a res around the base and the pullup. I haven’t done any calculations on any of the components yet but your input is what I needed to really look at that area. From your response I understand what you’re saying so I’m pretty sure you understood what I was getting at.
I was actually pondering my first design(not shown or explained) while in bed prior to getting ready for work and realized it would fail completely since it didn’t seperate the two signals from the uprocs correctly. This design came from rethinking it in about 10 mins then drawing it on my whiteboard. I figured I would miss something but the overall idea and logic seems to make sense, no?
Thanks for the input btw, I appreciate it and will look at the resistor values later today/eve/tomorrow/when Ihave more time.
Well, what happens if both uProcs try to signal at the same time? There doesn’t appear to be any protection for that. Or more correctly, the NPN will repond to either signal indiscriminately, so you could wind up with interference.
Maybe some sort of circuit that gave priority to the main processor. Something that the main processor can release when it has nothing to send?
This is something that I’ve planned for in code so this shouldn’t be an issue. I have a flow chart, a list of accepted commands/handlers and plan on doing a lot of testing of this.
The code and wiring schematic will also be available when I’m done.
One thing that comes to mind (apart from what ignoble mentioned regarding the two 4.6kΩ resistors) is that there’s no pull-down resistor on the output line. If your serial input device is using a buffer or other high impedance input (very likely) then the input might take some time to drop low, even after the NPN is turned off. An extra pull-down resistor would just make sure that the voltage drops immediately when desired.
I just realized I didn’t number the components to ident them easier…first time using that app and I’m used to have it auto numbered…
anyway, when you refer to the output are you saying at the emmiter on the npn? If so would the pulldown be before or after the res thats currently there? Third question, really??? I’m not sure I’m understanding how that would work.
I’d put the pull-down resistor between the emitter pin and ground, before the 10kΩ resistor. That way there’s no drop in the voltage delivered to the serial input device, but you’ll be able to maintain a higher baud rate without errors.