analogWrite (6, 255) outputting 3.87V on breadbrd

In the process of moving my arduino onto a breadboard I seem to have forgotten something vital to outputting a full 5v from PWM. Using the Duemilanove fully assembled and a simple low pass filter using the same resistor and capacitor seen in the pictures below I can get around 4.9V or 1023 from analogRead. At first I thought it was the analog reference pin but then I checked my output with a multimeter and sure enough its not near a full 5v. I also tried pulling Aref high, not that it should matter, outputting using PWM on a digital pin and checking using a meter. I'm sure its something simple, but I'm lost :-/

Here is the simple troubleshooting code I'm using:

void setup()
{
  Serial.begin(9600);
}
void loop()
{
  int x = 0;
  analogWrite(6, 255);
  x = analogRead(5); 
  Serial.println(x);
  delay(100);
}







I'm a little bit confused by your post:

I can get around 4.9V or 1023 from analogRead.

That doesn't sound bad. 1023 is the maximum you can get from analogRead. The title of your post however says you're only reading 3.87V. Can you clarify what you're trying to do.

Using the Duemilanove fully assembled and a simple low pass filter using the same resistor and capacitor seen in the pictures below

Well I can make a guess at what resistor you're using (4.7k?) but I can't read the capacitor value. Why not just tell us? :slight_smile:

And what is that big DIP IC in the middle? It would be more helpful to see your schematic than your breadboard.

--
Check out our new shield: http://www.ruggedcircuits.com/html/gadget_shield.html

Sorry if it wasn't clear, I can get 4.9v or 1023 when using the 2.2uf cap and 4.7K resistor to make a low pass, using the PWM output from pin 6 on the Duemilanove and that is plenty close to 5v (works fine). The lower voltage problem occurs when I'm running the 328 straight off the breadboard. Sorry, I don't really have schematics, I was just tinkering following these instructions http://itp.nyu.edu/physcomp/Tutorials/ArduinoBreadboard trying to get a full 4.9/5v from PWM.

Oh, I think it’s an easy one. Your +5V power wire is going to the IC pin 6 instead of pin 7 – you’ve got an “off-by-one” breadboarding error.


Check out our new shield: http://www.ruggedcircuits.com/html/gadget_shield.html

Wow, That was a stupid mistake! ::slight_smile: I was tinkering with that for a good 45 minutes >:( Now I get 5.01V! Thanks! ;D

No smoke released? Ah.
What was with the 3.87V and analogWrite(6,255)? Did you get that figured out yet? Should be 1.25V, right?