Extremely inconsistent analogRead() on Nano 33 IoT

Hi Floater,

First of all, Thx for the good work.

As far as I understood, there is no influence of the R9 connected to the AAM. Which is good. I was unable to locate it on the 33 BLE Sense board. Desoldering it is beyond my skills or tools.

A 10K resistor between the voltage measured and the ADC pin? Which pin is that?

I'm afraid your wiring.c modification does not work for me. The processors of the nano 33 IOT and BLE sense are completely different. Basically you are using the same solution as I did, but at a much lower level. Averaging many samples.

Looking into it, there is a better solution for your board.

It has several builtin voltage references that are much more stable than the 3.3V.

You can do that within the code of the sketch.
That's what the line

analogReference( AR_DEFAULT ) ; in the .C is for.

The default setting is the 3.3V. You can use any of the other indicated values.

See here

femmeverbeek:
A 10K resistor between the voltage measured and the ADC pin? Which pin is that?

Whichever pin you are doing the analogRead on.

femmeverbeek:
Looking into it, there is a better solution for your board.

It has several builtin voltage references that are much more stable than the 3.3V.

Thanks. I can't remember why I didn't do that but it may have been because the other sensor that I was using, a loadcell, needed to be compared to a larger reference voltage than the alternatives references provided. I plan to use the nano again for other jobs in the future, so perhaps I'll look into this some more then.

A 10K resistor between the voltage measured and the ADC pin? Which pin is that?

Whichever pin you are doing the analogRead on.

Then I don't understand the sentence. Can I use it to improve the measuring result?

Thanks. I can't remember why I didn't do that but it may have been because the other sensor that I was using, a loadcell, needed to be compared to a larger reference voltage than the alternatives references provided. I plan to use the nano again for other jobs in the future, so perhaps I'll look into this some more then.

I guess using the internal reference and measuring by means of a voltage divider will yield more stable results.

magnebear:
I tried you modified version of wiring.c but it did not appear to make any difference.

One thing to be careful about is to make sure you're modifying the right copy of wiring.c. Each boards platform has its own copy of wiring.c. So if you replace the one for the Arduino AVR Boards platform, it will have no effect on the Arduino Nano IoT, which uses the Arduino SAMD Boards platform.

The easiest way to find the location of the platform of a specific board is:

  • Select the board from the Tools > Board menu
  • File > Examples > SPI > BarometricPressureSensor (or any other SPI example sketch)
  • Sketch > Show Sketch Folder
  • Move up folder levels until you reach the one that contains boards.txt

From there, you will find the relevant wiring.c under the cores/arduino folder.