PDA

View Full Version : PICs and harsh environments



Nicmus
- 8th February 2009, 05:00
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

erice1984
- 4th April 2009, 23:31
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

aratti
- 5th April 2009, 09:36
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.

Nicmus
- 5th April 2009, 15:52
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

Ioannis
- 5th April 2009, 17:30
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

erice1984
- 8th April 2009, 03:54
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.

erice1984
- 8th April 2009, 04:02
use this diagram, I forgot to add a few things.. :o

mister_e
- 8th April 2009, 07:52
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?

mister_e
- 8th April 2009, 07:53
something is weird in the way you hook Q3 and Q4

Ioannis
- 8th April 2009, 08:04
Yeah, GND must be Vdd...

Ioannis

erice1984
- 9th April 2009, 02:23
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

erice1984
- 9th April 2009, 02:25
lol, forgot to hook up Q4.... anyways it should be connected to an LED.

erice1984
- 9th April 2009, 02:28
really not liking the CAD software I am using, its tough to read.

mister_e
- 9th April 2009, 02:39
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
add a 0.1uF capacitor at the regulator input
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...
D1 is a good idea as long as your load on J4 don't overload the maximum forward current, which is ~1A.
Depending how much current and where your LED take it's voltage, you may don't even need Q4

erice1984
- 9th April 2009, 05:00
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 :rolleyes: and it pulls about 40mA

J4 will have about 140mA

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

Dave
- 9th April 2009, 11:53
erice1984, The way the schematic is drawn the emitter and collector of Q1 and Q2 need to be reversed...

Dave Purola,
N8NTA

mister_e
- 9th April 2009, 16:45
For 140mA drive, could the relay be replaced by a Mosfet or transistor instead?

erice1984
- 9th April 2009, 20:01
For 140mA drive, could the relay be replaced by a Mosfet or transistor instead?

Most likely.

erice1984
- 9th April 2009, 20:04
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..

erice1984
- 10th April 2009, 22:36
how does it 'appear' now?

erice1984
- 10th April 2009, 22:40
how does it 'appear' now?

*sigh* That is irritating....

Fixed T1 and T2

erice1984
- 10th April 2009, 23:07
*sigh* That is irritating....

Fixed T1 and T2

Yet again, another change.... am I the only one this happens to?

aratti
- 10th April 2009, 23:48
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.

erice1984
- 11th April 2009, 00:29
I was thinking of replacing T1 and T2 with Optocouplers.

mvs_sarma
- 11th April 2009, 06:40
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

erice1984
- 12th April 2009, 18:08
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 :eek:

erice1984
- 12th April 2009, 18:09
schematic .

mister_e
- 13th April 2009, 00:19
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.

erice1984
- 13th April 2009, 02:31
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

mister_e
- 13th April 2009, 04:26
Seems you have something workable now ;)

You can safely remove R1.

erice1984
- 13th April 2009, 06:40
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.

mister_e
- 13th April 2009, 16:02
http://www.clker.com/cliparts/7/0/2/7/1195423550187356949molumen_red_approved_stamp.svg. hi.png

amgen
- 14th April 2009, 14:24
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

mister_e
- 14th April 2009, 15:41
:o true...

mister_e
- 14th April 2009, 16:11
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.

Nicmus
- 14th April 2009, 17:31
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

mister_e
- 14th April 2009, 21:50
Those internal one are not zener, but regular one.. fluffy but regular. Anyways, forget that, it was a really bad idea ;)