Go Down

Topic: Testing Arduino Boards, I/O Pins etc.. Test Shield - Test Software (Read 10008 times) previous topic - next topic


Jan 28, 2011, 11:12 am Last Edit: Jan 31, 2011, 01:45 pm by Terry King Reason: 1
Hello! This place smells New...

So I'm testing a bunch or Arduinos of various pedigrees.  I built a Test Shield that has a 220 ohm resistor from every IO pin except 0,1,13
They all join at a common isolated point. The point also has 2 100K resistors from Ground and +5 to it.  So at Reset, everyones an Input, the common point goes right to 2.5Volts unless some pin is shorted or leaky, and I test for that as the first test, using A0.

Then, I walk thru all the pins, first with one pin sinking, and test all the others for ability to source current, then one pin sourcing and each other pin tested for ability to sink current (about 10ma)..Then the reverse, testing sourcing ability. So, in those cases the common point also is right about 2.5 volts unless there is a contact problem or a damaged IO.

Then, I read 3 different voltages with all the Analog Inputs A0..A5 and display them.

So that all works pretty well. This is a "Self-Test" with "Test Fixture" approach.  More elaborate testing could be done, but that would take another Arduino and quite a bit of added hardware and fixturing.  This covers a lot with just 19 resistors and code.

SO: I have a web page with this stuff on it: http://terryking.us/arduino-testing.htm

Here's a quick look at a Test Shield:

Umm.. and I'll try to put the CODE here. Maybe. (OK, Too Big. This is a fragment...) See the Website.

Where should stuff like this go in the New Forum??


//--------------------( TEST 3 )----------------------------------------

  Serial.println("TEST 003 - Digital Pins Sink Current"); 
  pinMode(2, OUTPUT);      // Set Load pin to Output mode
  digitalWrite(2, HIGH);              // Connect HIGH Load 
  FailArrayPtr    =  0 ;

  //---------( Write the Digital Pin Labels )------------

  //------( Loop thru pins, testing )----------- 
  for (  DigPort2Test = FirstDigPort;
         DigPort2Test <= LastDigPort;
         DigPort2Test ++)
  {//Loop thru Source Tests
    FailArrayPtr ++ ;

    pinMode(DigPort2Test, OUTPUT);      // Set tested pin to Output mode
    digitalWrite(DigPort2Test, LOW);  // Pin Sinks current LOW   
    IntVoltsRead = analogRead(A0);
    FloatVoltsRead = a2d2float (IntVoltsRead);
    pinMode(DigPort2Test, INPUT);      // ReSet tested pin to Input mode   

    Serial.print("   ");     

    if (FloatVoltsRead > LowVoltResultOK
      &&  FloatVoltsRead < HighVoltResultOK)
      FailArray[FailArrayPtr]  = 0;      
      Failure ++;   
      FailArray[FailArrayPtr]  = 1;

  }//END Loop thru Source Tests


The Test Output looks like this:
Code: [Select]
Arduino Board Test V1.07
Arduino-Direct.com terry@arduino-direct.com

--- TEST START ---
TEST 001 - Any stuck pins??
VoltsRead = 2.50  -- OK!

TEST 002 - Digital Pins Source Current
PIN-3  PIN-4  PIN-5  PIN-6  PIN-7  PIN-8  PIN-9  PIN-10  PIN-11  PIN-12  
2.49   2.50   2.49   2.50   2.50   2.51   2.51   2.52   2.53   2.44  
-OK-   -OK-   -OK-   -OK-   -OK-   -OK-   -OK-   -OK-   -OK-   -OK-  
TEST 003 - Digital Pins Sink Current
PIN-3  PIN-4  PIN-5  PIN-6  PIN-7  PIN-8  PIN-9  PIN-10  PIN-11  PIN-12  
2.55   2.54   2.53   2.52   2.52   2.52   2.51   2.49   2.49   2.58  
-OK-   -OK-   -OK-   -OK-   -OK-   -OK-   -OK-   -OK-   -OK-   -OK-  

