Arduino, two buttons powering and digital inputs in the same time

Hi, I have following circuit:

It's key fob for remote lock. In order to save the battery arduino starts up (powered) only when one of those buttons are pressed (I know about sleep modes and stuff like that, but I prefer to avoid it). Press button, power on arduino, arduino determines which button is pressed and doing something - that's complete behaviour.

The question is: can it somehow burn Arduino or it's input pins (overvoltage), if Arduino is connected to 12v battery through it's RAW pin?

Watch out for

  1. Bat2 being out of limits for the Arduino to work correctly (I dont know the figures for that).
  2. When the 12v batt is connected you may get backflow of current through bat2 if the voltage is lower than output of on board reg. You could add a diode to prevent that though.

I cant see how input pins would be overvolted though.

What voltage is bat2?

yendis:
I cant see how input pins would be overvolted though.
What voltage is bat2?

It doesn't really matter what voltage is on the battery (say 10v), overvoltage is described here:

Changing to RAW doesn't change a thing.

Also, using sleep mode is wayyyyy better. No hassle of start up times and you can put the ATmega in a low power mode all the time. Now you're just wasting it when you power the ATmega up with everything enabled. Just put the ATmega to sleep, remove the power LED and most important, turn of the transmitter.

septillion:
Changing to RAW doesn't change a thing.

Also, using sleep mode is wayyyyy better. No hassle of start up times and you can put the ATmega in a low power mode all the time. Now you're just wasting it when you power the ATmega up with everything enabled. Just put the ATmega to sleep, remove the power LED and most important, turn of the transmitter.

Yeah yeah yeah sleep mode always better I know it :slight_smile: So input pin protection is still necessary as it suggested on stackexchange right?

So why not use that easy route?????

What do you mean with protect the inputs? The diodes are only there to use two buttons and GND stays GND... Btw, use schottky diodes so you're sure you don't drive the pin out of spec :wink:

septillion:
So why not use that easy route?????
What do you mean with protect the inputs? The diodes are only there to use two buttons and GND stays GND... Btw, use schottky diodes so you're sure you don't drive the pin out of spec :wink:

Not using this route because "unknown" amount of power will be consumed by the internal voltage regulator in this case + removing power led + more complicated logic, but I'll keep it for the plan B :slight_smile:

By protect inputs I mean suggestions from stackexchange (latest circuit), as you can see there is another couple of diodes connected to input pins to make sure that there is no "out of spec" voltage. Schottky will help, but won't solve everything.

Power reg => you can look up
Not removing power led (even in this circuit) => If you can't do a simple thing like that why bother saving power in the first place?
More complicted logic => I can't see any

And for the question, you're on THIS forum now, not on stackexchange. Post updates here or just abandon this thread...

septillion:
Power reg => you can look up

I know that I can, same as I know that it will be more than zero, so I don't see any reason to feed it while I don't need it.

septillion:
Not removing power led (even in this circuit) => If you can't do a simple thing like that why bother saving power in the first place?

I can do it sure, but I'm not trying to solve the problem using brute-force methods, so if I don't need the device to be powered while I'm not using it, first thing for me will be to look how I can make it to be completely powered off, well if this doesn't work, then I always have another solution.

septillion:
More complicted logic => I can't see any

Well that's good for you, but to me switching off RF transiever, putting Arduino into deep sleep, reacting on interrupts, waking up looks more complicated than what I've described.

septillion:
And for the question, you're on THIS forum now, not on stackexchange. Post updates here or just abandon this thread...

Wow, had a bad day? We are here first of all to help each other to solve the problems related with Arduino isn't it? And I really doubt that you're the one who's in charge of saying somebody (not just me), something like "...or just abandon this thread". Say it to yourself when looking at yourself at the mirror next morning :wink:

I'm really not the only one that considers that cross posting :wink: If you want help, all the up to date info should be in the thread, not somewhere on the internet.

And brute force method??? Powering the arduino + tranceiver via a button matrix and relying on someone pressing the button long enough is more brute force in my book...

matveev-ruslan:
Wow, had a bad day? We are here first of all to help each other to solve the problems related with Arduino isn't it? And I really doubt that you're the one who's in charge of saying somebody (not just me), something like "...or just abandon this thread". Say it to yourself when looking at yourself at the mirror next morning :wink:

I agree with septillon. Referring us to some other (long-winded thread) on another forum put me off bothering to contribute any more.

septillion:
I'm really not the only one that considers that cross posting :wink: If you want help, all the up to date info should be in the thread, not somewhere on the internet.

Okay then I'm sorry for my words.

septillion:
And brute force method??? Powering the arduino + tranceiver via a button matrix and relying on someone pressing the button long enough is more brute force in my book...

Who said that it's complete circuit? :wink: There is another part which is responsible for keeping Arduino "on" while it's doing it's job and switching it off only when it's done.

I just don't know how to explain suggestions given me by the people from other forums rather than copy paste. So let's start it this way... a friend of mine (he is not forum member at all, and of course he is not "another" forum member, he is not using internet at all), okay so that is what was his words when I've presented this circuit to him:

Issue is that when you press a button, the corresponding pin will be connected directly to ground, which will be at -0.7V relative to the processor's ground (also already noted). That may generate a current from the processor's ground, through the pin's internal protection diode, and then out the pin to the actual ground. If that happens, it could be a lot of current, because there's no resistors anywhere in the circuit to control it. On other hand, if the internal diodes have the same forward voltage as your external diodes then maybe no current. But it seems iffy.

But I'm not sure, if this suggestion is still applicable in the scenario where Arduino is connected through RAW pin to 12v battery. Unfortunately I can't forward this question to my friend, because he's on vacation now, so I need your help guys!

matveev-ruslan:
Who said that it's complete circuit? :wink: There is another part which is responsible for keeping Arduino "on" while it's doing it's job and switching it off only when it's done.

then, you should have included this 'another part' in the circuit, always better to play with all cards in hand . And remember that if that 'another part' is activated by an arduino output, push the buttons need to be pushed long enough (several seconds) to allow the arduino to start up and launch its sketch

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.

alnath:
And remember that if that 'another part' is activated by an arduino output, push the buttons need to be pushed long enough (several seconds) to allow the arduino to start up and launch its sketch

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. :grinning:

my bad :slight_smile:

Paul__B:
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?

Paul__B:
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. :grinning:

That's exactly what I have, I've ruined bootloader and uploaded my sketch directly, so startup time is fast enough for me.

matveev-ruslan:
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.

Paul__B:
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. :grinning:

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...

septillion:
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).

septillion:
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.

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.