Watt's the wattage when used on a PIC?


Closed Thread
Results 1 to 32 of 32
  1. #1
    Join Date
    Jan 2010
    Posts
    88

    Default Watt's the wattage when used on a PIC?

    Hi Guys,

    As the titles alludes to, I am trying to figure out what size resistor I need when using a voltage divider on a PIC as an input trigger.

    My circuit is being powered by a voltage regulator and I have been using an optocoupler to trigger my PIC, but am trying to minimize cost, so switching to a voltage divider setup. What I am trying to figure out is can I use two 1/8 watt resistors in my VD circuit along with a .1 uF cap and Zener, to make sure my circuit doesn't go above 5 volts?

    For my 12 volt circuit, I have calculated using 10k and 4.7k, which gives me just under 5 volts. Is it safe to use two 1/8 watt resistors or should I bump the 10k to 1/2 watt or 1/4 watt? This is the only things that's stumping me. The input can either be momentary or continuous (if that matters).

    Thanks,
    Tony

  2. #2
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    See the PIC data sheet for pin ma sink or source rating.
    Ohms law is amps * volts = watts.


    Norm

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,388


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    or more appropriately


    p= v*v/r ( v^2/R)
    p= r*I*I ( R*I^2)

    12 x 12 / 14700 = 0.009 watts for the total
    I = V/R I= 0.8 Ma

    P 4K7 Resistor = 4700 x 0.0008 x 0.0008 = 0.003 watts
    p 10k R = 10000 x 0.008 x 0.0008 = 0.006 w

    I don't think you can buy a resistor that would not be ok in that circuit even the smallest 603 smd could do it easily

  4. #4
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    I'm curious so here goes: Using those resistor values in a 12 volt circuit in series should yields around 3.8 Volts across the smaller resistor. That's well below 5 volts and could be considered to be in the ambiguous range if using it for a logic high. Maybe that's what you want but again I said I'm curious if that's what you really want. Those resistors can be of any size that will give you the voltage since you aren't really drawing current from them just a voltage level. Though I don't see how these will replace the opto-coupler as a trigger.

    You say you want to use a zener with a cap and two resistors for VD clamping (may not be right term). Most zeners require a turn on current and I'm going to use 100mA as my minimum guess of that current. I'm assuming you're using the same 12 volts as the voltage divider for your source. The regulating resistor would have to drop 7 volts at .1A which means it would need to be around 70 ohms. So, I^2 x R would require it to dissipate .7 watts. You can use as many resistors as you wish to dissipate that heat but they must be at least capable of dissipating that heat continuously. You could use 6 each 1/8 watt 420 ohm resistors or one big 70 if you want. Either will work for dissipating heat.

    If this isn't what you meant I apologize.

  5. #5
    Join Date
    Feb 2013
    Location
    Quebec, Canada
    Posts
    67


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    Quote Originally Posted by AvionicsMaster1 View Post

    You say you want to use a zener with a cap and two resistors for VD clamping (may not be right term). Most zeners require a turn on current and I'm going to use 100mA as my minimum guess of that current.
    With zener diodes the target is 10% of their maximum current. So for a 5V/1W zener it's maximum current is 200mA so the minimum is 20mA. 7V drop @20mA=350ohm.

    If you just want to clamp the voltage at any input the PIC have protection diodes so a series resistor is sufficient. Read the datasheet to find a reasonnable current for protection diodes. Hint: check PBP manual for the SERIN command, there is a schematic to interface RS232 without level shifter...

    HTH

  6. #6
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    Thanks for the replies. My application is for a PCB being installed in a vehicle. The voltage is usually 13.8 volts. As I had some problems with some of my optocouplers being bad and had to replace them, I wanted to try another method (voltage divider) where you don't usually get bad resistors. I calculated 10k and 4.7k to bring it down to about 5 volts (or in my case, just under 4.5 volts). The Zener was to help maintain a max voltage of 5 volts to not damage the PIC, while the bypass cap helps to filter some of the noise in the line.

    Do everyone's suggestions still stand? It seemed like a simple problem at first, but then the more I began thinking about all of the variables, I started second guessing myself. Is there anything I should change to the setup?

    Thanks,
    Tony

  7. #7
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    A voltage divider with those resistors at that voltage should have just under 4.5 volts. If you're using that voltage to logic check or reference something you should use a zener or internal PIC voltage reference as a standard. There is some variation in voltage with engine running and off. Why not use some of the 5 volts from the power zener and voltage divide that to get around 4.5 volts? More stable and accurate. Though I still don't see how a voltage divider replaces an optocoupler.

  8. #8
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    It doesn't replace the optocoupler. I would rather have the opto, however, after a recent string of failures, I am trying to minimize my repairs and use something more reliable like resistors.

    So, if I use the Zener to regulate down to 5 volts, would I use a VD setup that brings the voltage down to say around 6 or 7 volts and regulate from there, or just use a single resistor for the load on the Zener?

    My understanding is that the Zener should not be the only thing regulating the supply because it will blow. It WILL need to go through a resistor. Does this sound right?

    Thanks,
    Tony

  9. #9
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    I'm not sure what your application is, but if it's an alarm or similar and needs to work when the vehicle is on or off, there is more to consider. You mention an input trigger, but not how you are powering the PIC. Inputs can not go higher than VDD, so this implies your voltage divider needs to be less that VDD when charging (as high as 14.4 V) and when the battery is quite discharged (about 10.8 V). You can do this with a voltage divider but there are a smaller set of values that will work. [R2/(R1+R2) = 2.85]. Finally, there's no need for zeners - a voltage divider will do it all. Zeners are useful where you need a constant voltage regardless of load. That is not your application - the load never changes if it's just the input of the PIC. You can make a zener work, but you are just wasting electricity (and of course money).

  10. #10
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    Thanks for the replies. I don't work much with Zeners, so hence why I'm asking. I have been using optocouplers to trigger this part of the circuit, but they are expensive compared to a couple resistors, zener and cap.

    My circuit is simple; main supply goes through a voltage regulator, so the supply to the PIC is always 5 volts. This other input is just to tell the PIC that this wire has been activated. I applied the Zener to the application since any kind of over-voltage situation will increase the voltage going to the PIC. I wanted to cap it off at 5 volts.

    I chose the higher values so the PIC would read them as ones and zeros. If it was lower, I would have to do an ADC, right? I've modified my circuit design from the opto to the VD. If I did an ADC, I would have to reroute the traces to the ADC pins, and that's a cumbersome redo of my board.

    My comments about the load was stating that I just couldn't have the supply come in and go straight to the PIC and have the Zener regulate it to 5 volts. It has to pass through a resistor first, or else the Zener would blow and then the PIC. Does that sound right?

    Also, I am aware of the typical VD circuit where you have two resistors in series, supply is on one side of R1 and ground is on the other side of R2 and you tap in between R1 and R2 to get your divided circuit. I have found two such circuits with the same layout, but instead, Vin and Vout are reversed. The supply is applied between R1 and R2 and while R2 goes to ground, the other side of R1 is your output.

    Trying to use the same formula but solving for the other unknown variable using algebra does not work. Is there a different formula for this method? In this instance, R2 is 10k and R1 is 100K.

    All I want to do is trigger a pin on the PIC to let it know an input has power applied to it. There's optos, VD and transistors that can be used. Would a transistor be simpler to use in this instance?

    Thanks,
    Tony

  11. #11
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    You can make any of the methods you discuss work, but to reiterate, the simplest is a straight resistor divider. R1 goes from the ~12V high source to the PIC pin. R2 goes from the pic pin to ground.
    Then: Vpin = vsource*(R2/(R1+R2)) As I stated above, the biggest Vsource you will see is 14.4V. The biggest Vpin you can stand is 5V.
    so 14.4=5*(R2/(R1+R2)).
    So 14.4/5 =R2/(R1+R2)
    so 2.88 =R2/(R1+R2)
    Now go hunting for the standard resistor values that when plugged into R1 and R2 = 2.88
    Look for values between 1K and 100K
    You probably won't find an exact match (43K & 15K might be close enough), although to be as safe as possible, err on R1 being just a bit higher than the ration implies.

  12. #12
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    I applied the Zener to the application since any kind of over-voltage situation will increase the voltage going to the PIC. I wanted to cap it off at 5 volts.
    I'm just wondering what a voltage divider plus a zener would cost opposed to a voltage regulator to limit the input.

    couldn't have the supply come in and go straight to the PIC and have the Zener regulate it to 5 volts. It has to pass through a resistor first
    Yes, most zeners must have current limiting resistor. I say most cause as soon as I say all then someone will post one that doesn't.

    The supply is applied between R1 and R2 and while R2 goes to ground, the other side of R1 is your output.
    This sound like you're trying to make a logic gate for the PIC. There 's a good example in the PBP manual of how to do this.

    Would a transistor be simpler to use in this instance?
    You could use a transistor with the collector using your 5V supply and voltage divide the input to the base of the transistor. You'd still need a pull down resistor so you're not saving much. You'd end up with a higher parts count but not necessarily lower cost or reliability. Optos in essence are transistors and you've said your not having much luck with them. Though a 2n2222a and a couple of resistors aren't very expensive. If you wanted to go this route it's probably cheaper and easier to do the voltage regulator at the input.

    Trying to use the same formula but solving for the other unknown variable using algebra does not work. I
    I'm sorry to say math is math and it's been done here already.

    Disclaimer: I've not seen your schematic and I'm often not good with word pictures. If I've botched something I apologize.

  13. #13
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    To clarify - power supply for the PIC is not under discussion. This is all about scaling signals to not exceed VDD (5V).

  14. #14
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    That is correct. The PIC will be powered. I want it to be able to see an input when 12 volts is applied. The program is busy doing a bunch of other things, but it will check that input like this; if input1 = 1 then do this, if input1 = 0, then don't do this.

  15. #15
    Join Date
    May 2009
    Posts
    40


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    Why do you not just use a 47k resistor in series with the input pin. The internal diodes in the pic will clamp the input voltage anyway. No need for zeners or voltage dividers.

  16. #16
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    Grahang, How are you going to limit the current?
    Dave Purola,
    N8NTA
    EN82fn

  17. #17
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    Quote Originally Posted by grahamg View Post
    Why do you not just use a 47k resistor in series with the input pin. The internal diodes in the pic will clamp the input voltage anyway. No need for zeners or voltage dividers.
    I've used this method too but also included a small filter cap to ground at the input pin for noise.
    The DEBUG section of the PBP manual shows this as acceptable where +-25V signals are possible to the input.
    Attached Images Attached Images  
    Louie

  18. #18
    Join Date
    Aug 2011
    Posts
    408


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    Bad idea.

    See http://www.picbasic.co.uk/forum/showthread.php?t=15542 post #3 for the reasons.

  19. #19
    Join Date
    May 2009
    Posts
    40


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    Dave with a 47k resistor the current at 12 volts is only about 255 Micro amps. I have used this method hundreds of times and never had any problems. The input resistor can be as high as 270K and stil works well.

  20. #20
    Join Date
    Mar 2013
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    If the input is only for a trigger (e.g.. turns on with the ignition), why don't you use a 5V reg (7805)?
    I've used them and it works perfectly.

    Badger

  21. #21
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    Quote Originally Posted by Badger View Post
    If the input is only for a trigger (e.g.. turns on with the ignition), why don't you use a 5V reg (7805)?
    I've used them and it works perfectly.

    Badger
    And it only cost about 100x as much as a resistor, and needs filtering so add another 10x, and is slow to respond, but sure a regulator and many other complex circuits will work to sense a level that doesn't change very fast. Grahamg has the cheapest solution with a single high value resistor, if the 5V VDD supply is capable of both sourcing and sinking current. A resistor divider pair will work if the supply can source only. No need for zeners or anything else.

  22. #22
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    Quote Originally Posted by AvionicsMaster1 View Post
    I'm just wondering what a voltage divider plus a zener would cost opposed to a voltage regulator to limit the input.


    Yes, most zeners must have current limiting resistor. I say most cause as soon as I say all then someone will post one that doesn't.


    This sound like you're trying to make a logic gate for the PIC. There 's a good example in the PBP manual of how to do this.


    You could use a transistor with the collector using your 5V supply and voltage divide the input to the base of the transistor. You'd still need a pull down resistor so you're not saving much. You'd end up with a higher parts count but not necessarily lower cost or reliability. Optos in essence are transistors and you've said your not having much luck with them. Though a 2n2222a and a couple of resistors aren't very expensive. If you wanted to go this route it's probably cheaper and easier to do the voltage regulator at the input.


    I'm sorry to say math is math and it's been done here already.

    Disclaimer: I've not seen your schematic and I'm often not good with word pictures. If I've botched something I apologize.
    Here is what I am speaking of. The left schematic is the one we are all talking about. The right schematic is one that I have seen a couple of times now. Still a high value on the top and smaller one on the bottom. What would be the formula for this bad boy?
    Name:  VD.jpg
