Help with EEPROM.h library for Arduino Nano BLE sense

Hello. I created my ML model on edge impulse and one of my parameters was salinity. this salinity can be measured using a gravity Analog TDS sensor. So when i am trying to use this in an arduino code i get compilation error for ARDUINO NANO BLE SENSE but the program compiles for arduino UNO. Meaning i cannot effectively run inference from the model i downloaded until the sensor library works well. So i figured it is board compatibility which is a highly recommended tinyML board even on the coursera course. Arduino nano BLE 33 does not use EEEPROM but the sensor libraries read addresses from the EEPROM . i have searched the internet but i have not succeded. i am hoping there is insight in this instance. the error is as shown in the image:

the library in question is any help will be appreciated.

Hello @marvin,

This seems to be an Arduino related issue. The library you are using has not been ported to be compatible with the Arduino NANO 33 BLE SENSE.

See here if you want to implement a workaround to adapt the library:

However, on my side I would use this sample code that does not depend on a library (found it online here:

 DFRobot Gravity: Analog TDS Sensor / Meter For Arduino

 Created 2017-8-22
 By Jason <>

 GNU Lesser General Public License.
 See <> for details.
 All above must be included in any redistribution

 /***********Notice and Trouble shooting***************
 1. This code is tested on Arduino Uno and Leonardo with Arduino IDE 1.0.5 r2 and 1.8.2.
 2. More details, please click this link: <>

#define TdsSensorPin A1
#define VREF 5.0      // analog reference voltage(Volt) of the ADC
#define SCOUNT  30           // sum of sample point
int analogBuffer[SCOUNT];    // store the analog value in the array, read from ADC
int analogBufferTemp[SCOUNT];
int analogBufferIndex = 0,copyIndex = 0;
float averageVoltage = 0,tdsValue = 0,temperature = 25;

void setup()

void loop()
   static unsigned long analogSampleTimepoint = millis();
   if(millis()-analogSampleTimepoint > 40U)     //every 40 milliseconds,read the analog value from the ADC
     analogSampleTimepoint = millis();
     analogBuffer[analogBufferIndex] = analogRead(TdsSensorPin);    //read the analog value and store into the buffer
     if(analogBufferIndex == SCOUNT) 
         analogBufferIndex = 0;
   static unsigned long printTimepoint = millis();
   if(millis()-printTimepoint > 800U)
      printTimepoint = millis();
        analogBufferTemp[copyIndex]= analogBuffer[copyIndex];
      averageVoltage = getMedianNum(analogBufferTemp,SCOUNT) * (float)VREF / 1024.0; // read the analog value more stable by the median filtering algorithm, and convert to voltage value
      float compensationCoefficient=1.0+0.02*(temperature-25.0);    //temperature compensation formula: fFinalResult(25^C) = fFinalResult(current)/(1.0+0.02*(fTP-25.0));
      float compensationVolatge=averageVoltage/compensationCoefficient;  //temperature compensation
      tdsValue=(133.42*compensationVolatge*compensationVolatge*compensationVolatge - 255.86*compensationVolatge*compensationVolatge + 857.39*compensationVolatge)*0.5; //convert voltage value to tds value
      //Serial.print("V   ");
      Serial.print("TDS Value:");
int getMedianNum(int bArray[], int iFilterLen) 
      int bTab[iFilterLen];
      for (byte i = 0; i<iFilterLen; i++)
      bTab[i] = bArray[i];
      int i, j, bTemp;
      for (j = 0; j < iFilterLen - 1; j++) 
      for (i = 0; i < iFilterLen - j - 1; i++) 
        if (bTab[i] > bTab[i + 1]) 
        bTemp = bTab[i];
            bTab[i] = bTab[i + 1];
        bTab[i + 1] = bTemp;
      if ((iFilterLen & 1) > 0)
    bTemp = bTab[(iFilterLen - 1) / 2];
    bTemp = (bTab[iFilterLen / 2] + bTab[iFilterLen / 2 - 1]) / 2;
      return bTemp;

I have seen that you also created a new thread on stackoverflow:




DFRobot Gravity: Analog TDS Sensor/Meter

This sample code shows how to read the tds value and calibrate it with the standard buffer solution.
707ppm(1413us/cm)@25^c standard buffer solution is recommended.

Created 2018-1-3
By Jason <>

GNU Lesser General Public License.
See for details.
All above must be included in any redistribution.

/Notice and Trouble shooting****

  1. This code is tested on Arduino Uno with Arduino IDE 1.0.5 r2 and 1.8.2.
  2. Calibration CMD:
    enter -> enter the calibration mode
    cal:tds value -> calibrate with the known tds value(25^c).
    exit -> save the parameters and exit the calibration mode

//#include <EEPROM.h>
#include “GravityTDS.h”

#define TdsSensorPin A1
GravityTDS gravityTds;

float temperature = 25,tdsValue = 0;

void setup()
gravityTds.setAref(5.0); //reference voltage on ADC, default 5.0V on Arduino UNO
gravityTds.setAdcRange(1024); //1024 for 10bit ADC;4096 for 12bit ADC
gravityTds.begin(); //initialization

void loop()
// temperature = readTemperature(); //add your temperature sensor and read it
gravityTds.setTemperature(temperature); // set the temperature and execute temperature compensation
gravityTds.update(); //sample and calculate
tdsValue = gravityTds.getTdsValue(); // then get the value

When you comment out the header file as below, it compiles and one is able to read sensor value which makes it easily integratable with Edge impulse data collection or for inference using your downloaded header library

//#include <EEPROM.h>

1 Like