Automatic test shield for Arduino Uno

Hello Arduino fans!

Is there an automatic test shield + test code available for the Arduino Uno?

We have a LOT of Arduino uno's at school. And when I give an Arduino to our students I want to be sure that I'm not giving a fried version with a blown I/O pin for example. Nothing is more frustrating for a student to search for a bug in their code while the Arduino is fried by a previous user.

So I want to do a complete functional test (like a production test) when I get the boards back. Any suggestions? I couldn't find such a thing on the web...

Thanks in advance!

I haven't seen one, but I don't think it would be that hard to make one.

What would your requirements be for the "test" ?

Did you have real cases that prompted you to seek solution? If so what happened?

You want to make a possible damaged controller test itself?

A simple shield will connect each pair of digital pins by two antiparallel LEDs (+ resistors): Then make the LEDs flicker slowly so that you can find out which pair has a damage.

For the analog inputs build a daisy chain of resistors with both ends going to a pair of digital pins. This allows to test each input for correct Vcc (1023) and GND (0) connection as well as increasing or decreasing values from A0 to the highest input pin.

You can do some testing with some pin strips. Wire all of the I/O pins together. Set all pins to INPUT.

For each pin:

  1. set it to OUTPUT
  2. set the OUTPUT pin to HIGH
  3. check for HIGH on all of the other pins
  4. check for analogRead() == 1023 on the analog input pins
  5. set the OUTPUT pin to LOW
  6. check for LOW on all of the other pins
  7. check for analogRead() == 0 on the analog input pins
  8. set the pin back to INPUT

If that test passes you can at least be fairly sure that the I/O pins and analog inputs are all working.

1 Like

@johnwasser
clever solution John! Checks the hardware i/o and also the programming and operation of the arduino.

Here is a design of an Arduino Test Shield: https://www.instructables.com/Arduino-Basic-Test-Shield/
This is not sold.

You may also want to check the voltage regulators which are vulnerable to abuse.
The 3.3volt regulator could be checked via an analog pin (or a led).
The 5 volt regulator could simply be checked by powering the Uno via the jack instead of the USB connection.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project :wink: See About the Installation & Troubleshooting category.

There was a similar question not too long ago(maybe in the last three month); you can try a search on the forum.

Thanks for the replies!

@ killzone_kid

Did you have real cases that prompted you to seek solution? If so what happened?

Yes there are some fried Arduino's here. You will never know what happened exactly but I can make an estimated guess... They are using motor shields on 12V, breadboards etc... So it is not unthinkable that a student connects a 12V to an I/O pin by accident.

@ bidrohini
Thanks! I see that company had the same sort of problems that I face here... But the code is gone.

@ johnwasser
Yes these steps are necessary to test such a board. Looping back its own outputs to its inputs and vice versa.

Before I started my job on a school I've been designing hardware for years and also test beds for it. One of my smaller products and test bed is shown here below. So I know what it takes to do automatic programming and perform a production test on hardware.

But an Arduino is just so simple and sold in HUGE amounts... So I would think that there are some simple test tools for it already...?

If there is demand there is a product. I only guess there is not much demand for it so people make it themselves as this is not a brain surgery

Note that any "prototyping shield" can be wired to connect all the pins together. Here is one for $5.

1 Like

expanding the list:

  • D1/TX ... print a welcome message i n your testsketch - D1 is ok for outputs
  • D0/RX ... enter something on the console in your testsketch and print it to D1. D0 is ok for read
  • Now you have at least two working Digital Pins you can start with
  • EEPROM: read 1023 bytes
  • EEPROM: write 1023 bytes
  • EEPROM: read back EEPROM and compare if everything is ok
  • EEPROM: write with a "last tested on compilation date" at the end. at the end of the eeprom

You can search it on amazon

Where?! Really. Where?

On the following link, Adafruit have a self-test for their multi-sensor FunHouse board:

Modify their code for your needs:

// SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
//
// SPDX-License-Identifier: MIT

#include <Adafruit_DotStar.h>
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <Adafruit_DPS310.h>
#include <Adafruit_AHTX0.h>

#define NUM_DOTSTAR 5
#define BG_COLOR ST77XX_BLACK
#define ST77XX_GREY 0x8410   // Colors are in RGB565 format

// display!
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RESET);
// LEDs!
Adafruit_DotStar pixels(NUM_DOTSTAR, PIN_DOTSTAR_DATA, PIN_DOTSTAR_CLOCK, DOTSTAR_BRG);
// sensors!
Adafruit_DPS310 dps;
Adafruit_AHTX0 aht;

uint8_t LED_dutycycle = 0;
uint16_t firstPixelHue = 0;

