SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By ttabbal
#45712
Image

It's a simple PIC based transmitter board for the general TX modules SFE sells. Nothing special, but just in case I missed something I'd love someone to point it out.

One thing I'd like a comment on, I have this circuit on a breadboard but it won't run when I apply power. I have to connect the PICKit2 debugger to get the code to execute. I do have MCLR pulled high through a resistor, but I seem to be missing something. The breadboard is running on the internal oscillator, not the resonator shown.

Also, for Q1 I was thinking of using a 2N2222. I have a 2N3904 on the breadboard but I don't have any 2222's around. Any reason it won't work? I was going to order some 2222's for another project and would like to keep the part variety down.
User avatar
By leon_heller
#45714
You have the collector of Q1 connected to ground! I don't see why you need to buffer the output, anyway.

Leon
By ttabbal
#45718
Q1 is switching the transmitter module on and off via the ground line. C is connected to the GND of the transmitter, with E to the circuit ground. It works on the breadboard unless I have something very wrong. I suppose I could put it on the high side with C going to RF-VCC and E to the transmitter VCC pin. That should work, right?

TX is connected directly to DATA. I wanted to power the transmitter only when I have something to send, so no need to have it transmitting all the time wasting power and sucking up the channel.

Now that I look at it again, those pin labels are misleading. They are not net names. I need to fix up that symbol.
User avatar
By leon_heller
#45719
I don't think that Q1 will work with the base tied to ground with that 1k resistor. Also, high-side switching would be better.

Leon
By ttabbal
#45721
I tied it to ground to force it low when the PIC wasn't driving it yet (bootup and such). I suppose it doesn't really matter, but it does work on the breadboard. It might not be the best way and could be causing other problems I guess.

Why is high-side switching preferred? Transistors are not my strongest area. :) I posted a while back about controlling a relay with a PIC and people here suggested the arrangement I used (low-side switch with base pulled low). If it's not the best way, I'd like to understand why so I don't do it wrong again.
By Philba
#45725
I would think a better approach would be to use a PMOSFET to switch Vcc.

Switching ground with an NPN will decrease the amount of voltage the device sees by something around .7V. That may not be a big deal for you but you did go to some effort to get a seperate voltage to the transmitter. By the way, you have RF-VCC and VCC - they look to be the same.
By saipan59
#45730
If you do low-side switching, your code should ensure that TX is not driven low when the xmtr is not powered. It might be possible to damage the xmtr, because the data input becomes negative wrt ground.

I have a working circuit to do the same thing (power-control for a TLP434A xmtr module).
I used a 2N3906 (PNP) as a high-side switch, with the base driven by a 2N7000 (or 2N7002) going to ground. A total of two transistors and two resistors. It works great.
My circuit also includes an SA630 to automatically switch the antenna between the xmtr and rcvr modules.
The xmtr switch is driven by a 555 timer, which is triggered by the transmit data, so the PIC does not have to use a pin to turn on the xmtr: When the PIC sends data, the 555 turns on the xmtr and sets the antenna. When there has been no data for a half second or so, the 555 turns the xmtr off and switches the antenna back to the rcvr.

Schematics and code are here:
http://www.geocities.com/saipan59/PIC/stackable.zip

Pete
By riden
#45731
If your transmitter is the ASK type (where the transmitter is keyed on and off), you probably can get away with always powering the transmitter and key the data line. Measure the current drawn by the transmitter when it isn't being keyed and see if it is within your parameters. Of course, you need to be careful not to turn on the transmitter when you don't want to send data -- hence the reason for the transistor. If that is a concern, you could use a PNP transistor instead (emitter to +5, collector to TXData) and key the transmitter in that manner since the PIC I/O pins power up as inputs (floating or weak pull-ups).
By ttabbal
#45747
saipan59 wrote:If you do low-side switching, your code should ensure that TX is not driven low when the xmtr is not powered. It might be possible to damage the xmtr, because the data input becomes negative wrt ground.

I have a working circuit to do the same thing (power-control for a TLP434A xmtr module).
I used a 2N3906 (PNP) as a high-side switch, with the base driven by a 2N7000 (or 2N7002) going to ground. A total of two transistors and two resistors. It works great.
My circuit also includes an SA630 to automatically switch the antenna between the xmtr and rcvr modules.
The xmtr switch is driven by a 555 timer, which is triggered by the transmit data, so the PIC does not have to use a pin to turn on the xmtr: When the PIC sends data, the 555 turns on the xmtr and sets the antenna. When there has been no data for a half second or so, the 555 turns the xmtr off and switches the antenna back to the rcvr.

Schematics and code are here:
http://www.geocities.com/saipan59/PIC/stackable.zip

Pete
Thanks for the info. It's a lot more complex than what I'm doing, but it helps. Well, sort of. I get using a PNP for a high side switch. I don't get the FET driving the base of that PNP. What's going on there?
By ttabbal
#45748
Philba wrote:I would think a better approach would be to use a PMOSFET to switch Vcc.

Switching ground with an NPN will decrease the amount of voltage the device sees by something around .7V. That may not be a big deal for you but you did go to some effort to get a seperate voltage to the transmitter. By the way, you have RF-VCC and VCC - they look to be the same.
Well, the idea is that I can run the transmitter from 5V from the regulator or from BAT+ which will be either 9V or 12V. That's where the jumper comes in. It sounds like the ground switching has problems that I didn't consider for active devices. Can you show me an example of using a MOSFET as a high side switch? By "PMOSFET" do you mean a P-Channel device?

