Saturday 27 May 2017

arduino - I burnt a pin. Now, what do I do?


I accidently shorted pins 10 and 11 with 10 set to output HIGH and 11 set to input. The pin 11 is not working. How do I figure out what component I burned?


Can the problem be fixed?



Answer



Assumption: As the specific Arduino model has not been specified, using the Arduino Uno to illustrate this answer. The rationale applies identically to the other Arduinos, for their respective pin-outs and microcontroller operating voltages.


Please refer to this pin-out diagram for the Arduino Uno: (source)




Arduino Uno pin-out






  • As can be seen, Pin 10 and 11 are both standard GPIO pins.

  • Any GPIO can not output a voltage higher than the microcontroller's supply voltage (VCC), in the Arduino. For the Uno VCC is 5 Volts.

  • Any GPIO pin can withstand input voltage up to VCC and a slight bit higher (5.5 Volts is tolerated as standard)

  • Also, when any Arduino GPIO is set to input, it is in a high impedance state, thus making it impossible to pass enough current into it for the voltages involved, for any damage to occur.

  • Thus, shorting pins 10 and 11 can not cause any damage to either pin, in the circumstances reported in the question.


Now let us examine the alternative possibilities:



  • If the Uno is powered from the DC barrel jack instead of 5 volts from the USB connection or other regulated power supply, the Vin pin outputs 1 diode drop lower than this input voltage: This would be around 8.3 Volts if the supply is a 9 Volt battery attached to the barrel jack.


  • Shorting this VIN pin to any of the analog or digital pins of the Arduino (other than specific pins which are protected by resistors) is very likely to destroy either the internal ESD diode / protection circuitry for that pin within the microcontroller, or destroy the microcontroller itself. This could be the cause of the problem.

  • Another hypothesis is that Pin 11 was exposed to some other source of high voltage, beyond the board's Vcc. This could be due to back-EMF from a motor, or from the high voltage (can be 10+ volts) generated by a piezoelectric bender (piezo speaker) if it is knocked against something. This could cause damage to ESD diodes / protection circuitry as noted above

  • Next, electrostatic discharge from static electricity can damage any given GPIO pin even while the device is not powered up. Did you happen to comb your hair and then touch the Arduino board at some point, for example? The problem will only show up later, when attempting to use that pin on the board, so causality is often difficult to pin-point.

  • Finally, if two pins are both set to output, one set high and the other low, and these are shorted, the "High" pin sees a short to ground through the "Low" pin. This source to sink contention can cause the microcontroller to heat up, and though the AVR microcontrollers typically have output protection on GPIOs, this may cause one or the other of the pins to stop functioning - though the entire microcontroller failing is more likely in this case.




Having said all that, if for whatever reason Pin 11 no longer performs input or output, the MCU's corresponding internal protection circuitry is irrevocably damaged. There is no way to repair this. This has been covered well in the answer by Manishearth.


Consider yourself fortunate that the entire microcontroller did not get destroyed, and re-code your applications to not use Pin 11 any more.


Personal tip: I've blocked the VIN sockets on my Arduino boards a long time ago by sticking some stripped insulation into them, to avoid ever accidentally exposing any jumper wire to that voltage. If I ever actually need to use VIN some day, I'll spend a delightful hour struggling to extract that bit of insulation stuck in there.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...