Pages: [1]   Go Down
Author Topic: 3.3V output only giving 2.55V [solved]  (Read 615 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Guys

Thought this would be the most appropriate place to post this as I think it's a hardware, not a software/project issue.

I'm on windows 7, I have the arduino uno R3 plugged into USB only, and have a problem with the voltage from the 3.3V power output.

I noticed it while calculating temperature for a project I was doing when it was telling me 8 degrees instead of about 20. I have now traced the problem to the 3.3V power output.

It's only giving 2.55V according to the following code:

Quote
void setup() {
  Serial.begin(9600);
}

void loop() {
  int therm0 = analogRead(A0);                       //1. input on Analog pin 0
  float volt0 = therm0 * (3.3 / 1023.0);             //2. conversion to Voltage  

  Serial.println(volt0);                                     //3. Send voltage to Serial software display

This should be 3.3V right? do I need an external power source to achieve the full 3.3V?

- Heim
« Last Edit: November 25, 2012, 03:47:06 am by Nick Gammon » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26951
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
float volt0 = therm0 * (3.3 / 1023.0);             //2. conversion to Voltage 
I believe this would only be true if you had used Aref set to 3.3V.
As written, your code would be using the defualt setting of VCC, which would be ~5V.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
float volt0 = therm0 * (3.3 / 1023.0);             //2. conversion to Voltage 
I believe this would only be true if you had used Aref set to 3.3V.
As written, your code would be using the defualt setting of VCC, which would be ~5V.

Thanks for the reply,

so when I have my 3.3V output plugged straight into my analogue output, it's actually putting out 5V? or am I missing something in the code?
Logged

Lancashire, UK
Offline Offline
Edison Member
*
Karma: 9
Posts: 1991
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The default Analog reference is to use VCC which is nominally 5V but in actuality is whatever is coming out of the USB port of the computer.  If you plugged the 3.3V output into the AREF pin of the arduino and told it to use it

Code:
analogReference(EXTERNAL);

It will be reading a voltage relative to whatever is going in the AREF pin (3.3 volts if you connect it to 3.3 Volts).
Logged


Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26951
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You have choices for what is used for the ADC reference.
If you do nothing, then the default is 5V/1023 = ~4.88mV per BIT.

So if you connect the 3.3V output to an analog input and take a reading, the result will be
3.3/.00488 = ~676
then 676*(5/1023) =  3.3V
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You have choices for what is used for the ADC reference.
If you do nothing, then the default is 5V/1023 = ~4.88mV per BIT.

So if you connect the 3.3V output to an analog input and take a reading, the result will be
3.3/.00488 = ~676
then 676*(5/1023) =  3.3V

Brilliant, Thanks for this! turns out it was just a coding error smiley
Logged

Pages: [1]   Go Up
Jump to: