Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > General Electronics Chat


General Electronics Chat This forum is for general chat about electronics, eg: Dont know what a part does? Dont know how to read a circuit? Want to get an opinion?

Reply
 
Thread Tools Display Modes
Old 15th October 2007, 02:17 AM   (permalink)
Default Need advice on making 12V+ tolerant in/out to a micro

Hi,

I've got a project where I'll need to have some inputs and outputs in a automotive application (5V and 12V mixed).

My micro is 5V tolerant with 1 or 2 open collectors so going right to the pin is a bad idea. Can anyone recommend some schematics, design tips, circuits that might be closer to "approved methods" then what I may come up with on my own ?

I've done this work before but its always kinda flaky and I'm sure there is a better method for outputting 12V then the single NPN transistor I usually use.

I'm going for pretty bomb proof circuits, although the loads (in and out) will be automotive I'm not planning for any extreme disasters.


Any advice ?
Thanks!
iso

ps> Other then voltage following op amps I've never been really down on 5V protection components so if anyone has some good tips there, thats also quiet welcome,
iso9001 is offline  
Reply With Quote
Old 15th October 2007, 04:17 AM   (permalink)
Default

Which Micro? Normally, for inputs a resistive voltage divider or a current limiting resistor will suffice. For outputs, it depends on the load.

Mike.
Pommie is offline  
Reply With Quote
Old 15th October 2007, 04:37 AM   (permalink)
Default

Many micro controllers have clamping diodes on their I/O ports, as long as the current limit isn't passed you can feed it pretty much any voltage you want. There is an AVR appnote for a zero cross circuit that uses only a single resistor to go directly to 120volt AC line. A two transistor totem pole driver allows rail to rail high speed switching.
__________________
"Because I be what I be. I would tell you what you want to know if I
could, mum, but I be a cat, and no cat anywhere ever gave anyone a
straight answer, har har."
Sceadwian is offline  
Reply With Quote
Old 15th October 2007, 04:56 PM   (permalink)
Default

Lets say for now its PIC, but plans to migrate the micro to moto or other.

I know of the clamping diodes, but wasn't sure if it was 'recommended practice' to trust them.

Sceadwian: I haven't seen that appnote but I have heard similar stories. I'll take a look for it.


My 5V ADC signals are all going through a voltage follower opamp but right now my 5V digital wires are just direct to the micro from the connector, I'm sure thats not exactly correct.

As far as my outputs go I have a decent relay driver, but lets say no more then 25ma for 12V out. I'm guessing a simple transistor or fet but I would like it to be at least short protected, thats the type of thing I'm curious about.

I've been looking around for app notes and schematics but haven't come up with much,
iso9001 is offline  
Reply With Quote
Old 15th October 2007, 06:58 PM   (permalink)
Default

http://www.rev-ed.co.uk/docs/picaxe_manual3.pdf

See section 3, page 7 for interfacing a relay. The +5v on the top of the relay in the schematic, would be +12v in your case.

Good manual for simple interfacing to PICAXE, Basic Stamp, PIC, or other microcontrollers.

Ken
__________________
"To invent, you need a good imagination and a pile of junk."
Thomas A. Edison (1847 - 1931)
KMoffett is online now  
Reply With Quote
Old 15th October 2007, 10:33 PM   (permalink)
Default

Quote:
Originally Posted by iso9001
I know of the clamping diodes, but wasn't sure if it was 'recommended practice' to trust them.
If you can't trust a simple diode, how can you trust the thousands of transistors that form the processor, never mind your own code!

As far as I'm aware all PIC's have them on MOST I/O pins, some pins don't for specific reasons - explained in the datasheets. There are VERY, VERY, old PIC application notes feeding mains to PIC pins via simple resistors.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Reply With Quote
Old 15th October 2007, 11:22 PM   (permalink)
Default

Ok, so.... if pin is listed to sink 25mA and that pin does have a clamping diode can I allow 25mA @ 12V (via a 480ohm resistor) or is the rated 25mA really mean the clamping diode can only handle that at 5V / .125W and not the .3W the 12V would be allowing in ? That might not make sense, not sure. I suspect the rated mA is really meaning rated W as long as the pin has a clamping diode.

