Project showcase
Simple Mini Logger

Simple Mini Logger © GPL3+

A simple humidity, temperature, and pressure data logger.

  • 1,820 views
  • 0 comments
  • 16 respects

Components and supplies

Kce8bkptj7srmwx6wcxu
Arduino Mini 05
×1
sht31-d
×1
bmp180
×1
rtc module
×1
sd card module
×1
rj 11 socket
×1
rj 11 lead
×1
50k potentiometer
×1

About this project

Components

Arduino Pro Mini 5V 16MHz

SD card module

RTC module with battery

RJ11 socket (optional)

BMP180 pressure sensor (preferably with a 5V input power option on a breakout board)

SHT31-D humidity sensor

24 X 4 LCD module with I2C interface

3 small push buttons

Lots of little wires

Soldering iron

and also a usb to serial adaptor to program the arduino.

Why I Made It

I wanted to be able to view live atmospheric information and also log it for looking at it in a graph whenever I want. Simply

I have not included a case in this project as I'm sure people will know what the best case for them selves is.

I started by soldering all the components onto a strip board like so I thought we be most efficient.

The screen just plugs straight into that little header you see on the top between the rj11 plastic socket and the clock battery.

Then proceeded to cut the strips so that the components are not shorted out like so:

I then soldered on wires to join the components to the necessary point on the Arduino.

Connections

Pin numberPin numbers:

10 -- to sd card ss or some people say cs

11 -- to sd card mosi

12 -- to sdcard miso

13 to sdcard sck

Pin numberPin numbers:

A5 -- to i2c strips that connect to the header for screen A5 is SCL

A4 --- to i2c strips that connect to the header for screen A4 is SCL

It makes sense when you look at the pins at the back of the screen which way round they go.

sda to sda.

scl to scl

Then connect positive +ve and negitive -ve to the header to power all the sensors and devices. then wire all all sda to the same strip wires are needed as the clock does not line up with the other two devices.

Wire in the optional rj11 connector if you want to be able to remove your sensors or not if you dont mind just solder then directly in.

Pin numbers:

2 to button 1

3 to button 2

4 to button 3

