I do not know much about I2C. My question:
1.- Can be used any I2C sensors with Argon , Photon, Boron?
2.- Do exist 5v I2C and 3.3v I2C sensors or they work with both?
In this case is it possible for working with Boron https://www.adafruit.com/product/3566
3.- Is it necessary a special library or is it the same for all sensors?
You can use any 3.3V I2C sensor on Argon, Boron and Photon, but pure 5V sensors should not be used with Argon and Boron as these controlers are not 5V tolerant but 5V I2C sensors often require 5V pull-ups.
The CCS811 sensor you linked is rated for 3-5V so you can use it on Argon, Boron and Photon as long you don’t power it with more than 3.3V on Vin (for Argon & Boron).
And yes, you need a specific library for each specific sensor.
Can be use any Arduino I2C library for a Particle Boron/argon?Like this:
#define SERIAL_SPEED 19200
#include <sSense-CCS811.h>
CCS811 ssenseCCS811;
void setup()
{
DebugPort.begin(SERIAL_SPEED);
delay(5000);
DebugPort.println("s-Sense CCS811 I2C sensor.");
if(!ssenseCCS811.begin(uint8_t(I2C_CCS811_ADDRESS), uint8_t(CCS811_WAKE_PIN), driveMode_1sec))
DebugPort.println("Initialization failed.");
}
void loop()
{
ssenseCCS811.setEnvironmentalData((float)(21.102), (float)(57.73)); // replace with temperature and humidity values from HDC2010 sensor
if (ssenseCCS811.checkDataAndUpdate())
{
DebugPort.print("CO2[");
DebugPort.print(ssenseCCS811.getCO2());
DebugPort.print("] tVOC[");
DebugPort.print(ssenseCCS811.gettVOC());
DebugPort.print("] millis[");
DebugPort.print(millis());
DebugPort.print("]");
DebugPort.println();
}
else if (ssenseCCS811.checkForError())
{
ssenseCCS811.printError();
}
delay(2000);
}
Typically libraries need to be ported for the Particle platform, but often this won’t be too difficult.
For the CCS811 there already is a library available here
https://build.particle.io/libs/Adafruit_CCS811/1.0.2/tab/Adafruit_CCS811.cpp
BTW, there is no DebugPort
defined on Particle devices.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.