12v on Pic input

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
Robert Reed
Posts: 2277
Joined: Wed Nov 24, 2004 1:01 am
Location: ASHTABULA,OHIO
Contact:

Re: 12v on Pic input

Post by Robert Reed »

Matt<p>Very confusing--Your last diagram still has PIC input at a locked ground as Philba pointed out. The one several posts before this showing a door switch will only serve to blow out a fuse somewhere.
Gorgon
Posts: 325
Joined: Wed May 04, 2005 1:01 am
Location: Norway
Contact:

Re: 12v on Pic input

Post by Gorgon »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by Matt Nuzum:
<p>
Hi, I think I'm using 2.2k. Can you tell me how you came up with that value or point me to a link on the web?<p>As I've mentioned, this is the first circuit like this I've built from the ground up. Choosing transistors still seems a little foreign to me.
<hr></blockquote><p>Hi Matt,
The 100 ohm is a bit of worstcase config, but it goes like this. Looking in the datasheet for the 2N2222 you'll see that the hFE for 500mA@10V has a min value of 30. The static current in the speaker is 16ohm@12v = 0.75A. Base current = 750/30= 25mA.<p>I have not looked in the datasheet for your PIC processor, but PICs has a normal limit of 25mA output at 2.5V drop. Leaving 2.5V-0.7/100ohm = 18mA Ib. This limits the PIC's output current and drives your transistor relative hard. I think your speaker sounds a bit louder now.<p> http://pdf.alldatasheet.co.kr/datasheet ... N2222.html <p> <blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by ecerfoglio:

If you don´t have a 5v zenner at hand, you can replace it with a pair of "garden variety" diodes (1N4001 to 4007 or 1N4148 / 1N914). <p>The first diode goes between ground and the R1/R2/pic input junction (like the zenner did)<p>Just conect the second diode´s anode to the (R1/R2/1st diode/pic input) junction and it's catode to the pic´s power suply (+ 5 V?)<p>This way the pic's input pin doesn't swing outside the pic's power suply pins - even if the pic is not energized.
<hr></blockquote><p>This is ok if your power is protected for feeding the output (over)voltage. In my experience the 78xx regulator doesn't like external voltage on the output. I have seen regulators collapsing into foldback due to this. I'm sure this varies from brand to brand, but it is not a good practice in a noisy environment like a car.<p>Powering the PIC from an input(s) is of course possible but this is not the normal situation. With a resistor of 6.8 - 10k on the input, only 1mA will seep through. Not sufficient to do damage.<p>TOK ;) <p>[ October 21, 2005: Message edited by: Gorgon ]<p>[ October 21, 2005: Message edited by: Gorgon ]</p>
Gorgon the Caretaker - Character in a childrens TV-show from 1968. ;)
User avatar
Chris Smith
Posts: 4325
Joined: Tue Dec 04, 2001 1:01 am
Location: Bieber Ca.

Re: 12v on Pic input

Post by Chris Smith »

If your worried about voltage spikes, attach a Zener at the T bone junction [center tap] where you tap your signal off of. Because the voltage divider is already current reduced, the Zener wont need any extra resistors or circuitry. Any voltage above the desired voltage going to your project will be clamped or shunted automatically to ground. <p>Two resistors and one Zener is all you need.
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Re: 12v on Pic input

Post by Newz2000 »

I found some photo couplers that I'd bought and forgot. Toshiba TLP630, designed to work with ac or dc. Sounds like that will be the easy route.<p>Thanks for the help everyone.
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: 12v on Pic input

Post by philba »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Hi Matt,
The 100 ohm is a bit of worstcase config, but it goes like this. Looking in the datasheet for the 2N2222 you'll see that the hFE for 500mA@10V has a min value of 30. The static current in the speaker is 16ohm@12v = 0.75A. Base current = 750/30= 25mA.<p>I have not looked in the datasheet for your PIC processor, but PICs has a normal limit of 25mA output at 2.5V drop. Leaving 2.5V-0.7/100ohm = 18mA Ib. This limits the PIC's output current and drives your transistor relative hard. I think your speaker sounds a bit louder now.<hr></blockquote><p>At 750 mA/12V, I think that little to92 will be smokin hot. Also, .75 A is pretty close to the absolute max (.8) on that puppy. Of course, duty cycle will give you approximately half of that power but that's still a lot of wattage. You might want to limit the current just a bit... Or maybe use a heat sink.<p>by the way, using quote on gorgon's article only gave me the last part of it, not the whole thing. bug in the forum software, me thinks...
Gorgon
Posts: 325
Joined: Wed May 04, 2005 1:01 am
Location: Norway
Contact:

Re: 12v on Pic input

