Go Down

Topic: New Uno R3 not putting out 5V (Read 1 time) previous topic - next topic



I just opened my brand new Arduino UNO R3 yesterday.  I was able to get the "Hello World!" blinking light sketch to run right away and then decided to try something a little more sophisticated.  I wanted to build the 'Capacitance Meter' exactly as described on this page:


I copied the code almost entirely and configured my board with a 220 ohm resistor between the charge pin and the rest of the circuit as well as a 220 ohm resistor between the circuit and the discharge pin as described in the schematic.  I used a 100uF capacitor as a test.  When I ran the sketch, no capacitance values were printed on the serial monitor.

To troubleshoot, I began sending messages to the screen to indicate where in the program it was breaking down and what I determined was that it got caught up in a while loop because the analogPin never reached 63.2% of the maximum voltage.  I modified the code to give me a reading of the chargePin just before it entered the while loop and found that the chargePin was only putting out approximately 2-2.5 V instead of the expected 5V. 

Here is the code that I used.  You can see that the chargePin is set as output and set to HIGH and still doesn't put out 5V

Code: [Select]
#define analogPin      0          // analog pin for measuring capacitor voltage
#define chargePin      13         // pin to charge the capacitor - connected to one end of the charging resistor
#define dischargePin   11         // pin to discharge the capacitor
#define resistorValue  220.0F   // change this to whatever resistor value you are using
                                  // F formatter tells compliler it's a floating point value

unsigned long startTime;
unsigned long elapsedTime;
float microFarads;                // floating point variable to preserve precision, make calculations
float nanoFarads;

void setup(){
  pinMode(chargePin, OUTPUT);     // set chargePin to output
  digitalWrite(chargePin, LOW); 

  Serial.begin(9600);   // initialize serial transmission for debugging

void loop(){
  digitalWrite(chargePin, HIGH);  // set chargePin HIGH and capacitor charging
    int chargeValue = analogRead(chargePin);
      Serial.print("Charge pin is: ");
      Serial.println(chargeValue);   // chargePin gives result that corresponds to ~2.5 volts instead of 5V
    int analogValue = analogRead(analogPin);
       Serial.print("Analog pin is: ");
  startTime = millis();
  while(analogRead(analogPin) < 648){      // 647 is 63.2% of 1023, which corresponds to full-scale voltage
    Serial.println(analogValue);  //analogPin never gets above 2.5V meaning it will never reach the desired 63.2% and will stay in this loop forever

I really didn't do anything crazy with the board yet...I've only had it a day! So I can't imagine that I'd have fried a pin already??  If you have any suggestions or need clarification, let me know.  Thanks!


100uF is a lot to charge up. Does it go higher eventually?
If you have the 2nd resistor connected to Gnd all the time, now you have a voltage divider that will never exceed 2.5V.
The resistor to Gnd should only connect to Gnd when you want to discharge the cap.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


The weird thing is that it still happens when I make a simple LED blinking program.  For this all I have is a 220 Ohm resistor coming from pin 6 to an LED which returns to GND.  Nothing else is in the circuit.  The voltages for pin 6 at both HIGH and LOW come out between 2-2.5V yet the LED still blinks.  I'm starting to think that I am not measuring the voltage that I think I am measuring.  Why would the LED pin blink if the voltage never changed?

Code: [Select]
int led = 6;

void setup() {               
  pinMode(led, OUTPUT); 

void loop() {
  digitalWrite(led, HIGH);  // turn the LED on (HIGH is the voltage level)
  int pinValue = analogRead(led);
  float voltage = pinValue * (5.0/1023.0);  //convert to volts
Serial.print("HIGH: ");
  Serial.println(voltage); // Here I am expecting 5V but its only showing up around 2V

  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW

  pinValue = analogRead(led);
  voltage = pinValue * (5.0/1023.0);
  delay(1000);      // wait for a second

  Serial.print("LOW: ");
  Serial.println(voltage);  // Here I am expecting 0V but it returns around 2V


That does sound like a meter-misuse problem.

You have one lead on a board Gnd connection?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


Yup.  The circuit is pin 6 --> 220 Ohm resistor --> LED --> GND.  I don't own a voltmeter yet but I'm going to try to get one and measure the voltage between pin 6 and GND when set to HIGH. 

Go Up