CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Powering external devices from a PIC pin
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Powering external devices from a PIC pin
PostPosted: Tue Jul 07, 2015 12:45 am     Reply with quote

In a previous low power design I used a logic-level FET as a high-side
switch to control power to external circuits. I'm aware that PIC pins
can be used to directly supply Vdd to external chips. I'd like to consider
this for a new design. Has anyone ever done this ?

In earlier years, I was told "one way to kill a gate is to hang a large cap
on it". Normally I put a 100 nF capacitor on the Vdd pin of every chip.
But if the PIC is supplying Vdd through an i/o pin, well... 100 nF seems
terribly large to put on a PIC pin. I'm afraid that over a period of time
it would damage the PIC pin. Does anyone have any thoughts on this ?
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jul 07, 2015 5:00 am     Reply with quote

I did the 'power from a pin' thing for a well data logger 15 years ago but quickly changed to the LLFET in version 2. The Vout of the pin wasn't the same for every PIC,which then varied the Iout, which then didn't give the peripheral enough suitable electrons.
My vote is to stay with a known, reliable LLFET on a somewhat bigger PCB. Overall, you'll have a great product and a good nights sleep after the product goes out the door.
Yes it costs a few pennies more BUT in the long run keeping clients happy with solid,reliable products is more important!

Jay
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Tue Jul 07, 2015 5:40 am     Reply with quote

I would do this:

Put the cap you need from the I/O pin to ground , with your proposed actual load circuit, as it will be built. But use a capacitor an order of magnitude LARGER yet than the final design requires. I'm personally not so fearful about the cap size if the circuit is not being switched at high frequency in operation.

In test version A) (baseline)
switch the pin on (static) and measure the PIC internal resistance from Vdd to your selected pin by comparing Vdd with the Pin voltage and doing the ohms law calc on the difference ( knowing your load current of course)

in part B) (stress)
start cycling the power with a test program at as high a frequency as you can that still allows the PIC output pin voltage to reach 90% or so of peak static value.
run this for as long as you can - and from time to time recheck the static value of I/O DC from your output pin.

If the part does not fail, overheat or increase in internal path resistance, i would commit the design, even though my first instinct is to go with Jay.

But it is obvious that you would not be considering this unless it is important.
My solution is do the most demanding test you can and then decide.

As Feynman said " only experiment can determine the truth"
Words i live by. Take that Proteus/Isis
Very Happy Very Happy Very Happy
newguy



Joined: 24 Jun 2004
Posts: 1899

View user's profile Send private message

PostPosted: Tue Jul 07, 2015 7:26 am     Reply with quote

Is it possible to turn your idea on its' head? Instead of switching Vdd to the slave circuit, permanently connect Vdd (and a good sized cap as well), but switch the ground side of the slaved circuitry directly with a PIC pin.

The only reason I say this is that it's been my experience that most PICs I've dealt with are more effective at sinking current rather than sourcing it.
guy



Joined: 21 Oct 2005
Posts: 291

View user's profile Send private message Visit poster's website

PostPosted: Wed Jul 08, 2015 12:35 am     Reply with quote

Quote:
most PICs I've dealt with are more effective at sinking current rather than sourcing it.

Agree, but disconnecting the ground from a circuit could cause lots of trouble if the circuit is still connected to the powering circuit in a different place (i.e. wet vs. dry connection). If you have communication lines between the circuits it will make a mess and you must switch Vdd. Even then, the circuit might still be powered by mistake through communication lines or pull-ups.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Wed Jul 08, 2015 12:51 pm     Reply with quote

disconnecting the GROUND side of any 74HC(T) parts can be a problem when the gate outputs are connected to other "live logic" BTW.

PCM_P has it right in the high side only switching concept. The only viable concept IMHO.

R: "The Jay way" - been there too .

I looked up what i had done a while back in a perhaps similar circumstance where i wired up a Zetex BCW66H npn transistor as a simple emitter follower with the collector tied to +5V Vcc ( same as the PIC) - driven w/o a base resistor to source 500ma to a load and only measured a .25v drop across the saturated part in my test circuit.
This ONLY works with certain NPN parts - and the exact reason was never examined once we had ONE part number that did.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed Jul 08, 2015 1:34 pm     Reply with quote

Realistically the obvious question has not been asked. How much is this circuit going to draw?.

I've powered things off the PIC, but using CMOS circuits at low speed, that draw small fractions of a mA. You have to look carefully at the Voh specs of the particular chip. Lots of modern ones only specify their Voh up to about 4mA, and beyond this it is undefined. Then the capacitance across the chip is to handle the instantaneous switching current changes. If the device is only running slowly, and switching into low capacitance loads, then the capacitance needed across the supply can be quite small.

Do a basic test. If the circuit can be powered and run fed off a 500R resistor, with a 100nF suppression capacitor, and run correctly, then he PIC can supply it. If not, then 'think again'.

Add a diode from the pin supplying the circuit reverse biased to the supply. What kills a logic pin 'feeding a large capacitor', is not charging the capacitor, but the capacitor feeding back into the supply through the internal diode structure, when the supply goes off. The current then can exceed the capabilities of this structure... :(
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jul 08, 2015 5:46 pm     Reply with quote

The current is 4ua on average for the Sharp memory lcd LS013B4DN04.
The lcd is updated once per second, and the 4ua includes power used for
that update.

The MPL3115A2 uses 2 ma for a few usecs during a conversion. At the
lowest resolution a conversion takes about 6ms. One conversion is done
per second. The rest of the time it's in standby mode and uses 2ua.

The PIC's Vdd is 3.3v (but possibly could be designed in at 3.0v).
The PIC is 16LF1847.

A good technical page on the MPL3115A2 pressure/altitude sensor.
http://flightcontroller.blogspot.com/2015/04/a-quick-introduction-to-mpl3115a2.html
Click on "Newer Post" at the bottom for more pages.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Thu Jul 09, 2015 2:05 am     Reply with quote

Though it having it's own regulator helps, it's the 10uF bulk capacitor, recommended on the supply pin, that is definately going to cause worries....
It's the transition from a couple of uA, to 2mA, that is nasty. I'd suspect the switch on times for this are quick, which is why the 10uF....
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Jul 09, 2015 8:15 am     Reply with quote

If you can stand a 5+ msec initial turn on RAMP for the device,
i would simply use a 33uf Tantalum cap @10v rating and connect it to your power sourcing pin through 100 ohms.
PEAK current per good old Mr. ohm can not exceed ~25 ma no matter what
happens on the capacitor decoupled load side .
A 4.7v zener acoss the capacitor cinches the matter.

Since the data sheet says
" internally regulated by LDO" and 1.9v is the low end of allowed inlet Vcc

IN all this
i assume the accuracy of the reading does NOT depend on stable Vcc - just enough capacitor stored energy to be staying above 1.9v during the (brief) demand cycle for power.

you will know if the cap has enuf energy storage to do the job by test.
I'll bet better than even money this will work for you...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 10, 2015 12:03 pm     Reply with quote

Standby mode is only 2ua on the MPL3115A2. The main reason for
wanting power control is to reset the MPL device in case it locks up. This
happened to me a few days ago during testing. The MPL3115A2 didn't
respond to i2c commands. I fixed it by power cycling the board.
I know there is a published method of reseting the i2c bus by clocking
the SCL line, but I don't trust that it will cure all lockups. See section
2.7 Bus Reset, in this Freescale appnote:
http://cache.freescale.com/files/sensors/doc/app_note/AN4481.pdf
Another problem with this method is that no explanation is given on
how to repeatedly cause a lockup, so that the reset method can be tested.
When the MPL3115A2 on my board locked a few days ago, I didn't know
what caused it. I still don't. It was during a development/testing session.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Fri Jul 10, 2015 1:05 pm     Reply with quote

Realistically, if all the devices you want to power off, can use the same power line, then the safe/simple answer is a single FET.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Fri Jul 10, 2015 1:16 pm     Reply with quote

or if you have to force it low and then high with a sharp edge.....

a complementary symmetry NPN-PNP MMBT3904/3906
driver totem pole with zero base bias --
to charge/discharge that capacitor in snappy fashion.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Jul 10, 2015 2:35 pm     Reply with quote

OK, maybe I'm showing my age but overall this sounds like a small battery powered device that ain't drawing a lot of current in 'run' mode to me so... why not just use a higher capacity battery? These days you get a LOT of electrons in a small space for a great price that could very easily offset the R&D $$$ and production costs of rejigging 'this and that', adding a few things just to save a wee bit of power.
Just asking... though I know you've probably thought about it.

Jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 10, 2015 2:53 pm     Reply with quote

There are size limitations on the battery. The largest size we can use
would be a 3.6v lithium 1/2 AA, and they range from 950 to 1200 mAh.
The goal is at least 5 years of battery life.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group