PWM to Varaible voltage

Hi, im trying to make a variable voltage by using the PWM output from my arduino, analogwrite with FirmataVB, and an RC Filter.

here is a diagram of my simple set up:

Ive tried testing the circuit with a multi meter and the meter doesnt change from 0v using analogwrite.

I tried using digitalwrite to eliminate any conection problems eg with the multimeter and that works fine.

Below is my VB Code, nice and simple. Trying to control the voltage by using a slider bar in VB. (Have tried simple commands too and these dont work).

Arduino is running Firmata Basic.

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FirmataVB1.Connect("COM4", 57600)
End Sub

Private Sub TrackBar1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TrackBar1.MouseUp
        FirmataVB1.AnalogWrite(11, TrackBar1.Value)
    End Sub
End Class

Thanks, Phil.

Edit: The slider bar in VB has a min value of 0 and a max value of 255.

The capacitor has polarity and is wired with negative pin to ground.

Nothing wrong with your drawing, I have used the same set-up to low pass filter a pwm output, maybe I used slightly different resistor/cap values, but close to yours.

So the problem is certainly software based in my opinion. To prove it to yourself you can load the ‘fade’ example sketch from the arduino IDE. You will have to modify the sketch to use your output pin 11 or move the circuit to pin 9. You might want to increase the delay times used in the sketch to more easily see the analog voltage rise and fall in your DVM.

/*
 Fading
 
 This example shows how to fade an LED using the analogWrite() function.
 
 The circuit:
 * LED attached from digital pin 9 to ground.
 
 Created 1 Nov 2008
 By David A. Mellis
 Modified 17 June 2009
 By Tom Igoe
 
 http://arduino.cc/en/Tutorial/Fading
 
 */


int ledPin = 9;    // LED connected to digital pin 9

void setup()  { 
  // nothing happens in setup 
} 

void loop()  { 
  // fade in from min to max in increments of 5 points:
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { 
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fadeValue);         
    // wait for 30 milliseconds to see the dimming effect    
    delay(30);                            
  } 

  // fade out from max to min in increments of 5 points:
  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { 
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fadeValue);         
    // wait for 30 milliseconds to see the dimming effect    
    delay(30);                            
  } 
}

Lefty

Tried the sketch that you recomended and it worked fine. Ended up tweeking my Firmata sketch a bit and got it working.

Thanks, Phil.