Post by Gorgon »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by philba:
<p>At 750 mA/12V, I think that little to92 will be smokin hot. Also, .75 A is pretty close to the absolute max (.8) on that puppy. Of course, duty cycle will give you approximately half of that power but that's still a lot of wattage. You might want to limit the current just a bit... Or maybe use a heat sink.<p><hr></blockquote><p>Hi Philba, (Matt)
I agree with you in this, but the datasheet listed the TO-39 case. 0.75A is close to the limit but driving the transistor into saturation keeps the Vce drop down, and reduces the the total power dissipation in the transistor. It is also possible to add a small resistor value in series with the speaker to reduce the current, if the transistor heats up.
But, all depends on how long the sound is on, is it continuous Matt needs a better transistor, for short beeps it should be ok.
If the TO-92 version is used there is(may be) a problem, but one solution could be to use two in parallel, each with 220-270 ohms drive resistors. This should distribute the power dissipated. Even three in parallel could be used, each with a 330-390 ohms resistor.<p>Only the fantasy is the limit :D <p>TOK ;)<p>[ October 22, 2005: Message edited by: Gorgon ]</p>
Gorgon the Caretaker - Character in a childrens TV-show from 1968. ;)
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Re: 12v on Pic input

Post by Newz2000 »

I have the project completed. I ended up using a 2n2222 instead of an optoisolator. It works great, but it does have one odd characteristic: The switch is now *very* sensitive.<p>For example, I have some tac switches mounted to little mini pcbs with pins allowing them to be easily plugged into a breadboard. If I touch the pcb traces with my thumb the LEDs light up.<p>Anyway, if anyone has any comments or knows of some parts I can eliminate, I'd love to hear.<p>Here is the schematic:
<a href="http://img144.imageshack.us/my.php?imag ... tic4vf.gif" target="_blank">:D
ecerfoglio
Posts: 108
Joined: Thu Nov 25, 2004 1:01 am
Location: Buenos Aires Argentina
Contact:

Re: 12v on Pic input

Post by ecerfoglio »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr> I have the project completed. I ended up using a 2n2222 instead of an optoisolator. It works great, but it does have one odd characteristic: The switch is now *very* sensitive. <hr></blockquote><p>You may add a resistor (1k?) from the transistor´s base to ground. <p>It should have little or no efect when the transistor is on (0.6v/1K = 0.6 ma, if the transistor doesn´t turn fully ON then increase the resistor's value)<p>When the transistor is OFF the new resistor should ensure that it remains OFF.
E. Cerfoglio
Buenos Aires
Argentina
Gorgon
Posts: 325
Joined: Wed May 04, 2005 1:01 am
Location: Norway
Contact:

Re: 12v on Pic input

Post by Gorgon »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by Matt Nuzum:
I have the project completed. I ended up using a 2n2222 instead of an optoisolator. It works great, but it does have one odd characteristic: The switch is now *very* sensitive.<p>For example, I have some tac switches mounted to little mini pcbs with pins allowing them to be easily plugged into a breadboard. If I touch the pcb traces with my thumb the LEDs light up.<p>Anyway, if anyone has any comments or knows of some parts I can eliminate, I'd love to hear.<p>Regarding the speaker and the 2n2222/100ohm resistor, the transistor does not get hot (or even warm) in the slightest, even after listening to the thing beep so long that you can't hardly stand it anymore.<p>Any comments about design decissions? I have a PCB drawn up already and even got the board down to about 2.5"x2.5" single sided. I finally get to try out Edd's technique using flat spray paint! My spray paint and exacto knife have been waiting patienty. :D <hr></blockquote><p>Hi Matt,
You need pulldown resistors on Q3 and Q4 as ecerfoglio say. 1k or 1k5 is ok. The LEDs are reversed, and 4k7 is on the high side for currentlimiting. 470 is more like it, depending on the efficiency of the LED.<p>How was the soundlevel from the speaker?<p>Just a small advice: Put the 10k resistors on the other side of the switch, closest to the transistor. This way you doesn't make smoke if you connect the switch wrong or short it to +12v. The resistor is for protecting the transistor, not the switch.<p>TOK ;)
Gorgon the Caretaker - Character in a childrens TV-show from 1968. ;)
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Re: 12v on Pic input

Post by Newz2000 »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by Gorgon:
...
The LEDs are reversed,
4k7 is on the high side for currentlimiting.
...
How was the soundlevel from the speaker?
...
The resistor is for protecting the transistor, not the switch.
<hr></blockquote><p>Oops.<p>Ooops again. On the breadboard its right, but I originally mis-read the color code as 4.7k. Then, when I went to correct it, I typed it in the wrong field. You can kind of see it there... it says, R0.2470... You probably thought, wow, he mus be planning on adding a lot to that circuit to use a 5 digit naming scheme for his resistors. ;) <p>The sound is nice and loud here in my office. I'm not sure what it's going to do in the car. I may have to break down and spend $1.50 for a nice loud piezo. :p <p>Good point about the resistor/Q/switch. I guess I didn't realize the full reasoning of why it was there.<p>Thanks all for your help.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests