PICs and harsh environments


Closed Thread
Results 1 to 37 of 37
  1. #1

    Default PICs and harsh environments

    Hi everyone,

    I’m planning on building few gismos for automotive application based on PIC microprocessors and I will need to interface with some custom sensors and other modules. I will be dealing with ADC input, and digital inputs and outputs. Because this will be a long term step by step project I would have used and unused PIC I/Os for expansion.

    The question I have is does anyone recommend a particular configuration of the I/Os so they are safe from the extremely harsh environment on both aspects: electrical and mechanical / chemical (vibrations, water and (or) other fluids).

    I have some experience and I got good results potting the PCBs with different epoxy type products which will take care of the mechanical aspect. I will also make sure I will filter my 12 V in as well as possible along with the 5 V line and the mandatory decoupling capacitors next to VDD – VSS pins.

    What I’m looking for is some kind of protection so my I/Os don’t get randomly zapped or fooled by EMI. I’m not dealing with extremely fast signals so I guess just a T like configuration, limiting resistor series + capacitor to ground + limiting resistor series might do. Should I go to the extreme of using voltage suppressors?
    Also, how do I deal with an ADC input without messing up the input voltages (I expect 0 – 5 V full scale) and without loosing resolution?

    Any input will be appreciated.

    Nick

  2. #2
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    I recently made a circuit thing, it worked great in my "lab" environment but once I put it in the car, it made this high freq ringing, extremely annoying and took it out. In the mean time I am trying to figure out what I 'left' out of the build.

    I would say yes to the capacitors... this I noticed from looking at other schematics and re-reading what I should have already known about it.

    I am curious to see what advice is given from the seasoned vets, /subscribed

  3. #3
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    The question I have is does anyone recommend a particular configuration of the I/Os so they are safe from the extremely harsh environment on both aspects: electrical and mechanical / chemical (vibrations, water and (or) other fluids).
    Potting the PCB with epoxy products will solve the mechanical and chemical problems, as far as the electrical isolation is concerned, use optocouplers TLP504 for digital I/O and HCNR200 for all your analog staff.

    Al.
    All progress began with an idea

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Hi Al,

    Thank you for your input.
    I've been using optocouplers with good results before but had never used HCNR200 for analog I/Os. I'll give it a try.

    Regards,

    Nick

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default

    And a regulator for your logic/analog/digital circuits. Do not connect anything directly on +12V. Instead use lower Vcc for analog or digital about 8-9 Volts and 5 or 3.3 for the controller. So a regulator with large enough capacitors will almost eliminate your problems along with the other suggestions by Al and erice1984.

    I once (and more inexperienced in electronics) had a major problem with C-MOS used as an alarm in my dad's car. Every time the alarm was triggered, the horn was generating so much electrcal noise that reset all circuits. A 7808 saved the alarm from the trash.

    Ioannis

  6. #6
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    I figured out the decoupling capacitors after I had made this circuit and it made this high pitch ringing noise... very annoying. At least I think that was why it was making noise.
    Attached Images Attached Images  

  7. #7
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    use this diagram, I forgot to add a few things..
    Attached Images Attached Images  

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    R3 and R4 will give you some problem, this makes a great voltage divider but will give you false logic level.

    Is this a Typo or those 220nf are 220uF?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  9. #9
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    something is weird in the way you hook Q3 and Q4
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  10. #10
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default

    Yeah, GND must be Vdd...

    Ioannis

  11. #11
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    yea, no idea what i was thinking when i threw those together, I had it differently just read my notes wrong, really wrong... anyhow, look at this one
    Attached Images Attached Images  

  12. #12
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    lol, forgot to hook up Q4.... anyways it should be connected to an LED.

  13. #13
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    really not liking the CAD software I am using, its tough to read.

  14. #14
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Definitely better, but... Q1 and Q2 are not connected the proper way, the emitter should go to GND, I'll assume a lack of sleeping for this one

    I would suggest few things
    1. add a 0.1uF capacitor at the regulator input
    2. assuming Q3 drive a relay (because i'm not sure of the symbol you're using), I would suggest, if at all possible to use a 12V relay, this will keep spikes far of the logic Vdd. OR, depending how much current your relay coil need, and if have tons of those, add a resistor in serie with the 12v line...
    3. D1 is a good idea as long as your load on J4 don't overload the maximum forward current, which is ~1A.
    4. Depending how much current and where your LED take it's voltage, you may don't even need Q4
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  15. #15
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    You are right about Q1 & Q2 they are supposed to be connected to 5v not gnd.

    Q3 is driving a relay, that is National Instruments idea of a relay symbol and it pulls about 40mA

    J4 will have about 140mA

    The LED is actually an incandescent bulb needing ~12v 80mA

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


    Did you find this post helpful? Yes | No

    Default

    erice1984, The way the schematic is drawn the emitter and collector of Q1 and Q2 need to be reversed...

    Dave Purola,
    N8NTA

  17. #17
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    For 140mA drive, could the relay be replaced by a Mosfet or transistor instead?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  18. #18
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    For 140mA drive, could the relay be replaced by a Mosfet or transistor instead?
    Most likely.

  19. #19
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Dave View Post
    erice1984, The way the schematic is drawn the emitter and collector of Q1 and Q2 need to be reversed...

    Dave Purola,
    N8NTA
    Aye, Thanks for pointing that out, Q1 and Q2 are correct, I have the resistors connected incorrectly, they should be hooked to ground instead of the 5v that the diagram is showing..

  20. #20
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    how does it 'appear' now?
    Attached Images Attached Images  

  21. #21
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by erice1984 View Post
    how does it 'appear' now?
    *sigh* That is irritating....

    Fixed T1 and T2
    Attached Images Attached Images  

  22. #22
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by erice1984 View Post
    *sigh* That is irritating....

    Fixed T1 and T2
    Yet again, another change.... am I the only one this happens to?
    Attached Images Attached Images  

  23. #23
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    erice1984, few comments on your last schematic.

    a) NPN transistors are wrongly used (emitter should be grounded).

    b) PNP should have a base pullup resistor (4,7K will work).

    c) Diode D2 should be placed across emitter and collector of T4 to be of any use.

    d) Connector SL1 has two wires missing, since you will need ground and Vdd


    Al.
    All progress began with an idea

  24. #24
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    I was thinking of replacing T1 and T2 with Optocouplers.

  25. #25
    Join Date
    Mar 2006
    Location
    Hyderabad (India)
    Posts
    123


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by erice1984 View Post
    I was thinking of replacing T1 and T2 with Optocouplers.
    How about cleaning the power supply? it can also bring in Nonsense. better use a choke of say 1mH and definitely have a 0.1 ML C capacitor across the Vdd and Vss pins and very close to the chip.
    Ensure that the device is not close to high current carrying wires, neither the wiring parallel to such wires. If needed use a screened cable
    Regards,
    Sarma

  26. #26
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    Interesting Idea, As far as high power wires, this Circuit will be located under the dash, slightly to the left of the steering wheel - about 4" from the fuse box

  27. #27
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    schematic .
    Attached Images Attached Images  

  28. #28
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Why T4 is PNP, but T3 is NPN?

    Opto-Coupler will not work as-is. You should tie collector to VCC, emitter to your PIC I/O + Pull-down. Or variant of it, emitter to GND, collector to your I/O with a pull-up. Internal ones, if available on these pins, could work. Assuming the signal are 12V (or something over 5v), a simple current limiting resistor, or voltage divider could also work.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  29. #29
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    Okay, made sense about the Transistors. I changed the NPN to PNP because they were seemed better for the job.

    I also added 10k pull-down resistors to the emitter-PIC I/O wire.

    Thanks for input
    Attached Images Attached Images  

  30. #30
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Seems you have something workable now

    You can safely remove R1.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  31. #31
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    okay, I figured why am I using 2 more resistors than I need to. I took your advice changed programming a little and used the internal pullups, check it out.
    Attached Images Attached Images  

  32. #32
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  33. #33


    Did you find this post helpful? Yes | No

    Default T3 - t4

    I don't think those tr's will work like that, you need 12v on base to turn off and PIC pins only go to 5v. Need to have PIC drive PNP to drive base of NPN or make tr low side switches of PNP.
    don
    amgen

  34. #34
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    true...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  35. #35
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I never did it, but I think It could work. Use a pull up between tr base and 12V, then a resistor in serie with the PIC. In your software, you set GPIO to 0, and later you play with TRIS to toggle your pin. Set to input, the tr should be off, Set to Output, tr should be almost ON. I would bet something like 10K pull-up, and something like 100-1K match could do.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  36. #36


    Did you find this post helpful? Yes | No

    Default

    I have the feeling that the internal zenner diodes will keep your lower side of the resistor to 5V+ even if you force it in input mode so the transistor will never turn OFF completely. Playing with the two resistors values will only get you a reliable ON status of the transistor but never fully OFF.

    Regards,

    Nick

  37. #37
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Those internal one are not zener, but regular one.. fluffy but regular. Anyways, forget that, it was a really bad idea
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Members who have read this thread : 2

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