Ground to the other contact of all the buttons ( I just had one wire and joined all the button pint on the negative side to one rail.

I have my sensors on the end of a lead in a plastic tube with a hole in it.

for the power supply I used an old connector I had lying around. there are many different power plug options I assume people will chose their own preference.

The buttons are to set the time. for the clock

The way the program works is if you have the bottom button of the three pressed down when you switch the thing on it enters a clock set mode and you use the top two buttons to change the value. Top for + 1. Middle for - 1. and bottom to set the next bit of the clock. The menu goes, set year. then set month. and so on until minutes.

The logger logs the data in a file on the sd card called DATALOG.txt and it is in csv format.

It's quite low power and last 4 days on a 2000 Milli amp hour lithium power pack sometimes the pack will cut out if the logger doesn't draw enough power. i found that lithium power packs usually have a led you can switch on as a torch on the if you do that it doesn't switch off anymore.

i added a 50 k ohm potentiometer to the screen back light contacts and it works very well as a brightness knob.

Here is a small example of the output file format:

2018/10/14: 1:23:0,997.31,19.10,78.56

2018/10/14: 1:24:0,997.42,19.10,78.55

2018/10/14: 1:25:0,997.47,19.10,78.54

2018/10/14: 1:26:0,997.44,19.09,78.59

2018/10/14: 1:27:0,997.55,19.09,78.59

2018/10/14: 1:28:0,997.47,19.10,78.60

Code

Micro_loggerArduino
#include <Wire.h>
#include <Adafruit_BMP085.h>
#include <LiquidCrystal_I2C.h>
#include <WEMOS_SHT3X.h>
#include "RTClib.h"
#include "DS1307.h"
#include <SPI.h>
#include <SD.h>
#define TEMPERATURE_PRECISION 14

const int chipSelect = 10;

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address
SHT3X sht30(0x45);        // SHT30 object to enable readings
Adafruit_BMP085 bmp;
RTC_DS1307 rtc;
DS1307 clock;//define a object of DS1307 class



char ascii=0x00+223;
float TE = 0.1;
float HU = 0.1;
const int buttonPin = 2;     
int buttonState = HIGH;         // variable for reading the pushbutton status


void setup() {



  
    const int buttonPin = 2;     
    const int buttonPin1 = 4;     
    const int buttonPin2 = 3;     
    int p = 2018;
    int l = 0;
    int j = 0;
    int h = 0;
    int m = 0;
    int buttonState = HIGH;  
    int buttonState1 = HIGH;  
    int buttonState2 = HIGH; 
  
     lcd.begin(20,4);   // initialize the lcd for 16 chars 2 lines, turn on backlight
     lcd.noCursor();
     pinMode(buttonPin, INPUT);
     digitalWrite(buttonPin, HIGH); 
     buttonState = digitalRead(buttonPin);

     if (buttonState == 0) { // if the button is presed while turning on device it enters  the set time menu
     lcd.print("SET");
     delay(1000);
     clock.begin();
     DateTime now = rtc.now();



     pinMode(buttonPin2, INPUT);
     digitalWrite(buttonPin2, HIGH); 
     buttonState2 = digitalRead(buttonPin2);

    
     pinMode(buttonPin1, INPUT);
     digitalWrite(buttonPin1, HIGH); 
     buttonState = digitalRead(buttonPin1);
     lcd.clear();
      while (buttonState == 1){
        lcd.print("Year: ");
        lcd.print(p);
        lcd.setCursor(0,3);
        lcd.print("Next");
        delay(100);
        lcd.setCursor(0,0);
        buttonState1 = digitalRead(buttonPin1);
        buttonState2 = digitalRead(buttonPin2);
        buttonState = digitalRead(buttonPin);

        if (buttonState1 == 0){
          p = p + 1;
          delay(100);}
        

        if (buttonState2 == 0){
          p = p - 1;
          delay(100);}
         }

     lcd.clear();        
     delay(500);
     buttonState = digitalRead(buttonPin);
        
     while (buttonState == 1){
         lcd.print("Month: ");
         lcd.print(l);
         lcd.setCursor(0,3);
         lcd.print("Next");        
         delay(100);
         lcd.setCursor(8,0);
         lcd.print("  ");       
         lcd.setCursor(0,0);
        buttonState1 = digitalRead(buttonPin1);
        buttonState2 = digitalRead(buttonPin2);
        buttonState = digitalRead(buttonPin);

         if (buttonState1 == 0){
           l = l + 1;
           delay(100);}
        

         if (buttonState2 == 0){
           l = l - 1;
           delay(100);}
        }
      lcd.clear();
      delay(500);
      buttonState = digitalRead(buttonPin);      
         
      while (buttonState == 1){
         lcd.print("Day: ");
         lcd.print(j);
         lcd.setCursor(0,3);
         lcd.print("Next");          
         delay(100);
         lcd.setCursor(6,0);
         lcd.print("  ");
         lcd.setCursor(0,0);
        buttonState1 = digitalRead(buttonPin1);
        buttonState2 = digitalRead(buttonPin2);
        buttonState = digitalRead(buttonPin);

         if (buttonState1 == 0){
           j = j + 1;
           delay(100);}
        

         if (buttonState2 == 0){
           j = j - 1;
           delay(100);}
        }
      lcd.clear();
      delay(500);
      buttonState = digitalRead(buttonPin); 
              
      while (buttonState == 1){
         lcd.print("Hour:  ");
         lcd.print(h);
         lcd.setCursor(0,3);
         lcd.print("Next");         
         delay(100);
         lcd.setCursor(8,0);
         lcd.print("  ");         
         lcd.setCursor(0,0);
        buttonState1 = digitalRead(buttonPin1);
        buttonState2 = digitalRead(buttonPin2);
        buttonState = digitalRead(buttonPin);

         if (buttonState1 == 0){
           h = h + 1;
           delay(100);}
        

        if (buttonState2 == 0){
           h = h - 1;
           delay(100);}
        }
     lcd.clear();
     delay(500);
     buttonState = digitalRead(buttonPin); 
              
      while (buttonState == 1){
         lcd.print("Minute: ");
         lcd.print(m);
         lcd.setCursor(0,3);
         lcd.print("Next");            
         delay(100);
         lcd.setCursor(9,0);
         lcd.print("  ");
         lcd.setCursor(0,0);
        buttonState1 = digitalRead(buttonPin1);
        buttonState2 = digitalRead(buttonPin2);
        buttonState = digitalRead(buttonPin);

         if (buttonState1 == 0){
           m = m + 1;
           delay(100);}
        

        if (buttonState2 == 0){
           m = m - 1;
           delay(100);}
        }
        
        
    clock.fillByYMD(p,l,j);
    clock.fillByHMS(h,m,0);
    clock.setTime();//write time to the RTC chip
     }                                              /// end of set time menu 
 clock.begin();
 DateTime now = rtc.now();

  Wire.begin();
  rtc.begin();
  lcd.begin(20,4);   // initialize the lcd for 16 chars 2 lines, turn on backlight
  lcd.noCursor();
  lcd.print(buttonState);
   delay(1000);

  bmp.begin();

  }

  void loop()
{
 
 int n = 0; 
 
 
  n = n + 1;
   DateTime now = rtc.now();
   bmp.readTemperature();
   sht30.get(); 
  float dew_point = 243.04*(log(sht30.humidity/100)+((17.625*sht30.fTemp)/(243.04+sht30.fTemp)))/(17.625-log(sht30.humidity/100)-((17.625*sht30.fTemp)/(243.04+sht30.fTemp)));
  float RHx       = sht30.humidity;
  float T         = sht30.fTemp;
  float heat_index;
  heat_index =(-42.379+(2.04901523*T)+(10.14333127*RHx)-(0.22475541*T*RHx)-(0.00683783*T*T)-(0.05481717*RHx*RHx)+(0.00122874*T*T*RHx)+(0.00085282*T*RHx*RHx)-(0.00000199*T*T*RHx*RHx)-32)*5/9;
  if ((sht30.cTemp <= 26.66) || (sht30.humidity <= 40)) heat_index = sht30.cTemp;
  float P = bmp.readPressure();
  float PC = P /100;
    TE = sht30.cTemp;
    HU = sht30.humidity;
  lcd.setCursor(0,0);
  lcd.print("Pre:  "); lcd.print("      "); lcd.setCursor(7,0); lcd.print(PC); lcd.print(" HPa");

  lcd.setCursor(0,1);
  lcd.print("Temp: "); lcd.print("      "); lcd.setCursor(7,1); lcd.print(TE); lcd.print(ascii);lcd.print("C");
  lcd.setCursor(0,2);
  lcd.print("Hu:   "); lcd.print("      "); lcd.setCursor(7,2); lcd.print(HU);lcd.print(" %Rh");
  lcd.setCursor(17,3);
  lcd.print("   ");
  lcd.setCursor(0,3);
  lcd.setCursor(0,3);
    lcd.print(now.year(), DEC); 
    lcd.print('/');
    lcd.print(now.month(), DEC);
    lcd.print('/');
    lcd.print(now.day(), DEC);
    lcd.print(": ");
    lcd.print(now.hour(), DEC);
    lcd.print(':');
    lcd.print(now.minute(), DEC);
    lcd.print(':');
    lcd.print(now.second(), DEC);
    
    int Ti = now.second();


   xif (Ti < 1){
   DateTime now = rtc.now();
   bmp.readTemperature();

  float dew_point = 243.04*(log(sht30.humidity/100)+((17.625*sht30.fTemp)/(243.04+sht30.fTemp)))/(17.625-log(sht30.humidity/100)-((17.625*sht30.fTemp)/(243.04+sht30.fTemp)));
  float RHx       = sht30.humidity;
  float T         = sht30.fTemp;
  float heat_index;
  heat_index =(-42.379+(2.04901523*T)+(10.14333127*RHx)-(0.22475541*T*RHx)-(0.00683783*T*T)-(0.05481717*RHx*RHx)+(0.00122874*T*T*RHx)+(0.00085282*T*RHx*RHx)-(0.00000199*T*T*RHx*RHx)-32)*5/9;
  if ((sht30.cTemp <= 26.66) || (sht30.humidity <= 40)) heat_index = sht30.cTemp;
  float P = bmp.readPressure();
  float PC = P /100;

   String dataString = "";
   float b = (sht30.cTemp,2);
   float c = (sht30.humidity,2);
    dataString += String(now.year(), DEC);
    dataString += String('/');
    dataString += String(now.month(), DEC);
    dataString += String('/');
    dataString += String(now.day(), DEC);
    dataString += String(": ");
    dataString += String(now.hour(), DEC);
    dataString += String(':');
    dataString += String(now.minute(), DEC);
    dataString += String(':');
    dataString += String(now.second(), DEC);
    dataString += ",";
  
    dataString += String(PC);
    dataString += ",";
    dataString += TE;
    dataString += ",";
    dataString += HU;

   SD.begin(10);
  // 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("datalog.txt", FILE_WRITE);

  // if the file is available, write to it:
  if (dataFile) {
    dataFile.println(dataString);
    dataFile.close();
    // print to the serial port too:


  }
  // if the file isn't open, pop up an error:
  else {
    lcd.println("error opening datalog.txt");
    delay(500);
    lcd.clear();
  }
}
}

Schematics

Micro-logger
Its a small simple humidity temperature pressure logger with time
Project vlmtjtcyqi

Comments

Similar projects you might like

Temperature and Humidity Data Logger

Project tutorial by Wimpie van den Berg

  • 24,058 views
  • 2 comments
  • 25 respects

Simple Water Quality Analysis

Project showcase by Wen-Liang Lin

  • 12,499 views
  • 6 comments
  • 16 respects

Arduino Based Mini CNC 2D Plotter

Project showcase by Mrinnovative

  • 75,701 views
  • 13 comments
  • 187 respects

Mini CNC: A Handmade Masterpiece

Project showcase by Mr-M

  • 34,934 views
  • 11 comments
  • 217 respects

A Simple Arduino Menu With An LCD

by Ian Cumming

  • 27,592 views
  • 24 comments
  • 14 respects

Simple Arduino Soldering Station

Project showcase by lazyvlad

  • 14,516 views
  • 0 comments
  • 37 respects
Add projectSign up / Login