The Alpha Geek – Geeking Out

ams CCS811

Project #23: E-Textiles – ams CCS811 – Mk05

——

#DonLucElectronics #DonLuc #ETextiles #Wearable #FLORA #MicroOLED #BME280 #CCS811 #Arduino #Project #Programming #Electronics #Microcontrollers #Consultant

——

ams CCS811

——

ams CCS811

——

ams CCS811

——

ams CCS811 Ultra-Low Power Digital Gas Sensor for Monitoring Indoor Air Quality

The CCS811 is an ultra-low power digital gas sensor solution which integrates a metal oxide (MOX) gas sensor to detect a wide range of Volatile Organic Compounds (VOCs) for indoor air quality monitoring with a microcontroller unit (MCU), which includes an Analog-to-Digital converter (ADC), and an I²C interface.

CCS811 is based on ams unique micro-hotplate technology which enables a highly reliable solution for gas sensors, very fast cycle times and a significant reduction in average power consumption. The integrated MCU manages the sensor drive modes and raw sensor data measured while detecting VOCs. The I²C digital interface significantly simplifies the hardware and software design, enabling a faster time to market.

CCS811 supports intelligent algorithms to process raw sensor measurements to output a TVOC value or equivalent CO2 (eCO2) levels, where the main cause of VOCs is from humans. CCS811 supports multiple measurement modes that have been optimised for low-power consumption during an active sensor measurement and idle mode extending battery life in portable applications.

Applications

This device can be mainly used for indoor air quality monitoring in:

  • Smartphones
  • Wearables
  • Home and building automation
  • Accessories

DL2204Mk05

1 x FLORA – Version 1.0a
1 x SparkFun Micro OLED
1 x SparkFun Environmental Combo CCS811/BME280
1 x RGB Smart NeoPixel
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable

FLORA – Version 1.0a

NEO – Digital 6
SDA – Analog A2
SCL – Analog A3
VIN – +5V
GND – GND

DL2204Mk05p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #23: E-Textiles - ams CCS811 - Mk05
23-05
DL2204Mk05p.ino
1 x FLORA - Version 1.0a
1 x SparkFun Micro OLED
1 x SparkFun Environmental Combo CCS811/BME280
1 x RGB Smart NeoPixel
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// Wire
#include <Wire.h>
// NeoPixels
#include <Adafruit_NeoPixel.h>
// SparkFun Micro OLED
#include <SFE_MicroOLED.h>
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
#include <SparkFunBME280.h>
// SparkFun CCS811 - eCO2 & tVOC
#include <SparkFunCCS811.h>

// NeoPixels
// On digital pin 6
#define PIN 6
// NeoPixels NUMPIXELS = 1
#define NUMPIXELS 1
// Pixels
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
// Red
int red = 0;
// Green
int green = 0;
// Blue
int blue = 0;
// Neopix
int iNeo = 0;
// Value
int zz = 0;

// SparkFun Micro OLED
#define PIN_RESET 9
#define DC_JUMPER 1
// I2C declaration
MicroOLED oled(PIN_RESET, DC_JUMPER);

// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure
BME280 myBME280;
// Temperature Celsius
float BMEtempC = 0;
// Humidity
float BMEhumid = 0;
// Altitude Meters
float BMEaltitudeM = 0;
// Barometric Pressure
float BMEpressure = 0;

// SparkFun CCS811 - eCO2 & tVOC
// Default I2C Address
#define CCS811_ADDR 0x5B 
CCS811 myCCS811(CCS811_ADDR);
// eCO2
float CCS811CO2 = 0;
// TVOC
float CCS811TVOC = 0;

// Software Version Information
String sver = "23-05";

void loop() {

  // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure
  isBME280();

  // SparkFun CCS811 - eCO2 & tVOC
  isCCS811();

  // FLORA
  isFLORA();

  // Micro OLED
  isMicroOLED();
 
}

getBME280.ino

// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure
// isBME280 - Temperature, Humidity, Altitude and Barometric Pressure
void isBME280(){

  // Temperature Celsius
  BMEtempC = myBME280.readTempC();
  // Humidity
  BMEhumid = myBME280.readFloatHumidity();
  // Altitude Meters
  BMEaltitudeM = myBME280.readFloatAltitudeMeters();
  // Barometric Pressure
  BMEpressure = myBME280.readFloatPressure();
  
}

getCCS811.ino

// CCS811 - eCO2 & tVOC
// isCCS811 - eCO2 & tVOC
void isCCS811(){

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

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

  // eCO2 Concentration
  CCS811CO2 = myCCS811.getCO2();
  
  // tVOC Concentration
  CCS811TVOC = myCCS811.getTVOC();
  
}

getFLORA.ino

// FLORA
// isFLORA
void isFLORA() {

  // FLORA = Temperature Celsius
  // BMEtempC

  // FLORA = Temperature Celsius
  if ( BMEtempC >= 50 ) {

    // 40 <= Temperature Celsius < 50~~~
    zz = 2;
    isNUMPIXELS();

  } else if ( BMEtempC >= 40 ) {

    // 30 <= Temperature Celsius < 40
    zz = 3;
    isNUMPIXELS();
    
  }  else if ( BMEtempC >= 30 ) {

    // 20 <= Temperature Celsius < 30
    zz = 4;
    isNUMPIXELS();
    
  } else if ( BMEtempC >= 20 ) {

    // 10 <= Temperature Celsius < 20
    zz = 0;
    isNUMPIXELS();
    
  } else if ( BMEtempC >= 10 ) {

    // ~~~0 <= Temperature Celsius < 10
    zz = 1;
    isNUMPIXELS();
    
  }
    
}

getMicroOLED.ino

// SparkFun Micro OLED
// Setup Micro OLED
void setupMicroOLED() {

  // Initialize the OLED
  oled.begin();
  // Clear the display's internal memory
  oled.clear(ALL);
  // Display what's in the buffer (splashscreen)
  oled.display();

  // Delay 1000 ms
  delay(1000);

  // Clear the buffer.
  oled.clear(PAGE);
  
}
// Micro OLED
void isMicroOLED() {

  // Text Display BME280
  // Clear the display
  oled.clear(PAGE);
  // Set cursor to top-left
  oled.setCursor(0, 0);
  // Set font to type 0
  oled.setFontType(0);
  // Temperature Celsius
  oled.print("T: ");
  oled.print(BMEtempC);
  oled.setCursor(0, 10);
  // Humidity
  oled.print("H: ");
  oled.print(BMEhumid);
  oled.setCursor(0, 20);
  // Altitude Meters
  oled.print("A: ");
  oled.print(BMEaltitudeM);
  oled.setCursor(0, 30);
  // Barometric Pressure
  oled.print("P: ");
  oled.print(BMEpressure);
  oled.display();

  // Delay
  delay( 2000 );

  // Text Display CCS811
  // Clear the display
  oled.clear(PAGE);
  // Set cursor to top-left
  oled.setCursor(0, 0);
  // Set font to type 0
  oled.setFontType(0);
  // eCO2 Concentration
  oled.print("eCO2");
  oled.setCursor(0, 10);
  oled.print(CCS811CO2);
  // tVOC Concentration
  oled.setCursor(0, 20);
  oled.print("tVOC");
  oled.setCursor(0, 30);
  oled.print(CCS811TVOC);
  oled.display();

  // Delay
  delay( 2000 );

}

getNeopix.ino

// NeoPixels
// Neopix
void isNeopix() 
{ 

    // Pixels
    pixels.setBrightness( 150 );
    // Pixels color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor( iNeo, pixels.Color(red,green,blue) ); 
    // This sends the updated pixel color to the hardware
    pixels.show(); 
    // Delay for a period of time (in milliseconds)
    delay(50);     
  
}
// isNUMPIXELS
void isNUMPIXELS()
{

  // Neopix Value
  switch ( zz ) {  
    case 0:
      // NeoPixels Green
      // Red
      red = 0;
      // Green
      green = 255;
      // Blue
      blue = 0;
      // Neopix
      iNeo = 0;   
      isNeopix();
      break;  
    case 1:
      // NeoPixels Blue
      // Red
      red = 0;
      // Green
      green = 0;
      // Blue
      blue = 255;
      // Neopix
      iNeo = 0;
      isNeopix();
      break;
    case 2:
      // NeoPixels Red
      // Red
      red = 255;
      // Green
      green = 0;
      // Blue
      blue = 0;
      // Neopix
      iNeo = 0;   
      isNeopix();
      break;
    case 3:
      // NeoPixels Yellow
      // Red
      red = 255;
      // Green
      green = 255;
      // Blue
      blue = 0;
      // Neopix
      iNeo = 0;
      isNeopix();
      break;
    case 4:
      // NeoPixels Magenta
      // Red
      red = 255;
      // Green
      green = 0;
      // Blue
      blue = 255;
      // Neopix
      iNeo = 0;
      isNeopix();
      break;
    case 5:
      // NeoPixels Cyan
      // Red
      red = 0;
      // Green
      green = 255;
      // Blue
      blue = 255;
      // Neopix
      iNeo = 0;
      isNeopix();
      break;
    case 6:
      // NeoPixels White
      // Red
      red = 255;
      // Green
      green = 255;
      // Blue
      blue = 255;
      // Neopix
      iNeo = 0;
      isNeopix();    
      break;
  }
  
}
// isNUMPIXELSoff
void isNUMPIXELSoff()
{

   // Black Off
   // NeoPixels
   // Red
   red = 0;
   // Green
   green = 0;
   // Blue
   blue = 0;
   isNeopix();
 
}

setup.ino

// Setup
void setup() {

  // NeoPixels
  // This initializes the NeoPixel library
  pixels.begin();
  // Delay for a period of time (in milliseconds)
  delay(50);
  // isNUMPIXELS Off
  isNUMPIXELSoff();

  // Set up I2C bus
  Wire.begin();

  // Delay for a period of time (in milliseconds)
  delay(50);
  // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure
  myBME280.begin();

  // CCS811 - eCO2 & tVOC
  myCCS811.begin();

  // Setup Micro OLED
  setupMicroOLED();

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • IoT
  • Robotics
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Research & Development (R & D)
  • Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
  • Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
  • Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
  • Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
  • Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
  • Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
  • eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)

Instructor and E-Mentor

  • IoT
  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics
  • DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
  • Linux-Apache-PHP-MySQL

Follow Us

J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Categories
Archives