PWM as ground...is it possible?

Guys, can i use pwm to connect to ground?
For example, when i set pwm to be 0, can the pwm pin receive current? Can it be used to saturate a PNP BJT by acting as a ground for the transistor's base? If yes, how many mA can it handle as a ground?

Thank you in advance and have a great day :slight_smile:

Voidugu:
Guys, can i use pwm to connect to ground?
For example, when i set pwm to be 0, can the pwm pin receive current? Can it be used to saturate a PNP BJT by acting as a ground for the transistor's base? If yes, how many mA can it handle as a ground?

First, the maximum current (flowing in either direction) that any Arduino pin (including a PWM pin) configured as an output can withstand without potentially damaging pin's internal circuitry is 40 mA, and it generally a good idea to keep the current 10 mA to 20 mA below that if you can. So put a resistor of at least 220 ? between the pin you are going to use and the transistor.

Second, to make any I/O pin low (i.e. have the same voltage as the Arduino's ground) you just set the pin to be an output with pinMode() and use the digitalWrite() function.

Third, the voltage cannot exceed Vcc for the Arduino... Even with a 220 ohm resistor. Dire things will happen.

Doc

Thanks for the answer and the info but you haven't really answered my question.

What i am basically asking is this:

"When a pin is configured to OUTPUT with pinMode, and set to LOW with digitalWrite, the pin is at 0 volts. In this state it can sink current, e.g. light an LED that is connected through a series resistor to, +5 volts, or to another pin configured as an output, and set to HIGH. "

Can i achieve the exact same thing by setting a pwm pin to 0? In other words, if a pwm pin is set to 0 then can it sink current?

Again thanks :>

Farseeker answered your question, so did I neither of us said it was impossible. We did state the conditions. The pin can either source or sink 40 mA. At 50% duty cycle or 1/2 "Voltage out... the pin will sink as much current as it will source.

Doc

Thanks a lot guys :slight_smile: Have a nice day