PIN 13 as INPUT_PULLUP burned power supply

Hi, Quick question, I have configured pin 13 as INPUT_PULLUP and connected switch to it without resistor. After boot arduino started to boot continously, never got out of setup.

I quickly discovered that power supply gave 15V instead of 12V (Im using DC-DC 5V regulator) and regulator output was fliqering from 1V to 5V.

After changing pin 13 to normal OUTPUT it hanged after a while, so I changed PS and problem was solved.

But is it possible that pin 13 could destroy power supply? Output of it is still 15V.

The pin itself, no. A bad connecting can. Was the button connected between GND and pin 13 of did you connect it between the power supply and pin 13. The last can kill things but the Arduino is most likely...

PS, pin 13 is shared with a LED on a lot of boards and might be hard to pull high. You didn't told us which Arduino so...

Also, keep in mind that some bootloaders like optiboot blink the led when the AVR is reset. So if you have a switch connected to the LED pin (pin 13) that is grounded and the AVR is reset, you end up having the bootloader trying to set a pin high that is shorted to ground.

--- bill

It was arduino nano v3, and I have just uploaded to it optiboot (needed watchdog to work properly). And I have connected it to the ground (double checked that). Arduino works fine, led 13 is flashing with full brightness.

If you have a switch/button hooked between digital pin 13 and ground without a resistor, and if the AVR is trying to drive that pin high, as it would to light the onboard LED, and the switch/button is thrown/pushed to create the connection to ground, the LED will not light and it is very likely that you will damage the AVR.

This isn't something you want to test.

--- bill

So what about other pins, can i used them as input_pullup without resistors safely? Because thats the entire idea about it, to make it simple, no resistor, 2 wires and your off. Im not very experienced in arduino but all tutorials talks about it like its normal thing

wyciu91: So what about other pins, can i used them as input_pullup without resistors safely? Because thats the entire idea about it, to make it simple, no resistor, 2 wires and your off. Im not very experienced in arduino but all tutorials talks about it like its normal thing

Yes, you can do it that way for the other pins. Pin 13 is flashed by the bootloader BEFORE the setup routine runs, so pinMode hasn't set it to _Pullup yet. So when the bootloader does "digitalWrite(13, HIGH), it's connected directly to ground.

I ran into this problem when I was using pin13 to supply either 0 or 3V to a control line on a radio receiver. After replacing my 3rd board, I figured it out ... :(

Ok thanks for that, I have one more question concerning this before setup pins state. Is it possible to set them as output of state LOW at the board startup? If I do this in setup even using

DDRD = DDRD | B11111000;
PORTD = B00000000;

which supposly is faster than digitalWrite I still get small fliqering on output, and because Im using switches they switch state at startup.

bperrybap: If you have a switch/button hooked between digital pin 13 and ground without a resistor, and if the AVR is trying to drive that pin high, as it would to light the onboard LED, and the switch/button is thrown/pushed to create the connection to ground, the LED will not light and it is very likely that you will damage the AVR.

This isn't something you want to test.

that is something that i personally have tested several times a day for last 15 years and no smoke yet. just as predicted by ohms law and most atmel specs.

arduino creators have been criticized for poor design decisions and hooking an led to gnd might be one example. those experienced and knowledgeable in hardware probably need nothing more to be said (but as usual i will anyway, lol).

there are several reasons for connecting led to vcc instead of gnd. biggest one, besides proper led wiring protocol, is you can share a button. this is why the first thing i do on all "official" arduino board designs (uno, promini, nano, etc) is rewire to vcc so that the universe will be in harmony.

ive done it so many times it only takes a few seconds and of course costs nothing in additional components.

thankfully most other boards like usbasp and atmel tools are designed correctly.

john1993: Arduino creators have been criticised for poor design decisions and hooking an led to gnd might be one example. Those experienced and knowledgeable in hardware probably need nothing more to be said (but as usual I will anyway, lol).

Without addressing the merits of this particular aspect of design, the more troubling matter is that the Arduino tutorials - which are apparently entirely immune to correction - demonstrate switches connected to Vcc, necessitating the use of pull-down resistors where this is not only bad practice, but entirely defeats the provision of a pull-up mechanism in the chip itself. :astonished:

absolutely correct. in addition to the need for additional components there is a safety issue running hot wires around with who knows how many amps hiding in them.

i do like to pick at tarduino practices but credit must be given where its due. they put avr on the map and regardless how they get there "most" of the tutorials and functions do work and save many hours of digging in from scratch. if they did everything perfectly then guys like me would have nothing to gripe about and i would just fade away. lol.

john1993 can you explain briefly what do you mean by rewiring this board led to vcc?

Btw I have rewired my pins so that I can use input_pullup on other pin, and tried to use pin 13 as OUTPUT which drives relay. Relay is this standard relay modules for arduino with optocouplers 5v, and I have the same problem as before. Constant reboot loop.

Fortunately this time power supply wasnt distroyed.

So what I have learned so far is never use pin 13 other than blinking internal led as information that program is running :/

wyciu91: Relay is this standard relay modules for arduino with optocouplers 5v,

"Standard"? You are kidding! :roll_eyes:

sorry, not' standard' as standarised but more common, cheap relay :) Im from Poland, it means smth else to me :P

wyciu91: john1993 can you explain briefly what do you mean by rewiring this board led to vcc?

normally pin goes to resistor/led which then goes to ground. i rotate the components so pin goes to resistor/led which then goes to vcc instead. several advantages but most important is you can connect a switch, or oc sensor to the same pin which is impossible with stock boards.

very helpful to share one pin for indicator and pushbutton specially if the target only has 5 pins total.

another benefit is some programming dongles fail if theres a pulldown on sck like on the stock arduino. also convenient to be able to just short sck to ground with tweezers or cliplead to troubleshoot the led or power supply.

an even quicker solution is to simply remove either the resistor or the led if not needed. snip... snip... no soldering.

The newer Arduino boards no longer drive the LED directly from an AVR pin. They buffer the signal through an opamp to drive the LED. On those boards , you don't have the pulldown load on the AVR pin of the resistor & the led going to ground.

--- bill

newer

i.e 2010