Arduini Nano BLE Sense, ARef

Hello, I am using the Arduino Nano BLE Sense for a school project where I am using some force sensor. I have read that I can play with the accuracy by configuring my voltage reference [ARef]. Because it seem that my reference voltage is set at 1V1. With my calculation, with my analogRead I was supposed to see a value around 248ish_0.2mV for when I apply some pressure on the force sensor. But I have a value of 1092ish_0.8mV.

I have set my analogResolution to 12

const int pwm = 3;
const int pin1 = A7;

int x = 232;

int value1;

float volt;

float force1;

void setup()

pinMode(pwm, OUTPUT);


analogWrite(pwm,x); //PWM OUTPUT 3V


void loop()
value1 = analogRead(pin1);

volt = value1 * (3.3 / 4095.0);

force1 = volt * (220.0 / 3.3);

Serial.print(" Value = ");
Serial.println(" bit");

Serial.println(" ");

Serial.print(" Volt= ");
Serial.println(" V");

Serial.println(" ");

Serial.print(" W = ");
Serial.println(" lb");

Serial.println(" ");



I have tried the analogReference(EXTERNAL); command. But when you select the Nano BLE Board in the IDE, that command cant seem to compile.It doesn't reconize the EXTERNAL part.
As I am reading about it, it seem there's nothing about it for this new board.
I get this error message:

'DEFAULT' was not declared in this scope

Does someone have an idea of what can be done?

I suspect the function is not implemented in the library. If you replace EXTERNAL (this is just a name for a value) with a 0 for instance, the compiler will be happy but they linker will complain that it can not find the analogReference function


test.ino:24: undefined reference to `analogReference'

When you compare
the libary for the Nano 33 BLE

with the libary for SAMD devices for instance

you will see the function is missing.

Also the wiring_analog.h in the samd library contains a eAnalogReference typedef enum and the Nano 33 BLE does not.

You could use the data sheet and try to set the ADC registers yourself.

Hello Klaus_K,

Thanks for the quick reply! I've never got to directly play in the register of a MCU, time to learn then! I have taken a look at the nRF52840 data sheet. I see that the internal reference is set at 0.6V...

I will look into it and share what I might found to change this parameter!

Thanks Again!