PDA

View Full Version : PIC sinking voltages higher that Vdd???



manumenzella
- 25th February 2007, 06:01
Hi. First of all, I want to say sorry if this is already posted, but I tried searching with no luck. I would like to know if an IO of a PIC can source a higher voltahe than Vdd. For example: PIC running at 5v, and a piezo running from 9v unregulated directly from a battery. In this way, the piezo will sound louder, right???

Also, i think i might need to use a small diode in the IO, because, even if the IO is high , there will be some voltage difference with the battery voltage, and the piezo will never come back to the "resting" position, right.

Thanks for your work, and sorry for my english.
Manuel

skimask
- 25th February 2007, 06:24
Hi. First of all, I want to say sorry if this is already posted, but I tried searching with no luck. I would like to know if an IO of a PIC can source a higher voltahe than Vdd. For example: PIC running at 5v, and a piezo running from 9v unregulated directly from a battery. In this way, the piezo will sound louder, right???

Also, i think i might need to use a small diode in the IO, because, even if the IO is high , there will be some voltage difference with the battery voltage, and the piezo will never come back to the "resting" position, right.

Thanks for your work, and sorry for my english.
Manuel

Look on any PIC datasheet...do a search for the term "Electrical Characteristics", there you will find your answer.

manumenzella
- 25th February 2007, 06:26
Thanks a lot
I will look it right now!!!
Thanks again
Manuel

