The Alpha Geek – Geeking Out

Project #23: E-Textiles – Coin Cell Battery – Mk08

——

#DonLucElectronics #DonLuc #ETextiles #Wearable #FLORA #BME280 #CCS811 #CoinCell #RTC #SD #Arduino #Project #Programming #Electronics #Microcontrollers #Consultant

——

Coin Cell Battery

——

Coin Cell Battery

——

Coin Cell Battery

——

Coin Cell Battery Holder – 2 x CR2032 (Enclosed)

This is a simple coin cell battery holder that can enclose two CR2032 batteries inside itself, and safely kept closed via two phillips head screws. Each battery holder will run batteries in series, output up to 6V, and is equipped with an On/Off slide switch and two 6″ power wires (one positive and one negative) on the back.

DL2205Mk03

1 x FLORA – Version 1.0a
1 x SparkFun Environmental Combo CCS811/BME280
1 x DS3231 Precision RTC FeatherWing
1 x MicroSD card breakout board+
1 x MicroSD card 8 Gb
1 x CR1220 Coin Cell Battery
1 x LED Red
1 x 220 Ohm
1 x Coin Cell Battery Holder – 2 x CR2032
2 x CR2032 Coin Cell Battery
1 x SparkFun Cerberus USB Cable

FLORA – Version 1.0a

CLK – ICSP 3
DO – ICSP 1
DI – ICSP 4
CS – Digital 10
LER – Digital 6
SCL – Digital 3
SDA – Digital 2
VIN – +5V
VIN – +3.3V
GND – GND

——

DL2205Mk03p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #23: E-Textiles - Coin Cell Battery - Mk08
23-08
DL2205Mk03p.ino
1 x FLORA - Version 1.0a
1 x SparkFun Environmental Combo CCS811/BME280
1 x DS3231 Precision RTC FeatherWing
1 x MicroSD card breakout board+
1 x MicroSD card 8 Gb
1 x CR1220 Coin Cell Battery
1 x LED Red
1 x 220 Ohm
1 x Coin Cell Battery Holder - 2 x CR2032
2 x CR2032 Coin Cell Battery
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// Wire
#include <Wire.h>
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
#include <SparkFunBME280.h>
// SparkFun CCS811 - eCO2 & tVOC
#include <SparkFunCCS811.h>
// Date and time DS3231 RTC
#include <RTClib.h>
// Serial Peripheral Interface (SPI)
#include <SPI.h>
// Secure Digital (SD Card)
#include <SD.h>

// 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;

// Date and time functions using a DS3231 RTC
RTC_DS3231 RTC;
String sDate;
String sTime;

// Secure Digital (SD Card)
const int chipSelect = 10;
String zzzzzz = "";

// LED Red
const int iLEDR = 6;

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

void loop() {

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

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

  // Dates and Time
  timeRTC();

  // MicroSD Card
  isSD();

  // 1 Seconds
  delay( 1000 );

}

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();
  
}

getRTCDS3231.ino

// DS3231 Precision RTC
// Setup RTC
void setupRTC() {

  // DS3231 Precision RTC   
  RTC.begin();
  if (! RTC.begin()) {
    
    while (1);
    
  }
  
  DateTime now = RTC.now();

  if (RTC.lostPower()) {
    
    // Following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // August 2, 2021 at 13:53:0 you would call:
    // RTC.adjust(DateTime(2022, 4, 26, 11, 39, 0));
    
  }
  
}
// timeRTC
void timeRTC() {

    // DS3231 Precision RTC
    sDate = "";
    sTime = "";
    // Date Time
    DateTime now = RTC.now();

    // sData
    sDate += String(now.year(), DEC);
    sDate += "/";
    sDate += String(now.month(), DEC);
    sDate += "/";
    sDate += String(now.day(), DEC);
  
    // sTime
    sTime += String(now.hour(), DEC);
    sTime += ":";
    sTime += String(now.minute(), DEC);
    sTime += ":";
    sTime += String(now.second(), DEC);

}

getSD.ino

// MicroSD Card
// MicroSD Setup
void setupSD() {

    // MicroSD Card
   // See if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {

    // Don't do anything more:
    while (1);
    
  }

}
// MicroSD Card
void isSD() {

  zzzzzz = "";

  // Version|Date|Time|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure
  //|eCO2 Concentration|tVOC Concentration|
  zzzzzz = sver + "|" + sDate + "|" + sTime + "|" 
  + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|"
  + CCS811CO2 + "|" + CCS811TVOC + "|";

  // Open the file. Note that only one file can be open at a time,
  // so you have to close this one before opening another.
  File dataFile = SD.open("DLE22Log.txt", FILE_WRITE);

  // If the file is available, write to it:
  if (dataFile) {
    
    // Write
    dataFile.println( zzzzzz );
    dataFile.close();

  }

}

setup.ino

// Setup
void setup() {

  // Delay
  delay( 100 );
  
  // Set up I2C bus
  Wire.begin();

  // Delay
  delay( 50 );

  // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure
  myBME280.begin();

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

  // Setup RTC
  setupRTC();

  //MicroSD Card
  setupSD();

  // LED Red
  pinMode( iLEDR , OUTPUT);
  // Turn the LED Red on HIGH
  digitalWrite( iLEDR , HIGH);

}

——

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)

Instructor and E-Mentor

  • IoT
  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics

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

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories
Archives