Vuélverte Ecológico con “Envi”: Un Sensor Combinado Ambiental Qwiic para tu Estimada Máquina de Juegos

"Caramba, que mal huele", podrías estar pensando. Aunque esta expresión es un poco imprecisa, pone de manifiesto que podrías estar experimentando un problema en la calidad del aire de tu entorno. La mayoría de los olores, tóxicos o de cualquier otro tipo, generalmente derivan de compuestos orgánicos volátiles (COV). De hecho, una medición clave para determinar la calidad del aire es la cuantificación de los compuestos orgánicos volátiles totales o TVOC.

Uno de los principales sensores para medir COV es el sensor de gas digital CCS811 de ultra bajo consumo de AMs AG en Austria. Además de proporcionar mediciones de COV, el CCS811 también puede proporcionar niveles equivalentes de CO2 (eCO2). Estos valores de eCO2 suelen ser una forma de COV que generan los humanos.

Figure 1 - Monitor your indoor environment with an ODROID-GO.

Estos niveles de calidad del aire son proporcionados como partes por billón (PPB) para TVOC y partes por millón (PPM) para eCO2. Como sensor independiente, los resultados del CCS811 están en bruto y son inexactos. Para mejorar los resultados de las mediciones de la calidad del aire, las lecturas imprecisas del CCS811 se pueden compensar con datos de la temperatura actual del aire y de la humedad relativa.

Un sensor respetado que proporciona la humedad y la temperatura del ambiente es el sensor ambiental digital integrado BME280 de Bosch Sensortec. Integrar los resultados de BME280 en los cálculos para la calidad del aire CCS811 podría llegar a ser una tarea bastante engorrosa. Afortunadamente, SparkFun Electronics (SFE) ha combinado cuidadosamente los sensores CCS811 y BME280 en una sola placa independiente que puede monitorizar de manera fiable la calidad del aire ambiental.

Figure 2 - The SFE Environmental Combo Breakout. Image courtesy of SparkFun Electronics.
Figura 2 - El sensor combinado Ambiental SFE. Imagen cortesía de SparkFun Electronics.

Conocido como Qwiic Environmental Combo Breakout, SparkFun lo hizo más atractivo al incluir este paquete de monitorización de la calidad del aire en su ecosistema Qwiic I2C. Ahora, utilizando el proyecto del adaptador Qwiic que creamos en la edición de mayo de 2019 de ODROID Magazine, disponible aquí, https://magazine.odroid.com/article/go-and-be-qwiic-about-it/?ineedthispage=yes podemos controlar fácilmente la calidad del aire interior con una impresionante precisión a través de un simple sistema plug-and-GO. ¡Ah, el dulce olor del éxito!

Figure 3 - A sample output from the Qwiic Environmental Combo Breakout.
Figura 3 – Un resultado de muestra del Qwiic Environmental Combo Breakout.

Componentes

SparkFun Environmental Combo Breakout – CSS811/BME280 (Qwiic) – SEN-14348 $35.95 Cable Qwiic – PRT-14427 $1.50

Paso a paso

1. Enchufa el adaptador Qwiic en tu conector ODROID-GO GPIO.

2. Conecta el cable Qwiic al adaptador Qwiic y conecta el otro extremo a la Environmental Combo Breakout Board.

3. Entra y carga este simple esquema de Arduino en tu dispositivo de juegos portátil ODROID-GO:

/******************************************************************************
BME280Compensated.ino
Marshall Taylor @ SparkFun Electronics
April 4, 2017
https://github.com/sparkfun/CCS811_Air_Quality_Breakout
https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library
This example uses a BME280 to gather environmental data that is then used
to compensate the CCS811.
Hardware Connections (Breakoutboard to Arduino):
3.3V to 3.3V pin
GND to GND pin
SDA to A4
SCL to A5
Resources:
Uses Wire.h for i2c operation
Hardware Connections:
Attach the Qwiic Environmental Combo to the Qwiic Adapter board mounted on your ODROID-GO
Display on the ODROID-GO @ 320x240
Development environment specifics:
Arduino IDE 1.8.1
This code is released under the [MIT License](http://opensource.org/licenses/MIT).
Please review the LICENSE.md file included with this example. If you have any questions
or concerns with licensing, please contact techsupport@sparkfun.com.
Distributed as-is; no warranty is given.
******************************************************************************/
#include 
#include 
#include 
#include

#define CCS811_ADDR 0x5B //Default I2C Address
//#define CCS811_ADDR 0x5A //Alternate I2C Address

//Global sensor objects
CCS811 myCCS811(CCS811_ADDR);
BME280 myBME280;

ILI9341 lcd = ILI9341();