manumenzella
- 25th February 2007, 06:35
Hey. Sorry to bother you again.
I have just looked in Electrical Characteristics, but i cant seem to find my answer :( I think it might be the thing called "clamp current" or sth. but im not sure. I tried looking it up by Google without any luck, too.
Can you please tell me the parameter i should be looking for please???
Thanks in advance!!!!!!!!
Manuel

Darrel Taylor
- 25th February 2007, 08:00
Manuel,

All you need is a general purpose NPN transistor, and a 10k resistor.

10k from pic pin to the base, emitter to vss, collector to piezo, other side of piezo to +9V.

Setting the pin HIGH, will turn on the buzzer.

HTH,

skimask
- 25th February 2007, 08:09
Hey. Sorry to bother you again.
I have just looked in Electrical Characteristics, but i cant seem to find my answer :( I think it might be the thing called "clamp current" or sth. but im not sure. I tried looking it up by Google without any luck, too.
Can you please tell me the parameter i should be looking for please???
Thanks in advance!!!!!!!!
Manuel

1st page of that section, on the datasheets I've looked at so far, it's usually the 3rd parameter.

malc-c
- 25th February 2007, 11:19
Typing something like "driving piezo buzzer from pic micro" into Yahoo returned some interesting hits.

http://www.talkingelectronics.com/Pay/PIC/P6extra.html

I wouldn't expect the Piezo to draw much current, so a single transistor as DT suggested would be fine. If you want to drive things like motors then you could used an H-bridge or a Darlington power transistor.

http://www.talkingelectronics.com/Pay/PIC/PIC-TheoryPage3-Fig3.gif

For your Piezo you could omitt the 18R resistor and output transistor, and connect the buffer transistor's emmiter to the 12v (or 9v in your case) supply

More info can be found at http://www.talkingelectronics.com/Pay/PIC/PIC-Page3.html which explains the reason for using two or more transistors for high current loads.

Hope this helps

mister_e
- 25th February 2007, 11:20
Manuel what kind of piezo do you talk about? Those 'plug and play' or those you MUST produce a tone to hear something?

For high current, Darlington can be nice in some case, but they usually switch slowly and many have a BIG voltage loss between Collector and Emitter (few volts or so). I prefer MOSFET.

malc-c
- 25th February 2007, 11:47
Good comment regarding the MOSFET's, some of which have a low enough gate current so they can be driven direct from the PIC

mister_e
- 25th February 2007, 11:57
Depending of the load and frequency (if there's any), yes.

For much demanding stuff, there's still the MOSFET driver solution. Tons of different models and type available. Microchip TC1427 are not too bad.

manumenzella
- 25th February 2007, 21:51
Hey. Thanks for all the answers. I think im going to connect a npn transistor as most of you suggested. The probem is that, as it is battery powered, i need to keep the current draw very small. Do you know which will be (more or less) the current flowing from the IO to the base of the npn???
I was going to use the multimeter to measure it, but, after the cleaning lady came home, the screen was broken into pieces!!! :(
Well, thanks again for your help
Manuel

skimask
- 25th February 2007, 22:02
Hey. Thanks for all the answers. I think im going to connect a npn transistor as most of you suggested. The probem is that, as it is battery powered, i need to keep the current draw very small. Do you know which will be (more or less) the current flowing from the IO to the base of the npn???
I was going to use the multimeter to measure it, but, after the cleaning lady came home, the screen was broken into pieces!!! :(
Well, thanks again for your help
Manuel

Using a transistor instead of a MOSFET is going to cost you a few mA in base current right there. MOSFET's have practically no gate current, generally in the pico-amps (except when switching states due to gate capacitance). Use an N channel MOSFET, 2N7000. It'll easily handle 12v across the drain-source, and switch on/off with 5v logic levels on the gate.

sougata
- 26th February 2007, 03:56
Hi,

Some PICs have an open drain output (say PORTA.4). This means that it has only the lower side N-Channel MOSFET inside. And according to a Microchip FAE this can tolerate upto 8 volts safely. Hopefully it should not be a problem with your buzzer and 9v battery.

Darrel Taylor
- 26th February 2007, 04:11
And according to a Microchip FAE this can tolerate upto 8 volts safely.

You're right, it does say that. But it also says that PORTA.4 has protection diodes to VDD and VSS.

Which one are we supposed to believe?

I suppose a little testing would tell.
<br>

skimask
- 26th February 2007, 04:18
You're right, it does say that. But it also says that PORTA.4 has protection diodes to VDD and VSS.

Which one are we supposed to believe?

I suppose a little testing would tell.
<br>

YES! DESTRUCTIVE TESTING! I LOVE IT!
I've pulled 9v at about 5mA thru A.4 before, don't know if it was determental to the chip or not, but it seemed to work while I was doing it and I am still using the chip.

On the same note, I'm in Tucson, Az. for another couple of weeks. Man is it dry down here! I'm getting some killer static shocks from the doorknob! zzzztttt

mister_e
- 26th February 2007, 04:22
so nobody else use 2 i/o to double the voltage around those cuties?

EDIT : Aw crap... we talked about piezo buzzer right... not sounder... sorry :(

unless you want to heard something different than it's suppose to be... forget it :D

paul borgmeier
- 26th February 2007, 08:23
But it also says that PORTA.4 has protection diodes to VDD and VSS.

Which one are we supposed to believe?


Figure 5.4 in the datasheet for the 16F628 shows no clamp diode to VDD.

Darrel Taylor
- 26th February 2007, 08:32
This figure 5-4 ?

http://www.pbpgroup.com/files/PORTA4.gif
<br>

sougata
- 26th February 2007, 08:53
Hi,

This one is from a PIC18F452 datasheet page 90. Note that I/O pin has protection diodes to VSS only.

Ioannis
- 26th February 2007, 09:00
Darrel, take a look at Mid-Range Reference Manual for 16 series. At page 145, Figure 9-3 it clearly states that clamp diode is only to Vss. It could not be otherwise for higer voltage connection. So I suppose the 5-4 you posted might be wrong.

Ioannis

EDIT: Damn, Sougata just got me for a few msec...!

Darrel Taylor
- 26th February 2007, 09:34
Hmmm, well I guess it depends on which PIC you are looking at.
manumenzella never specified. And the original post regarding RA4 as much as assumed they are ALL like that.

Paul was referencing the 16F628, which according to the most recent datasheet, Has the diode.

If you look at a 16F628A, then it doesn't.

If you look at the 18F452 datasheet from a couple years ago, it says it does, but the most recent one doesn't.
Was it a change in the datasheet, or the silicon?

Like my original comment,
"Which one are we supposed to believe?"

Personally, I'd go with the transistor.
<br>

Acetronics2
- 26th February 2007, 10:10
Hi, Picmen

Pic Inputs clamp Diodes are rated @ 500µA ...

So, applications that limit the input current @, say 50µA ( good safety margin !!! ) can be done.

That includes sensing Mains through a 4.7 MOhm 1/2 W or 2 x 2.2 MOhms 1/4W in series ( care to the max voltage across the 1/4W resistors : 250 v PEAK )

I have built lots of 8 Pïns Pics working on mains as zero voltage switches or dimmers ...

BUT Remember TOCKI or MCLR pins DO NOT HAVE the VCC Clamp diode : an external diode has to be added then ...
and it's no pain if a clamp diode is already built in the package !!!

Alain

Ioannis
- 26th February 2007, 10:41
Personally, I'd go with the transistor.
<br>

I double that Darrel. That's what I always do and keep my headaches far away...!

As for the datasheets, they may have errors. Some are found, some not. What about the errata? I have not time to look right now.

Ioannis

sougata
- 26th February 2007, 16:28
Hi,

Spending on a single NPN transistor and a couple of resistor do give you the flexibility to use any pin without the need for painkillers.

paul borgmeier
- 26th February 2007, 17:03
From an earlier post the OP had

>>Hi. My name is Manuel, and I am building a project around the PIC16F628A and a piezo

http://www.picbasic.co.uk/forum/showthread.php?t=5773

I, in a sloppy manner, left the A off of my reply about the 16F628 datasheet. I had checked the 16F628A sheet and saw no clamp and was just reporting that observation.

However with an actual look at the 16F628 datasheet and the others noted, I see why Darrel asked

>> Which one are we supposed to believe

Great question by Darrel ... here is my version for an answer - if it were a one-off by a school boy intending to rudely disrupt the class room I would go with the 9V on RA4. If it were for a medical device or other lawyer-attacting application, I would go the NPN route and would want a written response from Microchip as an effort to help keep by butt out of court should there ever be a problem before going the non NPN route.

keithdoxey
- 26th February 2007, 17:59
Hmmm...interesting this one.

Just looked at the datasheets on my PC for 16F84, 16F628 and 16F628A

The 84 doesnt show diodes but mentions them and specifically says that RA4 is open drain and only has a diode to VSS. It also says that the maximum voltage on any pin is VDD +0.6v except MCLR wich is 14V

The datasheets I have for 628 and 628A both SHOW a diode on RA4 to VDD but also show it as an open drain pin. The spec says max voltage on any other pin is VDD + 0.3V EXCEPT MCLR AND RA4 which are 14V

Obviously something is not right in the datasheet and I would suspect that the diod ISNT present. My understanding of having an open drain pin is specifically to allow it to sink a load driven from a higher voltage hence the electrical spec stating 14V maximum. If the diode IS present then you wont be able to do that.

Ioannis
- 27th February 2007, 08:26
So, if one is in doubt, take the multimeter and check for a diode on pin RA4 to Vdd!

Ioannis

keithdoxey
- 27th February 2007, 08:52
So, if one is in doubt, take the multimeter and check for a diode on pin RA4 to Vdd!

Ioannis

Or put a 10k resistor between RA4 and +12v and measure the voltage.

If its 12v then no diode, if its 5.3-5.6 then there is a diode.

Acetronics2
- 27th February 2007, 09:15
So, if one is in doubt, take the multimeter and check for a diode on pin RA4 to Vdd!

Ioannis

How much current does your multimeter use for the test ??? more or less than 500µA ???

Good question ...

Alain

Ioannis
- 27th February 2007, 10:03
Hmm, few times I 've placed PIC's reverse direction on their sockets and thay got hot but not destroyed! Of course to be sure these PIC's are only in the lab for testing and never used for a commercial product...

Ioannis

manumenzella
- 27th February 2007, 19:39
Hey. Thanks for your answers. I have no idea how much current my multimeter uses to test for diodes....
Yeah, ssame here. If yuou connected the other way round, the just get hot, but they dont fry
I suspect their life could be shorten, though....
Thanbks again.
Manuel

PS I think i will use PA.4. Thanks for your help!!!