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

void loop() {
  analogWrite(5, 0);
  // or
  //digitalWrite(5, LOW);

Output is 0.003V and the tiny voltage causes the circuit to draw 20uA.

Is there anyway to get absolute 0V from Arduino PWM pin?

  • That is a quite tiny voltage. This is not a code issue, since you cannot do more that driving the pin to LOW (which is what happens, when you use analogWrite(pin,0). Please show us your circuit.
    – chrisl
    Sep 21 '19 at 19:45
  • @chrisl I'm converting arduino PWM to analog with RC and OA and then use that voltage as a reference voltage for another OA... Sep 21 '19 at 19:50
  • To be clear, setting a voltage this precise can be very hard (also because this is in the range of noise). I'm not sure, if this even comes from the Arduino. It might as well come from the opamp circuit itself, since they are not build perfectly either. Depending on your exact circuit it might be better to use an extra circuit part for turning the opamp circuit really off, instead of letting it amplify noise.
    – chrisl
    Sep 21 '19 at 19:55
  • 1
    Where get's anything counted? I don't see something like this in your code. About the extra circuit: That was just a thought about cutting the power of the opamps (maybe through a MOSFET) or pulling the output of the opamp over a current limiting resistor to low (also with a MOSFET). Just a thought, not a full fletched circuit, that I could provide a link for
    – chrisl
    Sep 21 '19 at 20:19
  • 1
    You probably won't get below 3mV even with a transistor (that's what the arduino already does). Do you really need to get below that tiny voltage, I mean, it's 4 times less than the pwm's (ideally filtered) resolution when running at 3V3. If so, the only chance I see is to use external circuitry
    – Sim Son
    Sep 22 '19 at 2:50

It doesn't output 0v because it's near impossible. 0.003v is in fact very low. The LOW output, according to the datasheet, can be as high as 0.8v (when powered by 5v) and still be considered valid.

LOW does not mean 0v. It means "below the voltage threshold that is considered a LOW".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.