Not getting the full output from pins


Closed Thread
Results 1 to 16 of 16
  1. #1
    Join Date
    May 2011
    Posts
    42

    Default Not getting the full output from pins

    I didn't think I would be back so soon but I am stumped again. I have a circuit that turns little Panasonic PCB 3v relays on and off. Their coils draw 16.8 ma so they are well under the PIC supply limit and they have internal diodes. When I have the 16F1827 attempt to turn the relay on, there is about 1.8v measured at the output pin and the relay doesn't quite have enough to click over. I have done the same circuit with 628As and 1320s with no problem. I am thinking it is something to do with a register setting I have yet to find but I have about 20 hours into finding it with no results. I have disabled the comparators, set the ports for digital, and played with just about every register I could find int the data sheet. I finally used the "All Digital.php" file from Mr. Taylor which has worked on everything for me in the past but not this. Any help with this would be much appreciated.



    INCLUDE "ALLDIGITAL.pbp"
    Include "modedefs.bas"
    define OSC 16

    OSCCON=%01111010 ' 1320


    do
    high porta.3
    high portb.2
    pause 500
    low porta.3
    low portb.2
    pause 500
    loop

  2. #2
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    The obvious question... What's the IO pin voltage measuring with no relay connected? (if it's 3V, yet you're only getting 1.8V when driving the relay, then it's your relay pulling too much current for one pin - try paralleling two pins & having them both drive the relay coil....if that doesn't work, then it's your power supply feeding the PIC (incidentally, is the PIC power supply pin holding up at 3V when connected to the relay coil?). The normal method is to drive a transistor from the IO pin which in turn drives the coil.

  3. #3
    Join Date
    May 2011
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    I should have included this and I apologize. I haven't measured the pin alone without a relay because the board is assembled but the other PICs bring the pin to 2.1v with the relay connected which seems about right. It is only the 1827 that seems to have issues. The supply voltage stays solid at 3.2v at the VSS and VDD pins when the relay is "on" or attempting to be on. I understand a transistor driving the relay is the preferred method but there are some other considerations that make that difficult which is why these relays were chosen. They appear to have been designed to be driven directly with a uC and they work wonderfully with everything but the 16F1827 which is what makes me think it has something to do with the setup of the PIC and not a hardware issue.

  4. #4
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    Well in your situation, I'd still be inclined to either desolder one side of the relay coil, cut the track feeding it etc (or if your 1827 is SOIC package, consider lifting the pin off the PCB with a scalpel while reflowing the pin with a soldering iron) ...just to prove you are getting 3V out of the particular pin (which pin is it by the way?) ....what's the DC resistance of the coil? Assuming it's spec'ed for 3V supply, then for @16.8mA it should be about 178Ω ? (if you've 1.8V being dropped across it, you can easily confirm the current flowing through the coil - which might be higher than your anticipated 16.8mA). If the DC resistance of the coil is any lower than 120Ω ...then the PIC @3V will likely baulk.
    Last edited by HankMcSpank; - 1st August 2011 at 00:11.

  5. #5
    Join Date
    May 2011
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    I didn't pull it off the board but I did set up an identical circuit on a breadboard and found the following:
    Two pins together does power the relay but it sounds like a very lethargic actuation. It isn't as snappy of a sound as a relay with the other uCs.
    A pin without relay does output 3.2V
    When the pin is connected to the relay the relay is only drawing (or being supplied) 10 ma and the voltage drop is 1.8ish
    The relay draws 17 ma when connected to the power supply.

    It does appear for some reason the PIC cannot supply enough current for the relay. It is puzzling me because it is well within the PIC's capability and the other two PICs I have power it just fine.

    I am inclined to just use a 1320 for the application but it leaves me wondering what I am doing wrong with the 1827.

  6. #6
    Join Date
    May 2011
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    I have also tried it with a 12HV615 at 3.2 volts and it works.

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    What's the part # of the relay?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  8. #8
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    What's the DC resistance of the relay coil?

  9. #9
    Join Date
    May 2011
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    The coil resistance measures at 180 or 181 among three of them. The datasheet is here:
    http://panasonic-denko.co.jp/ac/e_do...txs.pdf?via=ok
    The p/n is TXS2-3V

    I have tried pins most of the pins to no avail.

  10. #10
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    Most devices sink current much more readily than they source current. My guess is that if you connected the + side of the relay to 3.3V and the - side to your PIC pin, the PIC would drive the relay perfectly.
    Charles Linquist

  11. #11
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    And here is some proofName:  PicOutput.jpg
Views: 618
Size:  142.5 KB
    Charles Linquist

  12. #12
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    If your relay draws 16.8mA at 3.3V, then it has a coil resistance of about 200 ohms (R=E/I). At 1.8V, it is sourcing 9mA. Looks like your device is slightly BETTER than specifications.
    Charles Linquist

  13. #13
    Join Date
    May 2011
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    16.8 is off the data sheet which is probably based on 3 volts. It is far easier to change to a 18F1320 than change the board from sourcing to sinking the relay. I have already changed the code to use the 1320 but it still leaves me a little bothered like I am missing something. If it is just a quirk in the 1827 or in the lot I bought then that is what it is. However, that seems to be the least likely of scenarios which makes me think I have done something wrong in the setup. I am about out of hair and some pretty smart people have looked at this already with no results. I am pretty close to just going with the 1320 for everything and burying this issue in the book of unsolved mysteries.

  14. #14
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    Why do you think it is "unsolved". The datasheet shows what you can expect from the chip. Remember, the relay draws 16.8mA *when it has 3.3V across the coil* ( it is a 196 ohm resistance). If you put less than 3.3V across the coil, the draw will be less. If you measure 1.8V across the coil, then the PIC is sourcing 9 mA. Since the coil has 1.8V across it, the PIC has 3.3V - 1.8V = 1.5V.
    The datasheet says that at 9mA, you aren't guaranteed to be able to source any current at all.

    This is not "black magic".


    And if you look at the datasheet for the PIC 18F1320, you will find that it is *NOT* guaranteed to work either. You may find some that do work, but the datasheet shows they wont. You need to SINK, not source the current from the relay to guarantee your circuit will work.


    Name:  18F1320.jpg
Views: 630
Size:  65.9 KB
    Charles Linquist

  15. #15
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    As Charles mentioned you would be better off going with the PIC as a low-side driver, but the best route would be to use some cheap low-side driver like a BS170 MOSFET.

    Switching from one PIC type to the next may not always guarantee it's going to work from one to the next if it's operating border-line.

    And a quick look at the relay datasheet does not show they have internal diodes. You will for sure want a flyback diode across those relay coils.
    Last edited by Bruce; - 1st August 2011 at 16:15. Reason: internal diodes
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  16. #16
    Join Date
    May 2011
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Not getting the full output from pins

    Unsolved is relative to my world. Until it makes sense in my pea brain, it is unsolved. However, it is solved now.

    Thanks for all the help. I was unaware of the graphs posted here and when I went back to look for them I realized I had a preliminary datasheet for the 1827 that did not have them. I didn't even think to account for the internal resistance of the PIC when trying to understand why it wouldn't work.

    Thanks for the catch on the diode Bruce. Thankfully the board was designed for a previously discontinued relay and a 1N4007 is installed for each of the relays. For some reason when I changed to the current relay I thought they had a diode installed. Luckily I never removed the clamping diode from the assembly instructions so they kept getting installed.

    Thanks again for everybody's help.

    Also, it does work as a low side driver.

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