I am measuring like 30-60 mVolts on all pins on my arduino nano.I tried setting them as input and output mode in the hope that i may get 0V when they are low.Is this normal or am i missing something? I am trying to feed an opamp with analogWrite() function but analofWrite(8,0) gives me 60 mVolt on the output.
Always show us a good schematic of your proposed circuit.
Show us good images of your ‘actual’ wiring.
It might be your OP amp circuit biasing.
Why are you feeding a PWM Arduino output to an OP Amp circuit ?
In the Arduino IDE, use CtrlT or CMDT to format your code then copy the complete sketch.
Use the < CODE / > icon from the ‘posting menu’ to attach the copied sketch.
On most Arduino models, analogWrite() does not output a voltage between 0 and 5V. The name of the analogWrite() function is misleading. In fact, it outputs a digital PWM signal. The signal is always 0V or 5V (or close to those values) but the duty cycle can be varied so that the average voltage changes.
What does the data sheet information for your processor say about the possible voltage on the pins when set to 0 in the associated register? Zero for your processor can be any value below some minimum value. Remember, the processor is a digital machine, not an analog machine.
That sounds like an instrumentation problem to me. You need to validate all of your connections and let us know what type of meter you are using. Also tell us what it reads when the test leads ace connected only to each other.
And... The specs for the ATmega chip say a digital low output is guaranteed to be 0.8V or less and a digital high is 4.1V or more. The input specs are slightly "loser" so that an output going to an input are always correct. That's the "magic" of digital... It doesn't have to be perfect as long as you can tell a 1 form a 0. (That's with a 5V supply and within certain current limits.)
Yes it is normal, you will never get 0V from an output pin on a digital system.
If you want to feed this into an operational amplifier, you first have to pass it through a DC offset circuit to tune out any offset you have. Read this to see how.
It's not a good idea to feed a digital output into an amplifying opamp circuit because there is no guaranteed constant offset voltage on the output. Use of a comparator then is the recommended solution.
I don't understand why you say that. It is simple to apply an offset to the output as explained in the PDF.
By making the offset adjustable, that is adding a small variable resistor to the larger fixed resistor you can tune that offset value to what you want it to be.
I used the same technique when I was working with active filters for the Admiralty Underwater Weapons Establishment, many years ago.