top of page
Search
  • Writer's pictureIfrim Ciprian

Breakout Board - Extra Sensors- Nicla Sense ME Implementation

1. I2C

Some of the sensors used for the breakout board use the I2C protocol of communication, and as stated here: https://ciprianaa30.wixsite.com/aurismartwatch/post/i2c-sensor-testing-nicla-sense-me-arduino-mega. The road has been a bit rocky in getting it to work perfectly,


After analysing the issues and going a bit more in depth, they were solved, and the details can be found in this blog link: https://ciprianaa30.wixsite.com/aurismartwatch/post/i2c-bus-nicla-sense-me-issues-resolved


At the end of that blog I specified how some issues were generated by the dodgy connections on the breadboard, so by using the created PCB, it fixed the issues.

The following video demonstrates the functionality of the UV Sensor and the Laser temperature sensor:

Code:

#include <Wire.h>
#include <Adafruit_MLX90614.h>
#include "Adafruit_SI1145.h"
#include "Nicla_System.h"

Adafruit_SI1145 uv = Adafruit_SI1145();
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup() {
  nicla::begin();
  Serial.begin(9600);
  while (!Serial);

  Serial.println("Adafruit MLX90614 test");

  if (!mlx.begin()) {
    Serial.println("Error connecting to MLX sensor. Check wiring.");
    while (1);
  };

  Serial.println("Adafruit SI1145 test");
  if (! uv.begin()) {
    Serial.println("Didn't find Si1145");
    while (1);
  }

  Serial.print("Emissivity = "); Serial.println(mlx.readEmissivity());
  Serial.println("================================================");
}

void loop() {
  Serial.println("===================");
  Serial.print("Vis: "); Serial.println(uv.readVisible());
  Serial.print("IR: "); Serial.println(uv.readIR());
  
  // Uncomment if you have an IR LED attached to LED pin!
  //Serial.print("Prox: "); Serial.println(uv.readProx());

  float UVindex = uv.readUV();
  // the index is multiplied by 100 so to get the
  // integer index, divide by 100!
  UVindex /= 100.0;  
  Serial.print("UV: ");  Serial.println(UVindex);

  Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC());
  Serial.print("*C\tObject = "); Serial.print(mlx.readObjectTempC()); Serial.println("*C");

  Serial.println();
  delay(500);
}


2. MICROPHONE

One of the external sensors that I wanted to implement with the Nicla Sense ME, is a microphone that can be used to detect decibels level of sound/noise and then inform the user of any health adverse effects of continued presence in the noisy environment.

Code:

#define microphone A1

void setup() {
  Serial.begin(115200);
}
  
void loop() {
float mic_value = analogRead(microphone);
  
Serial.println(mic_value);
delay(20);
}

The analog read output can be seen here:


3. DFROBOT GRAVITY SEN0203

The DFRobot Gravity sensor is used to measure heart rate in BMP, and the oxygen level present in red cells in the blood in percentage.

The code looks as following:

#define heartratePin A1
#include "DFRobot_Heartrate.h"

DFRobot_Heartrate heartrate(DIGITAL_MODE);

void setup() {
  Serial.begin(115200);
}
  
void loop() {
  uint8_t rateValue;
  heartrate.getValue(heartratePin); ///< A1 foot sampled values
  rateValue = heartrate.getRate(); ///< Get heart rate value 
  if(rateValue)  {
    Serial.println(rateValue);
    }
    delay(20);
}

However, although the reference says the sensor works between 3.3v to 6v, it seems that 3.3v is not enough for it to generate an output. Thankfully, thanks to the battery 4.2v, it then works.

The issue is exemplified here:

More information about the issue is also present on the DFRobot forums: https://www.dfrobot.com/forum/viewtopic.php?t=3220. It seems that the issue can also be caused by a delay higher than 20ms.


All the code can be found in the GitHub repo which can be accessed from the About page.

7 views0 comments

Recent Posts

See All
bottom of page