blood glucose breakout board

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.

  • 1
    I inserted my circuit connection above. Can you help me? Commented Feb 24, 2019 at 9:30
  • 1
    So you just want the INA219 to show value of 400mV? There is no circuit that actually uses that voltage? You can achieve that in simpler ways then using an Arduino. Commented Feb 24, 2019 at 9:47
  • 3
    It's unclear why exactly you want this 400mV voltage (or other voltages as well)? You can build a voltage divider from 2 resistors to get 400mV from 5V and GND. Or for general voltages, you want to build a DAC (youtube.com/watch?v=Y2OPnrgb0pY) Commented Feb 24, 2019 at 11:07
  • 1
    Yes, why do you think you want to generate 400mV?
    – Majenko
    Commented Feb 24, 2019 at 13:00
  • 2
    @FilipFranik please don't use just capacitors. You'd need a resistor as well, or you'll end up destroying the Arduino pin.
    – Gerben
    Commented Feb 24, 2019 at 14:44

2 Answers 2


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 capacitor and resistor to average out the voltage of the PWM pin, making a low-pass filter. You won't get exactly to 400mV. If I remember correctly the PWM pin has a value of 0 - 255, and 1/255 is 0.0196 V after a good low-pass filter, or 19.6 mV, so analogWrite(pin,20) should get close to the 400mV you want.

Another option would be to use a voltage divider to the output to get the output you want. That way you can use the full range of analogWrite() in producing the 400 mV and smaller voltages, thus gaining precision. 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.


Of course it's possible !

Duncan you made a little error of 10^2 ;)

5V / 1023 = 0.004887.. = 4.88mV

For 400mV you got 400/4.88 = 81.9.

So in the arduino a value of 82 (0-1023) will send you an output of 400.16mV after beeing redressed by a RC filter.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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