Go Down

Topic: Issues with analogRead when using Vin on MKR1000 (Read 1 time) previous topic - next topic

MEL69

Hello,

I am having problems with analogRead when I am supplying power via the Vin pin.
Here is a very simple voltage divider circuit that should always return a value around 2047 when I am using 12 bit analog resolution. This is the case when I am supplying power (actual readings 2053 - 2046) via USB but when I am using Vin via an external source (other picture) then the values are 1954 - 1890 around 100 values lower.
(I am sending the values via Wifi)

What am I doing wrong?

Thanks
Markus

ballscrewbob

Discrepancies through the onboard voltage regulators maybe ?

A page here might be worth a look for you.

Super accurate voltage stability is not a strong point of many Arduino boards especially clones (which I know yours isnt).

They are after all "DEV" boards and not industrial class.
It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

MEL69

Thanks for the hint, stability is indeed the problem. I took a closer look at the circuit and found that the +5V is going thru filtering before it hits the voltage regulator (see attached image). I am surprised that Vin does not do this.
Also the used regulator (AP7215-33YG-13) is only good for 5.5V and not 6V - faulty specs on the official page!

ballscrewbob

VIN is actually also filtered but using a different approach as VIN can be subject to more variations than the USB voltage. As seen on page 2 of the schematic.

If you really wanted to use VIN as a reference then you would have to adjust its supply and keep it at that reference standard which produced the correct results (providing it does not exceed the max limit for VIN).

Another choice often used is the AREF that was linked to earlier which is often less susceptible to the vagrancies of the supplies.
It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

MEL69

I did take a look at Vin but the only filtering I could find is C8 (1uF cap) on the input to the voltage regulator.

Maybe this was not clear in my description, I don't want to use Vin as a reference; I just want to use it to supply the power. I am using the 3.3V output of the MKR to supply my sensors.

Go Up