So then for output... if its going to another micro, a switch, or a lamp a mosfet seems like a better idea then an NPN ?
iso9001 is offline  
Reply With Quote
Old 16th October 2007, 12:03 AM   (permalink)
Default

For inputs above the normal Vcc range use a comparator, such as LM393(daul) or LM339(quad) or equivalent. Set the threshold somewhere between Vcc/3 and 2*(Vcc/3). You can also add hysteresis and make it a schmitt trigger input. These have open collector outputs so they can be used in 5V and 3.3V systems.

You could also use a 26LS32 line receiver. The inputs are tolerant of higher voltages and you can set the threshold. These have 3-state outputs so they can be combined for multiple inputs on a single input pin.

For outputs consider driving the emitter resistor of a common base stage with the base connected to Vcc. Pull the collector up to V+. The output can be used to turn on either an NPN or a PNP switch. This is especially usefull with the aysmmetrical quasi-bidirectional port on an 8051.
Papabravo is offline  
Reply With Quote
Old 16th October 2007, 12:37 AM   (permalink)
Default

The output pin of a pic can typically sink 25mA and source 20mA. As inputs they take a tiny current (~100nA). While it is true that the clamping diodes can take 20mA, the package as a whole is limited to less than 1W. Just use 10k resistors on your inputs. For your outputs consider something like the 2n7000 mosfet.

Mike.
Pommie is offline  
Reply With Quote
Old 16th October 2007, 07:41 AM   (permalink)
Default

Quote:
Originally Posted by iso9001
I'm going for pretty bomb proof circuits, although the loads (in and out) will be automotive I'm not planning for any extreme disasters.
For your peace of mind, and a few cents of part worth, do:

MCU pin <---> Resistor <---> clamp diodes to both +5V and ground <---> resistor <---> input signal
__________________
L.Chung
eblc1388 is offline  
Reply With Quote
Old 16th October 2007, 08:44 AM   (permalink)
Default

Quote:
Originally Posted by eblc1388
For your peace of mind, and a few cents of part worth, do:

MCU pin <---> Resistor <---> clamp diodes to both +5V and ground <---> resistor <---> input signal
If you're going to duplicate the insides of the PIC why not go the whole way and built it entirely from scratch using transistors?

PIC's are designed to use the minimum of external components, it's designed and specified to use a single resistor feeding a higher voltage into a diode protected input pin. They have been proved exceedingly reliable for well over a decade, why not trust that they know what they are doing?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Reply With Quote
Old 16th October 2007, 10:20 AM   (permalink)
Default

The reason is simple.

I don't trust the built-in clamping diode would offer sufficient protection and so for a few cents more, I would add my own as if they were not there in the first place.
__________________
L.Chung
eblc1388 is offline  
Reply With Quote
Old 16th October 2007, 10:56 AM   (permalink)
Default

Quote:
Originally Posted by eblc1388
The reason is simple.

I don't trust the built-in clamping diode would offer sufficient protection.
Why not, that's what they are there for?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Reply With Quote
Old 16th October 2007, 11:14 AM   (permalink)
Default

I consider the PIC inbuilt diodes are there for input protection purposes only and are not supposed to conduct in normal use. I will always keep them this way.

Mine added external resistors and diodes are there for signal conditioning and should be designed to do just that with properly rated components.

It is different methods of attacking the same problem.
__________________
L.Chung
eblc1388 is offline  
Reply With Quote
Old 16th October 2007, 11:36 AM   (permalink)
Default

Quote:
Originally Posted by eblc1388
I consider the PIC inbuilt diodes are there for input protection purposes only and are not supposed to conduct in normal use. I will always keep them this way.
Perhaps you should try reading the datasheets and application notes?, I presume you (like myself) come from the long ago micro-processor days when you had to add external diodes? - which was MicroChip fitted internal ones.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
Need advice on making a DIY car MP3 charger baristabrian Electronic Projects Design/Ideas/Reviews 10 6th June 2007 03:14 PM
making 3 diffrent continuouse clocks by the use of avr micro kaveh Micro Controllers 1 24th October 2005 08:09 AM
Advice on Small Micro Controller dirtyb15 Micro Controllers 10 9th April 2005 05:01 AM
Need help making my own micro electro-magnets, steve-o Robotics Chat 6 14th April 2003 02:53 AM



All times are GMT. The time now is 09:27 PM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.