![]() |
![]() |
![]() |
|
|
|||||||
| 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? |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
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, |
|
|
|
|
|
|
(permalink) |
|
Which Micro? Normally, for inputs a resistive voltage divider or a current limiting resistor will suffice. For outputs, it depends on the load.
Mike. |
|
|
|
|
|
|
(permalink) |
|
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." |
|
|
|
|
|
|
(permalink) |
|
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, |
|
|
|
|
|
|
(permalink) |
|
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) |
|
|
|
|
|
|
(permalink) | |
|
Quote:
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. |
||
|
|
|
|
|
(permalink) |
|
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 ? |
|
|
|
|
|
|
(permalink) |
|
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. |
|
|
|
|
|
|
(permalink) |
|
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. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
MCU pin <---> Resistor <---> clamp diodes to both +5V and ground <---> resistor <---> input signal
__________________
L.Chung |
||
|
|
|
|
|
(permalink) | |
|
Quote:
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?. |
||
|
|
|
|
|
(permalink) |
|
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 |
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) |
|
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 |
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| 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 |