Views: 1450
Size:  28.2 KB

  23. #23
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    For your current way diagram the output would be the voltage divided value at the point labeled out.

    For your other way diagram, it depends. If you hooked a meter to the out without any other circuitry attached to the out you'd get whatever the +in voltage is applied. If there is other circuitry attached and there is current flow in the circuit you'd get some voltage dropped across the top resistor. It might be the whole +in but probably less than full voltage supplied. Even if the output is grounded you wouldn't get a voltage divided value across either resistor you'd get power divided across two resistors. Something altogether different.

  24. #24
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    Quote Originally Posted by grahamg View Post
    Dave with a 47k resistor the current at 12 volts is only about 255 Micro amps. I have used this method hundreds of times and never had any problems. The input resistor can be as high as 270K and stil works well.
    So just one resistor from the input wire going to the input pin? Does this work in even the noisy environment of vehicles?

  25. #25
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    This certainly has gone tangential to your original question. Going back to the beginning, for the 10k and the 4.7k a 1/8W current rating would be enough.

    I don't see where you said what PIC you're using. I looked at the 12F683 and see where it would be able to clamp 20mA at GPIO input. You may be able to use one resistor of sufficient size to take advantage of PIC internal circuitry to clamp that 12VDC but the datasheet shows only +.3V over VDD. To me a better way would be the voltage divider scheme you first posited.

    I hope you finally got your answers.

  26. #26
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    My original question asked if I had it right or if I needed to make the resistors bigger. Suggestions were made to make the voltage smaller. My question is that with 2.5 volts, will that trigger the input? For a digital signal, you need a 1 or 0, or in this case, 5 volts or 0 volts. Am I missing something?

    I am using the 16F819. After reading the other article (link that was posted), I figured I would use the VD to a transistor to trigger the input. I just don't want to blow anything up.

    Thanks for your help thus far. I just want to understand it better.

    Tony

  27. #27
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    Tony,

    I did not see where you indicated which pin on the PIC you are using for input.
    As you probably already know that which pin you use matters in the answer to your question about what voltage will be recognized as a 1 (high) or 0 (low) by the PIC.

    The PIC you are using has 3 types of digital input pins, each with different thresholds for low and high. Standard Inputs, TTL Buffered inputs and Schmitt Trigger inputs.

    Table 15.4 of the DS has the Min/Max for Input Low and Input High for each of the pin types.

    You probably already knew this, but just in case.

    Regards,
    Regards,
    TABSoft

  28. #28
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    No. You don't need to make the resistor bigger if you keep the same ratios previously stated.

    Yes. IMSWO by looking at the datasheet if you're using a TTL input 2.5 V is above the level supposed to be recognized as a high. Why you don't design it for more voltage than that is curious. I'm assuming you'll have a 12v signal you'll have to schmooze so why not make it 5ish volts and not worry about ambiguity. According the datasheet, if I understand it right, with a Schmitt trigger input 2.5 v is way over a recognizable high. So pick a pin type and design for it.

  29. #29
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    I was being conservative for any over voltages from the vehicle, hence the Zener. I just found another circuit with the same #2 VD setup as above. 2.2k to ground and 33k to the output yields 1.7 volts when 13.8 volts is applied. No cap and no Zener and on a 16F628A, RB0.

    This is all new to me as I've been using opto's. Never looked at the datasheet that way as I had never intended to connect it directly. Didn't think you could, but now I'm finding out that you can. Looking to explore it further. Right now, my pins are RB0, RB1 and RB2.

  30. #30
    Join Date
    Feb 2013
    Location
    Quebec, Canada
    Posts
    67


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    Quote Originally Posted by ERMEGM View Post
    This is all new to me as I've been using opto's. Never looked at the datasheet that way as I had never intended to connect it directly.
    OK, let's start from the beginning... You said you had some opto that failed you. Optos are sensitive to reverse voltage and forward current must be limited too. Your circuit will be on a car so you must protect your opto. So, please forget about those resistor divider and/or zener and use an opto the proper way:

    Name:  Opto.png
