12 VDC Operation to Pins

I'm running a 12 volt system managing reversible motors, sensors, receivers, and relays for higher current action. The Mega 2560 works great at 12 VDC..

The question here is whether to use a pair of resistors to reduce HIGH and LOW inputs for the 12 volt system to ~+5 volts or ground to a Pin...
Or,
Simply send a 12 VDC or Ground signal to a digital Pin port through a resistor limiting current and voltage to the Pin. This would use the Pin current In/Out to achieve the HIGH and LOW results.
Thanks,
Ted

If by "pair of resistors" you mean a voltage divider, I'm sure that's the proper way.

It will not (or barely) limit the voltage; an input pin is high impedance so e.g. a 220R series resistor will have NO effect on the voltage.

Use voltage dividers or, even healthier, optocouplers.

1 Like

Hi, @ted_gage
This might help.
https://learn.sparkfun.com/tutorials/voltage-dividers/all

Tom... :smiley: :+1: :coffee: :australia:

I think you should post your schematic as it sounds like it may be sub optimal

1 Like

The input is only high-impedance within the normal voltage range of 0...Vcc. If you exceed this limit, the parasitic substrate diodes turn on and the current increases extremely. With a current limiting resistor, this diode may not burn out and limit the voltage, but it is best not to do so. These diodes are not designed to become conductive.
It is a similar problem if you put a HIGH signal on a pin but the chip is without supply voltage.

The injection current with VCC=5V is ±1.0mA (see page 258), but this is a stress rating only.
See post#3 for suggestions.

Hmm ... however ATMEL has used a series 1M resistor in this application that uses mains voltage!

1 Like

It will because the current will flow into the protection diodes. However, it would be foolish to rely on them as a means to reduce the voltage. As others have said, 2 resistors configured as a potential divider.

Two very good contributions already.

No no no no.

Where as this "solution" is just a No no!

As others have said a schematic of the two solutions described will help, because your words are ambiguous and words are not the language of electronics schematics are.

Note a series resistor only cuts down voltage when there is current flowing. As there will be so little current flowing through the resistor there will be a very little (the technical term is sod all) voltage drop.

They do. However it is not a beginners project and will probably prove fatal for any beginner who doesn't understand the implications of what is being done.

Think of it as an application note that is supportive to the Darwin Awards.

3 Likes

I’ve seen circuits using 5v regulators on inputs to condition the signal

OK, divider it is. As there are a number of requests or reports coming from the 12 volt system in my project, it might be a good idea to have a regulated 5 or 6 volt supply.
As an aside, the Mega2560 does not respond quickly at 5.8 volts on a HIGH read. Apparently offset some amount by running at 12 VDC. More testing to come.

Its a 12V project last I looked!

ATMEL is confident injecting 0.24mA into a 5V pin, so how about lowering this way down to 70μA. Therefore, you could safely use a 100K series resistor to create a 12V to 5V digital level converter.
image

A bit of an ambiguous comment I thought you were saying that the Atmel application note was a 12V project.

So I just looked at the application note AVR182 and it is Mains, see this screen shot.

However, you are saying that this provides a bench mark for what is acceptable to shunt through the static protection diodes.

As this rating does not appear in the processor's data sheet you can't take the quote from this application note of:-

The series resistor can also be modified somewhat to make the detection closer but note that the maximum current through the AVR’s clamping diode should not be higher than 1 mA.

as setting a parameter that has not the legal force of the actual processor's data sheet.

Also note that this application note specifies the processor ATmega163 and these days the Uno uses an ATmega328. Given that the disclaimer at the end of this application note says:-

The Company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, and does not make any commitment to update the information contained herein.

I would suspect that there has been a die revision between the two processors that involved a change in the chip's geometry, that would give the ESD clamp diodes a smaller physical area, and thus reducing their current handling capacity. Making this application note not applicable to a Uno.

Anyway using the ESD clamp diodes for, a purpose they are not designed for, is bad engineering practice.

Also note that the OP appears to misunderstand the use of a resistor in this context.

ATmega328P

On newer product families, the injection (clamp) current gets more robust ...

ATtiny24/44/84

tinyAVR 1-series

AVR128DA28/32/48/64

Yes ... I think an actual benchmark (using the ZCD module in newer AVR families) is expressed here (300μA) Scroll down to "Selecting the Current Limiting Resistor".

I wouldn't consider using the internal diodes to within 100μA bad engineering practice, but I would consider it bad practice to use an output pin greater than 20mA (up to 40mA).

Anyways, I usually recommend using optos in a noisy environment (it depends on the specific application).

If you must clamp (actually it's not a bad idea even if you have a voltage divider in place), back to back Schottky diodes to ground and VCC on the input pin, will shunt the internal diodes, while having exactly the same effect.

If this 12V is from an automotive system, none of the really simple circuits presented here are completely sufficient. For that, it's worth doing some research.

2 Likes

I would entirely agree with that. Also the 12V supply in a vehicle is likely to rise to about 15V when being driven.

@dlloyd I have searched my 328 data sheet for the word "Injection" and there are no results.

Yes I would 100% agree with you. Also suggested by @sterretje

Searching for "diode" or "clamp" or "injectiion":

  • The ATmega48A/PA/88A/PA/168A/PA/328/P datasheet indeed doesn't contain "injection". It does mention the protection diodes, but they neglect giving any specifications.

  • The ATmega328P datasheet does mention "injection" and gives the specifications.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.