If you’ve worked (or played) much with Arduinos, you’ve probably run into “dead pins” – or wondered if you had. How can you tell which pins, if any, are unusable on an otherwise perfectly good board?
There are probably more precise ways of determining what is wrong, and perhaps even ways to repair some defects…but for those of us embedded folk who work far more with software than hardware, this is a quick way to confirm which pins don’t work properly with sufficient precision so you can label the board and move on. To quote Steve Jobs, “Real artists ship.” 🙂
To test digital pins, you need to test both pinModes: INPUT and OUTPUT. (There is also INPUT_PULLUP, but that is only relevant if using the internal resistors vs. external ones.) I created two sketches, one to test pins with a call to digitalWrite() to light up connected LEDs, and one to read a switch using digitalRead(). Those are the software components necessary, and they’re available at my ArduinoPinTests GitHub repository.
The hardware portion of the test can be easily assembled as well. Here are the items I used; feel free to substitute similar components as desired:
- Solderless breadboards (2, one for each: input & output)
- LEDs (6)
- Resistors, 220 Ohm (6) (for output test board)
- Resistors, 10k Ohm (2) (for input test board)
- microtivity IM211 push-and-lock switch (for input test board)
- Necessary wires to put it all together
It has been said that a picture is worth a thousand words. Here are two thousand for you!
Digital Pins (In) Test Board
Digital Pins (Out) Test Board
The Bottom Line
If you have pins you think may be dead on your Arduino or clone board, grab some spare parts, visit my GitHub repo, and within minutes you can find out if/which pins are out of commission and get back to configuring devices and pounding out code. Now…back to business!
All the best,