void setup() {
  //while (!Serial);
  Serial.begin(115200);
  delay(100);
  
  pixels.begin(); // Initialize pins for output
  pixels.show();  // Turn all LEDs off ASAP
  pixels.setBrightness(20);

  pinMode(BUTTON_DOWN, INPUT_PULLDOWN);
  pinMode(BUTTON_SELECT, INPUT_PULLDOWN);
  pinMode(BUTTON_UP, INPUT_PULLDOWN);

  //analogReadResolution(13);
  
  tft.init(240, 240);                // Initialize ST7789 screen
  pinMode(TFT_BACKLIGHT, OUTPUT);
  digitalWrite(TFT_BACKLIGHT, HIGH); // Backlight on

  tft.fillScreen(BG_COLOR);
  tft.setTextSize(2);
  tft.setTextColor(ST77XX_YELLOW);
  tft.setTextWrap(false);

  // check DPS!
  tft.setCursor(0, 0);
  tft.setTextColor(ST77XX_YELLOW);
  tft.print("DP310? ");

  
  if (! dps.begin_I2C()) {  
    tft.setTextColor(ST77XX_RED);
    tft.println("FAIL!");
    while (1) delay(100);
  }
  tft.setTextColor(ST77XX_GREEN);
  tft.println("OK!");
  dps.configurePressure(DPS310_64HZ, DPS310_64SAMPLES);
  dps.configureTemperature(DPS310_64HZ, DPS310_64SAMPLES);

  // check AHT!
  tft.setCursor(0, 20);
  tft.setTextColor(ST77XX_YELLOW);
  tft.print("AHT20? ");
  
  if (! aht.begin()) {  
    tft.setTextColor(ST77XX_RED);
    tft.println("FAIL!");
    while (1) delay(100);
  }
  tft.setTextColor(ST77XX_GREEN);
  tft.println("OK!");

  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(SPEAKER, OUTPUT);

  ledcSetup(0, 2000, 8);
  ledcAttachPin(LED_BUILTIN, 0);

  ledcSetup(1, 2000, 8);
  ledcAttachPin(SPEAKER, 1);
  ledcWrite(1, 0);
}



