user-1: I am a newbie to Arduino and created my first project. The project is using a Sharp short range sensor and a 7 seg LED board (http://embedded-lab.com/blog/new-version-of-max7219-based-4-digit-serial-seven-segment-led-display/) to count objects.
Everything works fine when on USB power to my computer or if I use a 5v 1A wall adapter with a USB cable. The problem is when I use an external power adapter or use a DC power supply to the Vin. The board powers up and I measured the output voltage on the 5v pin and is measuring around 4.8v. 
The Sharp sensor is connected to the A0 Analog in and I see the voltage fluctuate when an object passes, but the LED is not displaying a value when on the external power. The display is connected to GRD, 5v where DIN, CLK, and LOAD pins of the display are connected to pins 7, 6, and 5 as the instructions stated. 
I tried two different Arduino boards and several different AC to DC power adapters ranging from 9v to 12v plus used a DC power supply to the Vin and same results. 
The code is below and pretty simple (although I am sure there is a lot better way of doing it but this is my first project in C so go easy on me and the function for digits is from a website and not written by me).
If a picture of the project would help I can upload one.
Any ideas or thoughts?
Thanks,
Steve
#include "LedControl.h"
#include <stdio.h>
#include <math.h>

// Arduino Pin 7 to DIN, 6 to Clk, 5 to LOAD, no.of devices is 1
LedControl lc = LedControl(7, 6, 5, 1);
int sensorpin = 0;      // analog pin used to connect the sharp sensor
int val = 0;            // variable to store the values from sensor(initially zero)
int cnt = 1;

void setup()
{
    // Initialize the MAX7219 device
    lc.shutdown(0, false);   // Enable display
    lc.setIntensity(0, 10);  // Set brightness level (0 is min, 15 is max)
    lc.clearDisplay(0);     // Clear display register


}
void loop()
{


    val = analogRead(sensorpin);       // reads the value of the sharp sensor
    if (val >= 650)
    {

    //write values to LED
    if (cnt<=9)
    {
        lc.setDigit(0, 0, cnt, false); // Display 4 to Digit 1-9, " "
    }
    if (cnt >= 10 && cnt <= 99)
    {
        lc.setDigit(0, 0, getDigitFromNum(cnt,0), false); // Display 4 to Digit 1-9, " "
        lc.setDigit(0, 1, getDigitFromNum(cnt, 1), false); // Display 3 to Digit 1-9, " "
    }

    if (cnt >=100)
    {
        lc.setDigit(0, 0, getDigitFromNum(cnt, 0), false); // Display 4 to Digit 1-9, " "
        lc.setDigit(0, 1, getDigitFromNum(cnt, 1), false); // Display 3 to Digit 1-9, " "
        lc.setDigit(0, 2, getDigitFromNum(cnt, 2), false); // Display 2 to Digit 1-9, " "
    }

    delay(400);
    cnt++;

}
}

// Function: getDigitFromNum returns a digit at a given index of a integer.
// Goes from right to left with the starting index of 0.
int getDigitFromNum(int num, int digit) {
    num /= pow(10, digit);
    return num % 10;
}
// Function: getDigitFromDec returns a digit at a given index of a double.
// Goes from left to right with the starting index of 0.
int getDigitFromDec(double dec, int digit) {
    dec *= pow(10, digit);
    return (int)dec % 10;
}
// Function: getDigitFromNum returns the decimal values of a double.
double getDecimals(double dec) {
    return dec - (int)dec;
}


user4143: The only difference between powering from USB and powering through the barrel jack is the voltage is reduced to 5V through a Low Dropout (LDO) voltage regulator. These are typically a clone of the popular LM1113-50 and vary in current handling capacity from around 500mA up to 1A.
I notice your board is not a genuine Arduino - therefore the components used may be at the cheaper end. So we'll assume a low-grade LDO that only handles 500mA before going into thermal shutdown with good heatsinking. Since there isn't on these boards we shall therefore assume a maximum of 400mA before it gets too hot. Probably somewhat conservative.
So if your entire circuit is drawing more than about 400mA you can expect the regulator to shut down, or at least to reduce the current and/or voltage available.
The fact you're seeing 4.8V rather than 5V could be an indication that there is voltage droop occurring - i.e., the regulator is not able to supply enough current so the voltage drops. This would be accompanied by the regulator getting very hot.
The regulator is the device with 3 pins on the right side and a single tab on the left directly above the barrel jack socket. See how hot that is getting.
As a rule of thumb if you can hold your finger on it without crying for 10 seconds it's not too hot.

Another thing you can do is to reduce your circuit to the bare minimum. Unplug absolutely everything and upload the Blink example sketch. Power that from the external DC and see if the LED blinks for you. If it does then the power supply is working OK. You can then add your peripherals one at a time to see when it fails.
If it doesn't blink then there must be something inherently wrong with the supply.
One possibility is that the LDO is oscillating due to insufficient or incorrect input and output capacitors. This basically means the "5V" voltage it gives out is actually wildly swinging between say 4.5V and 5V or 4.75V and 5.25V, which really confuses the microcontroller. Cheap LDOs are often more sensitive to the capacitors they are paired with and can suffer from this kind of problem.
To diagnose that kind of thing you would really need access to an oscilloscope to analyse the voltage. 
If it is oscillating a 10µF ceramic capacitor connected between the lower two pins of the LDO (as orientated in your picture - that is Vout and GND) may cure it. A 1206 surface mount capacitor fits nicely across those pins and is reasonably easy to hand solder. You could also try a through-hole capacitor (ceramic again) between 5V and GND on the power header, but you really want it as close to the LDO as you can get it, so soldered direct to the LDO's pins is best.

-1: <p><a href="https://i.stack.imgur.com/AlmKv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AlmKv.jpg" alt="enter image description here"></a>I am a newbie to Arduino and created my first project. The project is using a Sharp short range sensor and a 7 seg LED board (<a href="http://embedded-lab.com/blog/new-version-of-max7219-based-4-digit-serial-seven-segment-led-display/" rel="nofollow noreferrer">http://embedded-lab.com/blog/new-version-of-max7219-based-4-digit-serial-seven-segment-led-display/</a>) to count objects.</p>

<p>Everything works fine when on USB power to my computer or if I use a 5v 1A wall adapter with a USB cable. The problem is when I use an external power adapter or use a DC power supply to the Vin. The board powers up and I measured the output voltage on the 5v pin and is measuring around 4.8v. </p>

<p>The Sharp sensor is connected to the A0 Analog in and I see the voltage fluctuate when an object passes, but the LED is not displaying a value when on the external power. The display is connected to GRD, 5v where DIN, CLK, and LOAD pins of the display are connected to pins 7, 6, and 5 as the instructions stated. </p>

<p>I tried two different Arduino boards and several different AC to DC power adapters ranging from 9v to 12v plus used a DC power supply to the Vin and same results. </p>

<p>The code is below and pretty simple (although I am sure there is a lot better way of doing it but this is my first project in C so go easy on me and the function for digits is from a website and not written by me).</p>

<p>If a picture of the project would help I can upload one.</p>

<p>Any ideas or thoughts?
Thanks,
Steve</p>

<pre><code>#include "LedControl.h"
#include &lt;stdio.h&gt;
#include &lt;math.h&gt;

// Arduino Pin 7 to DIN, 6 to Clk, 5 to LOAD, no.of devices is 1
LedControl lc = LedControl(7, 6, 5, 1);
int sensorpin = 0;      // analog pin used to connect the sharp sensor
int val = 0;            // variable to store the values from sensor(initially zero)
int cnt = 1;

void setup()
{
    // Initialize the MAX7219 device
    lc.shutdown(0, false);   // Enable display
    lc.setIntensity(0, 10);  // Set brightness level (0 is min, 15 is max)
    lc.clearDisplay(0);     // Clear display register


}
void loop()
{


    val = analogRead(sensorpin);       // reads the value of the sharp sensor
    if (val &gt;= 650)
    {

    //write values to LED
    if (cnt&lt;=9)
    {
        lc.setDigit(0, 0, cnt, false); // Display 4 to Digit 1-9, " "
    }
    if (cnt &gt;= 10 &amp;&amp; cnt &lt;= 99)
    {
        lc.setDigit(0, 0, getDigitFromNum(cnt,0), false); // Display 4 to Digit 1-9, " "
        lc.setDigit(0, 1, getDigitFromNum(cnt, 1), false); // Display 3 to Digit 1-9, " "
    }

    if (cnt &gt;=100)
    {
        lc.setDigit(0, 0, getDigitFromNum(cnt, 0), false); // Display 4 to Digit 1-9, " "
        lc.setDigit(0, 1, getDigitFromNum(cnt, 1), false); // Display 3 to Digit 1-9, " "
        lc.setDigit(0, 2, getDigitFromNum(cnt, 2), false); // Display 2 to Digit 1-9, " "
    }

    delay(400);
    cnt++;

}
}

// Function: getDigitFromNum returns a digit at a given index of a integer.
// Goes from right to left with the starting index of 0.
int getDigitFromNum(int num, int digit) {
    num /= pow(10, digit);
    return num % 10;
}
// Function: getDigitFromDec returns a digit at a given index of a double.
// Goes from left to right with the starting index of 0.
int getDigitFromDec(double dec, int digit) {
    dec *= pow(10, digit);
    return (int)dec % 10;
}
// Function: getDigitFromNum returns the decimal values of a double.
double getDecimals(double dec) {
    return dec - (int)dec;
}
</code></pre>
 4143: <p>The only difference between powering from USB and powering through the barrel jack is the voltage is reduced to 5V through a Low Dropout (LDO) voltage regulator. These are typically a clone of the popular LM1113-50 and vary in current handling capacity from around 500mA up to 1A.</p>

<p>I notice your board is not a genuine Arduino - therefore the components used may be at the cheaper end. So we'll assume a low-grade LDO that only handles 500mA before going into thermal shutdown with good heatsinking. Since there isn't on these boards we shall therefore assume a maximum of 400mA before it gets too hot. Probably somewhat conservative.</p>

<p>So if your entire circuit is drawing more than about 400mA you can expect the regulator to shut down, or at least to reduce the current and/or voltage available.</p>

<p>The fact you're seeing 4.8V rather than 5V could be an indication that there is <em>voltage droop</em> occurring - i.e., the regulator is not able to supply enough current so the voltage drops. This would be accompanied by the regulator getting very hot.</p>

<p>The regulator is the device with 3 pins on the right side and a single tab on the left directly above the barrel jack socket. See how hot that is getting.</p>

<p>As a rule of thumb if you can hold your finger on it without crying for 10 seconds it's not too hot.</p>

<hr>

<p>Another thing you can do is to reduce your circuit to the bare minimum. Unplug absolutely everything and upload the Blink example sketch. Power that from the external DC and see if the LED blinks for you. If it does then the power supply is working OK. You can then add your peripherals one at a time to see when it fails.</p>

<p>If it doesn't blink then there must be something inherently wrong with the supply.</p>

<p>One possibility is that the LDO is <em>oscillating</em> due to insufficient or incorrect input and output capacitors. This basically means the "5V" voltage it gives out is actually wildly swinging between say 4.5V and 5V or 4.75V and 5.25V, which really confuses the microcontroller. Cheap LDOs are often more sensitive to the capacitors they are paired with and can suffer from this kind of problem.</p>

<p>To diagnose that kind of thing you would really need access to an oscilloscope to analyse the voltage. </p>

<p>If it is oscillating a 10µF ceramic capacitor connected between the lower two pins of the LDO (as orientated in your picture - that is Vout and GND) may cure it. A 1206 surface mount capacitor fits nicely across those pins and is reasonably easy to hand solder. You could also try a through-hole capacitor (ceramic again) between 5V and GND on the power header, but you really want it as close to the LDO as you can get it, so soldered direct to the LDO's pins is best.</p>
