Go Down

Topic: Arduino, two buttons powering and digital inputs in the same time (Read 1 time) previous topic - next topic


matveev-ruslan

OK, as to the original question, let's be clear - you are applying a negative 0.7 V to the input pin when you press the button, which is somewhat out-of-spec and will to some extent be stressing the input protection diodes.

You can correct for this by putting a 4k7 resistor in series with each input.  Note that you show no pull-ups so you cannot reliably read the inputs unless you set the input pins to INPUT_PULLUP.
Yes I use internal pullups of course, but what do you mean by "applying a negative 0.7V to the input pin"? Where this "0.7V" is coming from?

The Arduino does not require several seconds to start up - only milliseconds.
You are getting confused with the bootloader which waits a few seconds to see if a download is required, but this happens on reset, not power-up. :smiley-lol:
That's exactly what I have, I've ruined bootloader and uploaded my sketch directly, so startup time is fast enough for me.

septillion

Yes I use internal pullups of course, but what do you mean by "applying a negative 0.7V to the input pin"? Where this "0.7V" is coming from.
Simple, that's the voltage drop across the diode. So your GND is 0,7V higher then battery-. So by applying battery- to an input the input is -0,7V with respect to GND which is out of spec. That's why I said, use a Schottky (but you ignored). But a resistor in line with the input will work as well.

You are getting confused with the bootloader which waits a few seconds to see if a download is required, but this happens on reset, not power-up. :smiley-lol:
If you have a Uno (or Optiboot) Arduino, yeay. But he never told us what kind of Arduino he's using. A Pro Mini always waits with the default bootloader. And he told us just now he programmed the uC directly. He's skipping quite a lot of info...
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

matveev-ruslan

Simple, that's the voltage drop across the diode. So your GND is 0,7V higher then battery-. So by applying battery- to an input the input is -0,7V with respect to GND which is out of spec. That's why I said, use a Schottky (but you ignored). But a resistor in line with the input will work as well.
I did not ignore it, I said that I'm already using Schottky diodes, but even with them there is no guarantee that the voltage drop will be low (because it also depends on the temperature).

If you have a Uno (or Optiboot) Arduino, yeay. But he never told us what kind of Arduino he's using. A Pro Mini always waits with the default bootloader. And he told us just now he programmed the uC directly. He's skipping quite a lot of info...
My question was not about decreasing boot time or reflashing Arduino, that's why I didn't mention it. It's just not important, doesn't change anything in terms of circuit.

matveev-ruslan

Another question, what is going to be the problem if I'll change original circuit so it uses positive logic, as such:



Keep in mind that "+5v" pin is actually "RAW" pin.

MisDev

Why would that be a problem? Just change the program.
Also the equivalent to the RAW pin in VIN. The +5V pin is for 5 volts.

matveev-ruslan

Why would that be a problem? Just change the program.
Also the equivalent to the RAW pin in VIN. The +5V pin is for 5 volts.
Because in last circuit voltage that is going into the digital pins more than arduino supply?


MisDev

Ah, right.
12V-5V=7V
7V/acceptable current=Resistorvalue
Only thing you need to change is to add a current-limiting resistor before the digital in(s..).

Don't remember what current it's acceptable to feed digital in with.

matveev-ruslan

Don't remember what current it's acceptable to feed digital in with.
I guess that it cannot be more than power supply ;)


MisDev

I'll just steal retroleftys answer about essentially doing the same thing.
Well I will go against the gain here and say there is a way to safely wire a +12vdc digital signal to a arduino digital input pin. It requires that you wire it through a series resistor of a high enough resistance such that the positive clamping protection diode for the input pin will be current limited to at or below it's maximum rated continuous forward current rating, around 1 ma I think. The clamping voltage will hold the input voltage equal to chip Vcc + Vf of the clamping diode.

Paul__B

The only reason I said 4k7 was because it will reliably pull down against the internal pull-up.

Otherwise, the value is 47k, between the switch & pull-down resistor, and the input.

matveev-ruslan

What about this one?



As far as I can see it solves all my previous problems with digital pins overvoltage and so on...
Am I right?

MisDev

Vf for the diode is a miniumum of 0.8V and a maximum of 1.5V, both depending on the ambient temperature (see Datasheet, page 2)
As it has a If of 10mA you need a resistor of (12V-1V)/10mA=1k1Ω in series with the diode.

matveev-ruslan

Vf for the diode is a miniumum of 0.8V and a maximum of 1.5V, both depending on the ambient temperature (see Datasheet, page 2)
As it has a If of 10mA you need a resistor of (12V-1V)/10mA=1k1Ω in series with the diode.
What can you say about version on optocouples?

Go Up