MKR1010 DFrobot pH&EC-sensors

Im beginner at programming and just starting my first Arduino project. Going to do hydroponics project with MKR1010 & DFRobot pH&EC-sensors that are monitored in IoT-cloud. MKR1010 does not have EEPROM where to store this calibrating data. I asked this from DFRobot and they said: We think the PH sensor could not be used on the board without EEPROM, because the PH-related-parameters are stored in the EEPROM.(Which means the sensor has to be re-calibrate when used in a different board).

Is there any way that I can do this project with MKR1010? Or any examples for using these sensors with MKR-board?
I also have Arduino Mega, but because new to programming, trying to find easiest way to make things work. I have tried to send data between Mega & MKR with I2C, but having problems with bit shifting and other things. It would be easiest for me to connect sensors directly to MKR. I would really appreciate some advices for this.

For the SamD MKR boards such as the wifi1010 there is a library that emulates EEPROM.
FlashStorage library for Arduino

Tutorial: EEPROM Emulation with Arduino API

just ran File>Examples>FlashStorage_SAMD>EmulateEEPROM on an MKRFOX
first run save data to emulated EEPROM second run displays

Start EmulatedEEPROM on Unknown SAMD21 board
FlashStorage_SAMD v1.3.1
EEPROM length: 1024
EEPROM has been written.Signature = 0xBEEFDEED
Here is the content of the next 16 bytes:
-> 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
Clearing WRITTEN_SIGNATURE for next try
Done clearing signature in emulated EEPROM. You can reset now

remember to treat it as EEPROM with a very limited number of writes
should be OK for your project as once the pH calibration parameters are stored they won't need to be updated for some time

Thank you for your response. But I dont have a clue how I would do that. Just beginner and only can use ready libraries at the most. Does this mean that I cant use ready made libraries to measuring pH& EC. All these libraries I have tested are relate to EEPROM somehow. I managed to do own code to my pH-sensor(without temperature compensation) But EC-sensor would require temperature compensate. Any suggestions how I get these work with my MKR1010?

depends on the sensor
in post 1 you mentioned some sensors - a quick web search found

  1. DfRobot Analog pH Sensor library DFRobot_PH
  2. Analog Electrical Conductivity Sensor library DFRobot_EC

try running the examples on the MKR1010
note the MKR1010 uses 3.3V logic so if you have 5V signals use potential dividers or level converters

I have these. Already tried those examples, but it doesnt work because no EEPROM.

  1. Gravity: Analog Electrical Conductivity Sensor /Meter V2 (K=1) ec meter - DFR0300 - Gravity: Analog Electrical Conductivity Sensor | DFRobot Electronics
  2. Gravity: Analog pH Sensor / Meter Pro Kit for Arduino DFRobot industrial ph sensor for arduino - SEN0169 | DFRobot Electronics

did you try running File>Examples>FlashStorage_SAMD>EmulateEEPROM which emulates EEPROM
it works on a MKRFOX so I would assume it will work on a MKR1010
you could use it to store the calibration of the sensors as though it is EEPOM

Yes and it downloads that EmulateEEPROM-sketch to MKR , but when I try to include <DFRobot_EC.h> for reading EC-sensor it says: fatal error: EEPROM.h: No such file or directory
#include <EEPROM.h>

you will need to replace the EEPROM header and commands (read/write/etc) with the EmulateEEPROM equivalents
e.g. replace

#include <EEPROM.h>

with

#include <FlashStorage_SAMD.h>
```cpp


  /*
  Demonstrate how to use FlashStorage with an API that is similar to the EEPROM library.

  This example code is in the public domain.

  Written by A. Christian
  Edited 14 Oct 2016 by Cristian Maglie
*/

// Include EEPROM-like API for FlashStorage
#include <FlashAsEEPROM.h>
#include <DFRobot_EC.h>
void setup() {
  Serial.begin(9600);

  // If the EEPROM is empty then isValid() is false
  if (!EEPROM.isValid()) {

    Serial.println("EEPROM is empty, writing some example data:");
    Serial.print("->");
    for (int i=0; i<20; i++) {
      EEPROM.write(i, 100+i);
      Serial.print(" ");
      Serial.print(100+i);
    }
    Serial.println();

    // commit() saves all the changes to EEPROM, it must be called
    // every time the content of virtual EEPROM is changed to make
    // the change permanent.
    // This operation burns Flash write cycles and should not be
    // done too often. See readme for details:
    // https://github.com/cmaglie/FlashStorage#limited-number-of-writes
    EEPROM.commit();
    Serial.println("Done!");

    Serial.print("After commit, calling isValid() returns ");
    Serial.println(EEPROM.isValid());

  } else {

    Serial.println("EEPROM has been written.");
    Serial.println("Here is the content of the first 20 bytes:");

    Serial.print("->");
    for (int i=0; i<20; i++) {
      Serial.print(" ");
      Serial.print(EEPROM.read(i));
    }
    Serial.println();

  }
}

void loop() {
}

I think that the problem is because I #include <DFRobot_EC.h> library and in that library it refers to EEPROM. Not sure though, but even if try to include this <DFRobot_EC.h> to EmulateEEPROM-sketch I will get that error ````

I think you will need to copy the DFRobot libraries and edit the source code to suit the new EmulatedEEPROM library

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.