TEST 004 - Analog Pins Source Current
PIN-1  PIN-2  PIN-3  PIN-4  PIN-5  
2.47   2.49   2.49   2.50   2.51  
-OK-   -OK-   -OK-   -OK-   -OK-  
TEST 005 - Analog Pins Sink Current
PIN-1  PIN-2  PIN-3  PIN-4  PIN-5  
2.52   2.50   2.50   2.49   2.48  
-OK-   -OK-   -OK-   -OK-   -OK-  

TEST 006 - Analog Pins A0 to A5: A to D (About 2.50 V)
PIN-0  PIN-1  PIN-2  PIN-3  PIN-4  PIN-5  
2.48   2.48   2.48   2.48   2.48   2.48  

TEST 007 - Analog Pins A0 to A5: A to D (About 3.33 V)
PIN-0  PIN-1  PIN-2  PIN-3  PIN-4  PIN-5  
3.32   3.32   3.32   3.32   3.32   3.32  

TEST 008 - Analog Pins A0 to A5: A to D (About 1.66 V)
PIN-0  PIN-1  PIN-2  PIN-3  PIN-4  PIN-5  
1.65   1.65   1.65   1.65   1.65   1.65  

OK. let's see if all this stuff worked...

Regards, Terry King  ..On the Red Sea at KAUST.edu.sa


Cool, an arduino test shield. Never thought about that. Thanks for sharing.
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter


Jan 29, 2011, 09:27 am Last Edit: Jan 29, 2011, 09:29 am by Staedtler Reason: 1

I am building one!

Edit: Seriously, that 9500 characters limit is not fixed after all the changes?
Eight bytes walk into a bar. The bartender asks, 'Can I get you anything?'
- 'Yeah', reply the bytes. 'Make us a double'.


Hi guys,

Make sure you look at the updated photos if you are using that SeeedStudio Proto Board V1.0.
Here: http://terryking.us/arduino-testing.htm

It was a little unclear where the pin strips go on that Proto board to fit into Arduino. The new photos show just where those strips go and that it is better to have the leftmost resistor leads go OVER the soldered pins to the farther holes. (Might make sense if you see the photo  :) )

Fortunately, 55 years of soldering burns reminded me to physically fit the whole thing together before plugging the iron in.

HINT: It also works well when soldering pins in a shield to first put the pin strips ( long-pins down)  into an Arduino, and then put the shield circuit board down over them. I quick-solder the end pads on each strip and them remove the shield and solder all of them. This way the pins ARE aligned right to start...

I think Seeed intended that it be possible to stack this shield, by putting two sets of pins, male downward and raised female upwards, like some other shields and most proto boards. But maybe they miscounted the rows, like I did at first  :0

Anyway, it works :-)

Comments and suggestions appreciated!


Aug 16, 2013, 11:13 pm Last Edit: Aug 16, 2013, 11:52 pm by TaylorHicks Reason: 1
I know this is an old thread but it seems appropriate to ask this here rather than to start a new thread with a link to this one. I was wondering if I could substitute the 100k ohm resistors for 10k ohm resistors and the 220 omh resistors for 560 ohm resistors without any problems. Sorry if this is a noob question but I am a noob. I have done some math and believe that this setup would source/sink at most ~4.5 mA at the pins and an additional .25 mA at +5v and ground.


Hello Taylor,
This should work if those are the resistors you have at hand. 

The 10K instead of 100K would create a little error in the pullup/pulldown results and the analog tests values. You COULD edit the code to change the values at which error are reported.

If you are making a one-off version of this, maybe find some higher value resistors or put 4 or 5 10 Ks in series?
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info


Umm.. and I'll try to put the CODE here. Maybe. (OK, Too Big. This is a fragment...) See the Website.

If you want place your sketch here you can click on Additional Options... (see lower left corner of Post/Reply text window) and upload the PDE/INO file that way.
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!


Hello Everyone,

The information on this approach to testing and Arduino's I/O pins for pullup and pulldown capability and Analog inputs for accuracy has been placed on the INFO on theArduinoInfo.Info WIKI HERE: 

This CODE can be cut/pasted here: http://arduino-info.wikispaces.com/Arduino_Test
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

Go Up