I do want to be able to turn the transmitter off when I'm not transmitting. The UART idles high so if I don't turn it off, it is always transmitting.
User avatar
By bigglez
#45757
Greetings (No First Name Supplied),
ttabbal wrote:It's a simple PIC based transmitter board for the general TX modules SFE sells. Nothing special, but just in case I missed something I'd love someone to point it out.
(1) If this is an EAGLE schematic, check that net ground isn't
shorting Q1 collector to ground
(2) Floating the Tx ground to shut it off will only work if you
don't have other ground paths (is the antenna cable floating or
grounded?), and the Tx data line can tolerate being negative
wrt Tx switched "ground".
(3) If the battery is higher than the Vcc line, and you wish to
power the Tx from either, an ORing diode or similar arrangement
is required.
(4) A high-side switch will solve these problems, and can
be either a PNP or P-ch PMOSFet (Power MOS Fet).
(5) A P-ch PMOS Fet will only require a pull-down to
ground by the uC output, to conduct. But, due to the
possibility of the battery being higher than the Vcc rail,
a second transistor or open collector logic stage is required.
(6) The transitor will work as drawn (1k0 to ground is
okay, but a higher value resistor would save valuable
battery power).
(7) A 2N2222 and a 2N3904 are very similar for this
application. A 2N3906 or similar PNP would be required
for the high-side driver unless a P-ch Fet is used.

Much of this was discussed by others (once you clarified
your original needs). Do you need a schematic?

Comments Welcome!
By saipan59
#45772
I don't get the FET driving the base of that PNP. What's going on there?
It's really there to act as an inverter, because the output of the 555 is the opposite of what I needed. The 555 configured as a 1-shot will have its output High when data is moving, but the base of the 2N3906 needs to be Low.
If you were driving the transistors from a PIC pin, then including the FET allows the Vcc for the xmtr to be different from the PIC's 5V supply (I think you mentioned the need to run the xmtr from 9V or 12V ?). Without the FET, the PIC pin is sinking current that originates at 12V. Your original design (with low-side switching) avoids this issue.

FYI, a possible variation on my circuit:
Change the CMOS 555 to the traditional bipolar type (which has much greater drive capability), and let the output of the 555 provide power to the xmtr module *directly*, eliminating both transistors. You get the benefit of the "automatic xmtr power-on/off", you don't need to use an extra PIC pin, and the overall circuit is rather simple.

Pete
By ttabbal
#45773
bigglez wrote: (1) If this is an EAGLE schematic, check that net ground isn't
shorting Q1 collector to ground
It's not. The GND label you see there is a pin name. I've changed the library to remove those to prevent exactly that confusion. If nothing else, it would probably confuse me later. :)
bigglez wrote: (2) Floating the Tx ground to shut it off will only work if you
don't have other ground paths (is the antenna cable floating or
grounded?), and the Tx data line can tolerate being negative
wrt Tx switched "ground".
(3) If the battery is higher than the Vcc line, and you wish to
power the Tx from either, an ORing diode or similar arrangement
is required.
That's irritating. I can see now why one would not want a low side switch for anything more than a simple load.
bigglez wrote: (4) A high-side switch will solve these problems, and can
be either a PNP or P-ch PMOSFet (Power MOS Fet).
(5) A P-ch PMOS Fet will only require a pull-down to
ground by the uC output, to conduct. But, due to the
possibility of the battery being higher than the Vcc rail,
a second transistor or open collector logic stage is required.
(6) The transitor will work as drawn (1k0 to ground is
okay, but a higher value resistor would save valuable
battery power).
(7) A 2N2222 and a 2N3904 are very similar for this
application. A 2N3906 or similar PNP would be required
for the high-side driver unless a P-ch Fet is used.

Much of this was discussed by others (once you clarified
your original needs). Do you need a schematic?
So, something more like this? If so, what is a good value for R2? And why can't one switch a higher voltage load by just applying the control signal from the MCU to the gate of the PMOSFET? It seems like I should be able to use a pull-up resistor on the gate of the MOSFET then use the MCU pin to drive it low turning on the switch. You mention it specifically, so I'm sure there is a good reason. I'm just trying to figure out these parts.

Image
By saipan59
#45775
Hi,
You have Q2 upside-down. As drawn, the FET's body diode will cause the xmtr to be powered up all the time. And you need a resistor (say 10K) between Q2's gate and 5V (in the line directly above Q1). Without it, Q1 will 'pop' when it turns on. And, you want the new resistor to go to VCC-RF, not to 5V.
For Q1, I would use a 2N7000 (N-channel FET). Then you can eliminate R1 and R2.

Pete
By saipan59
#45777
That may have been confusing - let me restate my suggestions:

Swap the drain and source on Q2.
Eliminate the connection to 5V.
Add a 10K resistor from the gate of Q2 to VCC-RF. This will keep Q2 'off' when Q1 is 'off', regardless of the voltage at VCC-RF.
Change Q1 to a 2N7000 (with the Source on the ground side), and eliminate R1 and R2.

Pete