• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Will this circuit work

lew247

Member
I've been told this circuit will not work and I need to use an opto isolator as there is no ground for the transistor
The chip is a pic32
I say it will work fine it's a simple switch, the transistor conducts and the ground is the other end of the module, in this case a HC-12

[/URL]
 

MikeMl

Well-Known Member
Most Helpful Member
Assuming that the processor is a CMOS chip powered from 5V, the highest voltage any port pin will pull to while sourcing a couple of mA to the base of the NPN through R4 is about 4.8V. R4 is not needed, so leave it out.

You will loose another 0.7V as the base-to-emitter drop on the '3904, so the highest voltage you will ever get to pin 4 of HC-12 will be 4.8V - 0.7V = 4.1V. Is that enough? Probably not!

How much current does the HC-12 require? At what voltage?

The correct approach is to use a "high side PMOS" switch circuit. Can you reverse the logic on the port pin such that it is "low" when you want the HC-12 to be powered?
 
Last edited:

lew247

Member
It's a 3.3v pic 32 chip
The module will work from anything between 3v and 5.4v

The transistor is working as a simple switch, to switch the 5v supply to the module on or off

IF it won't work anyone got a better circuit?
 

MikeMl

Well-Known Member
Most Helpful Member
Ok, so you left out so much information on your first post so as to make my response mostly guesses...

When high, the PIC port pin will struggle to get above 3.2V while sourcing the base current. That means (best case) 3.2V-0.7V = 2.5V for the HC-12.

Since you didn't answer the question about how much current the HC-12 requires ( I had to guess) ...here is a "High-Side-Switch" which delivers up to 100mA @5V when driven from a 3.3V PIC port:

360.gif
 
Last edited:

MikeMl

Well-Known Member
Most Helpful Member
How about this one?
What happens if the COM1:RX and/or COM1:TX pins are driven low at the PIC end while the 2n3904 is off?
 

lew247

Member
Com1 is just a simple serial port
It won't be receiving any data - it will only be transmitting data when pin 16 is driven high
even if it was receiving, it wouldn't be listening unless pin 16 goes high
 

MikeMl

Well-Known Member
Most Helpful Member
What does the (5V) denoted on the PIC pins mean?
 

lew247

Member
Sorry the pic is 3.3V powered by a 5V battery and regulator
The 5V line is the 5V battery line

The 5v on the pic pins can be ignored, it just means they are 5v tolerant
 

lew247

Member
granddad I don't get what you mean
I'm using the transistor as a simple on/off switch to power the HC-12 from the 5v line

The tx/rx wont be working unless pin 16 goes high

HC-12 is an RF txd and rxd module (transmits serial data over 433Mhz)


 

MikeMl

Well-Known Member
Most Helpful Member
Also, if the HC-12 is powered from 5V, dont you need level-shifters in the RX and TX lines if the PIC is running on 3.3V?
 

lew247

Member
I've tested the HC-12 by powering it direct from 5V without using a transistor or switching it from the pic and it works fine
it's only the switching circuit I'm having problems with

ALL I need to do it turn the power to the HC-12 on and off with the pic pin

The 5v tolerant pins can be ignored, pretend that the wording isn't there!
 

granddad

Well-Known Member
The 3.3v PIC32 TX , RX will be ok with the 5v level of the HC12 as long as the pic is powered...I have seen RX port signals try to power the device .
 

granddad

Well-Known Member
Lew If the HC12 5v was off , ( no ground path ) a low from pic TX signal may try to power the HC12, Why do you need to switch the HC12 power, ?
 

lew247

Member
To conserve power
Both the HC-12 and a GPS module with be "powered on" by pins on the pic32 chip
The reason is - its battery powered and the battery is solar charged and its in a remote location where no mains power is available
 

lew247

Member
Lew If the HC12 5v was off , ( no ground path ) a low from pic TX signal may try to power the HC12, Why do you need to switch the HC12 power, ?
I could set both the tx and tx pins either high or low via software so the HC-12 will never be powered on unless it's told to
 

Latest threads

EE World Online Articles

Loading

 
Top