I am trying to output analog voltage (400 mV) using Arduino Nano PWM pins. Is it okay to directly connect (using jumper wires) the PWM pins to the Vin+ of the INA219 current sensor?
I badly need it for my graduation project. Thanks for the help.
PWM pins don't output analog voltages. They output pulses of 5V. You then need to average the output in order to get an actual analog voltage out of it. You should be able to use a small capacitor and current limiting resistor to average out the voltage of the PWM pin. I'm not sure how close to 400mV you'll be able to get. If i remember correctly the PWM pin has a value of 0 - 1023, and 1/1024 is .0048828, or 488.2 mv, so your lowest possible output will be almost 100mV too high. You might need to add a voltage divider to the output to get the output you want. Then again, if all you want is a fixed 0 or 400mV you could accomplish that with a digital output pin and a fixed voltage divider - no need for PWM.