void setup()
{
Serial.begin(9600);
Serial.println();
Serial.println("Apply BME280 data to CCS811 for compensation.");

Wire.begin();

//This begins the CCS811 sensor and prints error status of .begin()
CCS811Core::status returnCode = myCCS811.begin();
if (returnCode != CCS811Core::SENSOR_SUCCESS)

Serial.println("Problem with CCS811");
printDriverError(returnCode);

else

Serial.println("CCS811 online");

//Initialize BME280
//For I2C, enable the following and disable the SPI section
myBME280.settings.commInterface = I2C_MODE;
myBME280.settings.I2CAddress = 0x77;
myBME280.settings.runMode = 3; //Normal mode
myBME280.settings.tStandby = 0;
myBME280.settings.filter = 4;
myBME280.settings.tempOverSample = 5;
myBME280.settings.pressOverSample = 5;
myBME280.settings.humidOverSample = 5;

//Calling .begin() causes the settings to be loaded
delay(10); //Make sure sensor had enough time to turn on. BME280 requires 2ms to start up.
byte id = myBME280.begin(); //Returns ID of 0x60 if successful
if (id != 0x60)

Serial.println("Problem with BME280");

else

Serial.println("BME280 online");

// Setup LCD
lcd.begin();
lcd.setRotation(1);
lcd.fillScreen(BLACK);
lcd.setBrightness(255);
lcd.setTextFont(1);
lcd.setTextSize(2);
lcd.setCharCursor(10, 2);
lcd.setTextColor(LIGHTGREY);
lcd.println("ODROID-GO");
lcd.setCharCursor(5, 4);
lcd.println("Environmental Data");
lcd.setTextSize(2);

}
//---------------------------------------------------------------
void loop()
{
// Initiate the text cursor position
lcd.setCharCursor(1, 6);

//Check to see if data is available
if (myCCS811.dataAvailable())

//Calling this function updates the global tVOC and eCO2 variables
myCCS811.readAlgorithmResults();
//printData fetches the values of tVOC and eCO2
printData();

float BMEtempC = myBME280.readTempC();
float BMEhumid = myBME280.readFloatHumidity();

Serial.print("Applying new values (deg C, %): ");
Serial.print(BMEtempC);
Serial.print(",");
Serial.println(BMEhumid);
Serial.println();

//This sends the temperature data to the CCS811
myCCS811.setEnvironmentalData(BMEhumid, BMEtempC);

else if (myCCS811.checkForStatusError())

Serial.println(myCCS811.getErrorRegister()); //Prints whatever CSS811 error flags are detected

delay(2000); //Wait for next reading
}

//---------------------------------------------------------------
void printData()
{
lcd.setTextColor(BLUE, BLACK);
Serial.print(" CO2[");
lcd.print ("CO2: [");
Serial.print(myCCS811.getCO2());
lcd.print (myCCS811.getCO2());
Serial.print("]ppm");
lcd.println ("] ppm");

Serial.print(" TVOC[");
lcd.print (" TVOC: [");
Serial.print(myCCS811.getTVOC());
lcd.print (myCCS811.getTVOC());
Serial.print("]ppb");
lcd.println ("] ppb");
lcd.println (" ");

lcd.setTextColor(RED, BLACK);
Serial.print(" temp[");
lcd.print (" Temp: ");
Serial.print(myBME280.readTempC(), 1);
lcd.print (myBME280.readTempC(), 1);
Serial.print("]C");
lcd.println ("C");

Serial.print(" pressure[");
lcd.print (" Press: ");
Serial.print(myBME280.readFloatPressure(), 2);
lcd.print (myBME280.readFloatPressure(), 2);
Serial.print("]Pa");
lcd.println ("Pa");
lcd.println (" ");

lcd.setTextColor(ORANGE, BLACK);
Serial.print(" humidity[");
lcd.print (" Humidity: ");
Serial.print(myBME280.readFloatHumidity(), 0);
lcd.print (myBME280.readFloatHumidity(), 0);
Serial.print("]%");
lcd.println ("%");

Serial.println();
}

//printDriverError decodes the CCS811Core::status type and prints the
//type of error to the serial terminal.
//
//Save the return value of any function of type CCS811Core::status, then pass
//to this function to see what the output was.
void printDriverError( CCS811Core::status errorCode )
{
switch ( errorCode )

case CCS811Core::SENSOR_SUCCESS:
Serial.print("SUCCESS");
break;
case CCS811Core::SENSOR_ID_ERROR:
Serial.print("ID_ERROR");
break;
case CCS811Core::SENSOR_I2C_ERROR:
Serial.print("I2C_ERROR");
break;
case CCS811Core::SENSOR_INTERNAL_ERROR:
Serial.print("INTERNAL_ERROR");
break;
case CCS811Core::SENSOR_GENERIC_ERROR:
Serial.print("GENERIC_ERROR");
break;
default:
Serial.print("Unspecified error.");

}
4. Usa tu sensor de calidad del aire recién montado para descubrir quién ha estado usando el formaldehído sin tu permiso.

Figure 4 - Compare the results between two similar environmental sensor boards. Does something smell fishy here?
Figura 4 - Compara los resultados de las dos placas de sensores ambientales similares. ¿Aquí huele a gato encerrado?

NOTA: Para obtener un resultado de calidad del aire válido de la Environmental Combo board, debes llevar a cabo un ciclo de “quemado” del sensor CSS811 durante 48 horas y debe realizar un precalentamiento de unos 20 minutos antes de cada uso.

Be the first to comment

Leave a Reply