void loop() {


  /********************* sensors    */
  sensors_event_t humidity, temp, pressure;
  
  tft.setCursor(0, 0);
  tft.setTextColor(ST77XX_YELLOW, BG_COLOR);
  dps.getEvents(&temp, &pressure);
  
  tft.print("DP310: ");
  tft.print(temp.temperature, 0);
  tft.print(" C ");
  tft.print(pressure.pressure, 0);
  tft.print(" hPa");
  tft.println("              ");
  Serial.printf("DPS310: %0.1f *C  %0.2f hPa\n", temp.temperature, pressure.pressure);


  tft.setCursor(0, 20);
  tft.setTextColor(ST77XX_YELLOW, BG_COLOR);
  aht.getEvent(&humidity, &temp);

  tft.print("AHT20: ");
  tft.print(temp.temperature, 0);
  tft.print(" C ");
  tft.print(humidity.relative_humidity, 0);
  tft.print(" %");
  tft.println("              ");
  Serial.printf("AHT20: %0.1f *C  %0.2f rH\n", temp.temperature, humidity.relative_humidity);


  /****************** BUTTONS */
  tft.setCursor(0, 40);
  tft.setTextColor(ST77XX_YELLOW);
  tft.print("Buttons: ");
  if (! digitalRead(BUTTON_DOWN)) {  
    tft.setTextColor(ST77XX_GREY);
  } else {
    Serial.println("DOWN pressed");
    tft.setTextColor(ST77XX_WHITE);
  }
  tft.print("DOWN ");

  if (! digitalRead(BUTTON_SELECT)) {  
    tft.setTextColor(ST77XX_GREY);
  } else {
    Serial.println("SELECT pressed");
    tft.setTextColor(ST77XX_WHITE);
  }
  tft.print("SEL ");
  
  if (! digitalRead(BUTTON_UP)) {  
    tft.setTextColor(ST77XX_GREY);
  } else {
    Serial.println("UP pressed");
    tft.setTextColor(ST77XX_WHITE);
  }
  tft.println("UP");

  /************************** CAPACITIVE */
  uint16_t touchread;
  
  tft.setCursor(0, 60);
  tft.setTextColor(ST77XX_YELLOW, BG_COLOR);
  tft.print("Captouch 6: ");
  touchread = touchRead(6);
  if (touchread < 10000 ) {  
    tft.setTextColor(ST77XX_GREY, BG_COLOR);
  } else {
    tft.setTextColor(ST77XX_WHITE, BG_COLOR);
  }
  tft.print(touchread);
  tft.println("          ");
  Serial.printf("Captouch #6 reading: %d\n", touchread);
  
  tft.setCursor(0, 80);
  tft.setTextColor(ST77XX_YELLOW, BG_COLOR);
  tft.print("Captouch 7: ");
  touchread = touchRead(7);
  if (touchread < 20000 ) {  
    tft.setTextColor(ST77XX_GREY, BG_COLOR);
  } else {
    tft.setTextColor(ST77XX_WHITE, BG_COLOR);
  }
  tft.print(touchread);
  tft.println("          ");
  Serial.printf("Captouch #7 reading: %d\n", touchread);


  tft.setCursor(0, 100);
  tft.setTextColor(ST77XX_YELLOW, BG_COLOR);
  tft.print("Captouch 8: ");
  touchread = touchRead(8);
  if (touchread < 20000 ) {  
    tft.setTextColor(ST77XX_GREY, BG_COLOR);
  } else {
    tft.setTextColor(ST77XX_WHITE, BG_COLOR);
  }
  tft.print(touchread);
  tft.println("          ");
  Serial.printf("Captouch #8 reading: %d\n", touchread);


  /************************** ANALOG READ */
  uint16_t analogread;

  tft.setCursor(0, 120);
  tft.setTextColor(ST77XX_YELLOW, BG_COLOR);
  tft.print("Analog 0: ");
  analogread = analogRead(A0);
  if (analogread < 8000 ) {  
    tft.setTextColor(ST77XX_WHITE, BG_COLOR);
  } else {
    tft.setTextColor(ST77XX_RED, BG_COLOR);
  }
  tft.print(analogread);
  tft.println("    ");
  Serial.printf("Analog A0 reading: %d\n", analogread);


  tft.setCursor(0, 140);
  tft.setTextColor(ST77XX_YELLOW, BG_COLOR);
  tft.print("Analog 1: ");
  analogread = analogRead(A1);
  if (analogread < 8000 ) {  
    tft.setTextColor(ST77XX_WHITE, BG_COLOR);
  } else {
    tft.setTextColor(ST77XX_RED, BG_COLOR);
  }
  tft.print(analogread);
  tft.println("    ");
  Serial.printf("Analog A1 reading: %d\n", analogread);

  
  tft.setCursor(0, 160);
  tft.setTextColor(ST77XX_YELLOW, BG_COLOR);
  tft.print("Analog 2: ");
  analogread = analogRead(A2);
  if (analogread < 8000 ) {  
    tft.setTextColor(ST77XX_WHITE, BG_COLOR);
  } else {
    tft.setTextColor(ST77XX_RED, BG_COLOR);
  }
  tft.print(analogread);
  tft.println("    ");
  Serial.printf("Analog A2 reading: %d\n", analogread);

  tft.setCursor(0, 180);
  tft.setTextColor(ST77XX_YELLOW, BG_COLOR);
  tft.print("Light: ");
  analogread = analogRead(A3);
  tft.setTextColor(ST77XX_WHITE, BG_COLOR);
  tft.print(analogread);
  tft.println("    ");
  Serial.printf("Light sensor reading: %d\n", analogread);
  
  /************************** Beep! */
  if (digitalRead(BUTTON_SELECT)) {  
     Serial.println("** Beep! ***");
     fhtone(SPEAKER, 988.0, 100.0);  // tone1 - B5
     fhtone(SPEAKER, 1319.0, 200.0); // tone2 - E6
     delay(100);
     //fhtone(SPEAKER, 2000.0, 100.0);
  }
  
  /************************** LEDs */
  // pulse red LED
  ledcWrite(0, LED_dutycycle);
  LED_dutycycle += 32;
  
  // rainbow dotstars
  for (int i=0; i<pixels.numPixels(); i++) { // For each pixel in strip...
      int pixelHue = firstPixelHue + (i * 65536L / pixels.numPixels());
      pixels.setPixelColor(i, pixels.gamma32(pixels.ColorHSV(pixelHue)));
  }
  pixels.show(); // Update strip with new contents
  firstPixelHue += 256;
}


void fhtone(uint8_t pin, float frequency, float duration) {
  ledcSetup(1, frequency, 8);
  ledcAttachPin(pin, 1);
  ledcWrite(1, 128);
  delay(duration);
  ledcWrite(1, 0);
}

This link to the Arduino Uno R3 has loads of information (in text form, not just charts of numbers) on the available pins and their use.

It is always good to build test jigs to make your work more accurate or easier. My tool kit was full of home-made jigs. I hope you get one done for Arduino.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.