Views: 4462
Size:  6.5 KB

    The maximum continous current for the PC817 is 60mA. With a 1k resistor it's about 60V continous. Note the 1N4004 to protect the LED from any reverse voltage (spikes can occur). Trust me, do not try to connect your PIC to a vehicule voltage without an opto. At work I maintain our GPS tracking system which has I/O to monitor some things (sorry, don't have time to explain) and some I/O's are tied almost directly to the CPU and guess what? They fail some times!

  31. #31
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    That is the exact setup I have. I am using the ILD205 instead for the opto and the LS4148 for the reverse polarity protection. I have a diode on the positive input as well. The design of the board and wires prevents a reverse polarity connection. These optos are failing right out of the packaging. A bad batch? Maybe, but nonetheless, very time consuming to repair. Either way, if the opto fails, or the resistor fails, blowing the pic, the board is coming back to me.

    At this point, my time is worth more than the cost of the pic or opto. I designed it this way because of the features of the opto, however, I've seen the other setup work time and time again without any problems. I was going to add the cap and Zener to boost up the protection a little bit on the VD setup. I'm not looking for cheap. I am more interested in reliability. The opto served me well until this last batch. Now I'm skeptical.

  32. #32
    Join Date
    Feb 2013
    Location
    Quebec, Canada
    Posts
    67


    Did you find this post helpful? Yes | No

    Default Re: Watt's the wattage when used on a PIC?

    FIY, this is how our GPS units are designed:

    Name:  Opto2.png
Views: 1972
Size:  6.4 KB

    On the "ignition" input the TVS is a big 1.5KE33 and none of the ~480 units failed me. The other "conventionnal" I/O are either "ground inputs" (the ones that fails often) or optoisolated. I had a few units who failed on those opto inputs but the TVS is a 0805 SMT. If I came across a failed one I'll do an autopsy to find out what failed...

    HTH

Similar Threads

  1. High wattage speaker circuit
    By The Master in forum Off Topic
    Replies: 3
    Last Post: - 5th January 2011, 21:56
  2. High Speed Serial Comm PC - PIC and PIC - PIC
    By manumenzella in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 16th January 2007, 21:55
  3. Looking for low Wattage heater wire
    By jmgelba in forum Off Topic
    Replies: 1
    Last Post: - 21st November 2005, 18:22

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts