question about PIC drain

Started by Phil March 25, 2004
I was curious about current draw on the PIC so I set up a couple of
test cases and measured the current. My test setup uses a 16F628A,
crystal and an LED on the PWM pin. I use PWM to the LED. With PWM
at 0 duty, the circuit is drawing 0.6 mA. with the PWM at 100% duty
its drawing 10.3 mA. Both of the duty cycles were confirmed with a
scope. I also tried a regular (i.e. non-PWM) output pin with the
same results. This is with a 3V supply and no dropping resistor on
the LED. I believe the LED is supposed to be drawing 20mA but
obviously not since it can only be drawing 9.7 mA. the LED by itself
will draw 60mA (briefly... lol). So, why isn't the LED drawing more
when connected to the PIC?

Phil



One other point - I tried a driver transistor in an emitter-follower
configuration to drive the LED and that draws what I would expect at
100% duty cycle - 22 mA.

Phil

--- In , "Phil" <phil1960us@y...> wrote:
> I was curious about current draw on the PIC so I set up a couple of
> test cases and measured the current. My test setup uses a 16F628A,
> crystal and an LED on the PWM pin. I use PWM to the LED. With
PWM
> at 0 duty, the circuit is drawing 0.6 mA. with the PWM at 100%
duty
> its drawing 10.3 mA. Both of the duty cycles were confirmed with a
> scope. I also tried a regular (i.e. non-PWM) output pin with the
> same results. This is with a 3V supply and no dropping resistor on
> the LED. I believe the LED is supposed to be drawing 20mA but
> obviously not since it can only be drawing 9.7 mA. the LED by
itself
> will draw 60mA (briefly... lol). So, why isn't the LED drawing
more
> when connected to the PIC?
>
> Phil




A LED may need as much as 2.2V to draw full current, add this to the 0.7V drop in the transistor
(1.4V if it is a Darlington) and maybe a 0.5V drop at the pin...and this may explain what you're seeing...you need more voltage.

Phil wrote:

 One other point - I tried a driver transistor in an emitter-follower
configuration to drive the LED and that draws what I would expect at
100% duty cycle - 22 mA.

Phil

--- In p...@yahoogroups.com, "Phil" <phil1960us@y...> wrote:
> I was curious about current draw on the PIC so I set up a couple of
> test cases and measured the current.  My test setup uses a 16F628A,
> crystal and an LED on the PWM pin.  I use PWM to the LED.   With
PWM
> at 0 duty, the circuit is drawing 0.6 mA.  with the PWM at 100%
duty
> its drawing 10.3 mA.  Both of the duty cycles were confirmed with a
> scope.  I also tried a regular (i.e. non-PWM) output pin with the
> same results.  This is with a 3V supply and no dropping resistor on
> the LED.  I believe the LED is supposed to be drawing 20mA but
> obviously not since it can only be drawing 9.7 mA.  the LED by
itself
> will draw 60mA (briefly... lol).  So, why isn't the LED drawing
more
> when connected to the PIC?
>
> Phil
 
 

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
 

--
*******************************************
VISIT MY HOME PAGE:
<http://home.online.no/~eikarlse/index.htm>
LAST UPDATED: 23/08/2003
*******************************************
Best Regards
Eirik Karlsen
 

Attachment (not stored)
C:\WINDOWS\TEMP\nsmailGN.gif
Type: image/gif

Attachment (not stored)
C:\WINDOWS\TEMP\nsmailTI.gif
Type: image/gif


If you instead of a bipolar use a CMOS with a 10K pullup on the gate you should get
the full 3V to the LED.
> A LED may need as much as 2.2V to draw full current, add this to the 0.7V drop in the transistor
> (1.4V if it is a Darlington) and maybe a 0.5V drop at the pin...and this may explain what you're seeing...you need more voltage.
>

--
*******************************************
VISIT MY HOME PAGE:
<http://home.online.no/~eikarlse/index.htm>
LAST UPDATED: 23/08/2003
*******************************************
Best Regards
Eirik Karlsen



I think PIC has an internal resistor (or something like this) on ports,
hence it sink an limited current on pins.

Regards, Wilson Antonieti Engenharia de Desenvolvimento Tel.: (11) 4223-5117 Fax.:
(11) 4223-5103 Visite nosso site:
www.contemp.com.br PRECIS AO SEU ALCANCE!!!
----- Original Message -----
From: "Phil" <>
To: <>
Sent: Thursday, March 25, 2004 3:43 PM
Subject: [piclist] question about PIC drain > I was curious about current draw on the PIC so I set up a couple of
> test cases and measured the current. My test setup uses a 16F628A,
> crystal and an LED on the PWM pin. I use PWM to the LED. With PWM
> at 0 duty, the circuit is drawing 0.6 mA. with the PWM at 100% duty
> its drawing 10.3 mA. Both of the duty cycles were confirmed with a
> scope. I also tried a regular (i.e. non-PWM) output pin with the
> same results. This is with a 3V supply and no dropping resistor on
> the LED. I believe the LED is supposed to be drawing 20mA but
> obviously not since it can only be drawing 9.7 mA. the LED by itself
> will draw 60mA (briefly... lol). So, why isn't the LED drawing more
> when connected to the PIC?
>
> Phil >
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
> Yahoo! Groups Links >
>





What you say is correct except I'm seeing the lower current (and
lower brightness) with the LED connected to the PIC pin directly.
The PIC data sheet says that Output High V is Vdd-0.7 which should be
the same as the transistor. I'm seeing the expected drain and
brightness with the transistor (2n3904, btw) but not with the direct
PIC connection. The unloaded V on the PIC pin reads about what I'd
expect.

By the way the voltage is 3.2 (2 AA cells). The numbers work out
fine for the LED's V.

--- In , Eirik Karlsen <eikarlse@o...> wrote:
> A LED may need as much as 2.2V to draw full current, add this to
the 0.7V drop in the transistor
> (1.4V if it is a Darlington) and maybe a 0.5V drop at the pin...and
this may explain what you're seeing...you need more voltage.
>
> Phil wrote:
>
> > One other point - I tried a driver transistor in an emitter-
follower
> > configuration to drive the LED and that draws what I would expect
at
> > 100% duty cycle - 22 mA.
> >
> > Phil
> >
> > --- In , "Phil" <phil1960us@y...> wrote:
> > > I was curious about current draw on the PIC so I set up a
couple of
> > > test cases and measured the current. My test setup uses a
16F628A,
> > > crystal and an LED on the PWM pin. I use PWM to the LED. With
> > PWM
> > > at 0 duty, the circuit is drawing 0.6 mA. with the PWM at 100%
> > duty
> > > its drawing 10.3 mA. Both of the duty cycles were confirmed
with a
> > > scope. I also tried a regular (i.e. non-PWM) output pin with
the
> > > same results. This is with a 3V supply and no dropping
resistor on
> > > the LED. I believe the LED is supposed to be drawing 20mA but
> > > obviously not since it can only be drawing 9.7 mA. the LED by
> > itself
> > > will draw 60mA (briefly... lol). So, why isn't the LED drawing
> > more
> > > when connected to the PIC?
> > >
> > > Phil
> >
> >
> >
> > to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
> >
> >
> >
> [click here]
>
> >
> > ------------------------
---
> > Yahoo! Groups Links
> >
> > * To
> >
> --
> *******************************************
> VISIT MY HOME PAGE:
> <http://home.online.no/~eikarlse/index.htm>
> LAST UPDATED: 23/08/2003
> *******************************************
> Best Regards
> Eirik Karlsen




spec says 25 mA. I'm not getting close.

--- In , "Wilson - Engenharia Contemp"
<engenharia3@c...> wrote:
> I think PIC has an internal resistor (or something like this) on
ports,
> hence it sink an limited current on pins.
>
> Regards, > Wilson Antonieti Engenharia de Desenvolvimento Tel.: (11) 4223-5117
Fax.:
> (11) 4223-5103 engenharia3@c... Visite nosso site:
> www.contemp.com.br PRECIS AO SEU ALCANCE!!!
> ----- Original Message -----
> From: "Phil" <phil1960us@y...>
> To: <>
> Sent: Thursday, March 25, 2004 3:43 PM
> Subject: [piclist] question about PIC drain > > I was curious about current draw on the PIC so I set up a couple
of
> > test cases and measured the current. My test setup uses a
16F628A,
> > crystal and an LED on the PWM pin. I use PWM to the LED. With
PWM
> > at 0 duty, the circuit is drawing 0.6 mA. with the PWM at 100%
duty
> > its drawing 10.3 mA. Both of the duty cycles were confirmed with
a
> > scope. I also tried a regular (i.e. non-PWM) output pin with the
> > same results. This is with a 3V supply and no dropping resistor
on
> > the LED. I believe the LED is supposed to be drawing 20mA but
> > obviously not since it can only be drawing 9.7 mA. the LED by
itself
> > will draw 60mA (briefly... lol). So, why isn't the LED drawing
more
> > when connected to the PIC?
> >
> > Phil
> >
> >
> >
> >
> > to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >




Ok,
but this should not be too hard crack....
so what ouput voltage are you seeing with the LED connected directly to the pin?
Although the pin can source 25mA this does not mean that the full voltage can be maintained.
The PIC18 datasheet states an Vo = VDD-0.7V @ 3mA and VDD=4.5V
At lower VDD and higher current expect much lower Vo.

If you use a (good) hi gain bipolar then you should be able to supply the LED with VDD-0.7V.
Maybe you swapped E and C? or the transistor is fried?
Try bypassing the PIC and connect a 1K resistor from B to VDD...that would verify the operation
of the switch itself.

Phil wrote:

 What you say is correct except I'm seeing the lower current (and
lower brightness) with the LED connected to the PIC pin directly.
The PIC data sheet says that Output High V is Vdd-0.7 which should be
the same as the transistor.  I'm seeing the expected drain and
brightness with the transistor (2n3904, btw) but not with the direct
PIC connection.  The unloaded V on the PIC pin reads about what I'd
expect.

By the way the voltage is 3.2 (2 AA cells).  The numbers work out
fine for the LED's V.

--- In p...@yahoogroups.com, Eirik Karlsen <eikarlse@o...> wrote:
> A LED may need as much as 2.2V to draw full current, add this to
the 0.7V drop in the transistor
> (1.4V if it is a Darlington) and maybe a 0.5V drop at the pin...and
this may explain what you're seeing...you need more voltage.

--
*******************************************
VISIT MY HOME PAGE:
<http://home.online.no/~eikarlse/index.htm>
LAST UPDATED: 23/08/2003
*******************************************
Best Regards
Eirik Karlsen
 


thanks for the feedback. I think you are right about lower Vdd being
the issue with the PIC. I wish it was better documented by
Microchip.

I'm not sure why people think the transistor driver is not working
correctly - it is doing just fine. I'm going to use it in my
design. The funny thing is it eliminates a dropping resistor and is
cheaper!

By the way, in the loaded case (LED connected to the PIC pin) I'm
seeing odd values (600 mV to ground) but in the unloaded case its a
bit below 3V.

--- In , Eirik Karlsen <eikarlse@o...> wrote:
> Ok,
> but this should not be too hard crack....
> so what ouput voltage are you seeing with the LED connected
directly to the pin?
> Although the pin can source 25mA this does not mean that the full
voltage can be maintained.
> The PIC18 datasheet states an Vo = VDD-0.7V @ 3mA and VDD=4.5V
> At lower VDD and higher current expect much lower Vo.
>
> If you use a (good) hi gain bipolar then you should be able to
supply the LED with VDD-0.7V.
> Maybe you swapped E and C? or the transistor is fried?
> Try bypassing the PIC and connect a 1K resistor from B to
VDD...that would verify the operation
> of the switch itself.
>
> Phil wrote:
>
> > What you say is correct except I'm seeing the lower current (and
> > lower brightness) with the LED connected to the PIC pin directly.
> > The PIC data sheet says that Output High V is Vdd-0.7 which
should be
> > the same as the transistor. I'm seeing the expected drain and
> > brightness with the transistor (2n3904, btw) but not with the
direct
> > PIC connection. The unloaded V on the PIC pin reads about what
I'd
> > expect.
> >
> > By the way the voltage is 3.2 (2 AA cells). The numbers work out
> > fine for the LED's V.
> >
> > --- In , Eirik Karlsen <eikarlse@o...>
wrote:
> > > A LED may need as much as 2.2V to draw full current, add this to
> > the 0.7V drop in the transistor
> > > (1.4V if it is a Darlington) and maybe a 0.5V drop at the
pin...and
> > this may explain what you're seeing...you need more voltage.
>
> --
> *******************************************
> VISIT MY HOME PAGE:
> <http://home.online.no/~eikarlse/index.htm>
> LAST UPDATED: 23/08/2003
> *******************************************
> Best Regards
> Eirik Karlsen






the parameter which is driving a LED is the current, the voltage drop
on the LED is only the effect. There are LEDs working on just 0.4mA (low
power LED's) on which, the voltage drop is less than 1V. Never say, you
need xV to the LED because is quite dizzing for a beginner.

best regards,
Vasile
http://surducan.netfirms.com On Thu, 25 Mar 2004, Eirik Karlsen wrote:

> If you instead of a bipolar use a CMOS with a 10K pullup on the gate you should get
> the full 3V to the LED. >
> > A LED may need as much as 2.2V to draw full current, add this to the 0.7V drop in the transistor
> > (1.4V if it is a Darlington) and maybe a 0.5V drop at the pin...and this may explain what you're seeing...you need more voltage.
> >
>
> --
> *******************************************
> VISIT MY HOME PAGE:
> <http://home.online.no/~eikarlse/index.htm>
> LAST UPDATED: 23/08/2003
> *******************************************
> Best Regards
> Eirik Karlsen >
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
> Yahoo! Groups Links