zaterdag 24 oktober 2020

Weerstation met BME280 en Oled i2c

 /*

 * Arduino with SSD1306 OLED display (128x64 Pixel) and BME280 sensor.

 * BME280 is barometric pressure, temperature and humidity sensor.

 */


#include <Wire.h>              // include Arduino wire library (required for I2C devices)

#include <Adafruit_GFX.h>      // include Adafruit graphics library

#include <Adafruit_SSD1306.h>  // include Adafruit SSD1306 OLED display driver

#include <Adafruit_BME280.h>   // include Adafruit BME280 sensor library

 

#define OLED_RESET  4    // define display reset pin


#define SCREEN_WIDTH 128 // OLED display width, in pixels

#define SCREEN_HEIGHT 64 // OLED display height, in pixels


#define SEALEVELPRESSURE_HPA (1013.25)


// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

 

// define device I2C address: 0x76 or 0x77 (0x77 is library default address)

#define BME280_I2C_ADDRESS  0x76

 

Adafruit_BME280  bme280;  // initialize Adafruit BME280 library

 

void setup(void)

{

  delay(1000);  // wait a second

 

  // initialize the SSD1306 OLED display with I2C address = 0x3D

  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);

 

  // clear the display buffer.

  display.clearDisplay();

 

  display.setTextSize(1);   // text size = 1

  display.setTextColor(WHITE, BLACK);  // set text color to white and black background


  display.setTextSize(1);

   display.invertDisplay(true);

  display.setTextColor(WHITE);

  display.setCursor(20, 4);

  display.println("Arduino Projects");

  display.drawRoundRect(0, 0, 128, 16, 4, WHITE); //drawRect(x, y, width, height, color) 

    display.setCursor(20, 20);

  display.setTextSize(2);

      display.setCursor(20, 20);

    display.println("By");

      display.setTextSize(3);

          display.setCursor(10, 40);

      display.println("Spike");

     

  


  

 

  // initialize the BME280 sensor

  if( bme280.begin(BME280_I2C_ADDRESS) == 0 )

  {  // connection error or device address wrong!

    display.setCursor(34, 23);

    display.print("Connection");

    display.setCursor(49, 33);

    display.print("Error");

    display.display();        // update the display

    while(1);                 // stay here

  }

 


  display.display();        // update the display

 delay(2000);

  display.invertDisplay(false);

}

 

char _buffer[12];

 

void loop()

{    

  display.clearDisplay();

  display.setTextColor(WHITE, BLACK); 

   display.setTextSize(1); 

  

  // read temperature, humidity and pressure from the BME280 sensor

  float temp = bme280.readTemperature();    // get temperature in degree Celsius

  float humi = bme280.readHumidity();       // get humidity in rH%

  float pres = bme280.readPressure();       // get pressure in Pa

  float alt = bme280.readAltitude((SEALEVELPRESSURE_HPA)); 


  display.setCursor(30, 3);

  // Display static text

  display.println("Weer Station");

//  display.drawRect(10, 10, 50, 30, WHITE);  //drawRect(x, y, width, height, color) 

display.drawRoundRect(0, 0, 120, 16, 4, WHITE);





 

  // print all data on the display

  display.setCursor(0, 20);

  display.print("TEMP:");


  display.setCursor(50, 20);

  display.print(temp);

  // print degree symbols ( ° )

  display.drawRect(85, 20, 3, 3, WHITE);

    

   display.setCursor(0, 30);

  display.print("HUMI:");

  display.setCursor(50, 30);

  display.print(humi);

display.print(" %");



   display.setCursor(0, 40);

  display.print("Luchtd:");

  display.setCursor(50, 40);

  display.print((pres/100));

  display.print(" hPa");


   display.setCursor(0, 50);

  display.print("Alt");

  display.setCursor(50, 50);

  display.print((alt));

  display.print(" m");

 

  // update the display

  display.display();

 

  delay(3000);  // wait a second








//Temp weergave

 display.clearDisplay();

   display.setCursor(20, 4);

  // Display static text

  display.println("Temperatuur");

display.drawRoundRect(0, 0, 120, 16, 4, WHITE); 

 display.setTextSize(2);   // text size = 1

  display.setCursor(0, 20);

  display.print("TEMP:");

  display.setCursor(20, 45);

  display.print(temp);

  display.drawRect(90, 45, 5, 5, WHITE);//graden symbool

  display.display();


  delay(3000);  // wait a second


//Humi weergave

 display.clearDisplay();

   display.setCursor(20, 4);

display.setTextSize(1);

  display.println("Rel Vochtigheid");

display.drawRoundRect(0, 0, 120, 16, 4, WHITE); 

 display.setTextSize(2);   // text size = 1

  display.setCursor(0, 20);

  display.print("Rel Vocht:");

  display.setCursor(20, 45);

  display.print(humi);

    display.print(" %");

  display.display();


  delay(3000);  // wait a second


//Luchtdruk weergave

 display.clearDisplay();

   display.setCursor(20, 4);

display.setTextSize(1);

  display.println("Luchtdruk");

display.drawRoundRect(0, 0, 120, 16, 4, WHITE); 

 display.setTextSize(2);   

  display.setCursor(0, 20);

  display.print("Luchtdruk:");

  display.setCursor(0, 45);

  display.print(pres/100);

    display.print("hPa");

  display.display();


  delay(3000);  // wait a second




// Big screen temp

//  display.setTextColor(BLACK,WHITE);

//display.fillRoundRect(0, 0, 128, 96, 2, WHITE);


 display.invertDisplay(true);

 

  display.clearDisplay(); 

  display.display();

  display.setCursor(30, 4);

  display.setTextSize(1);

  display.println("Temperatuur");

  display.setTextSize(3); 

  display.setCursor(10, 30);

  display.println(temp);

    // print degree symbols ( ° )

  display.drawRect(105, 30, 5, 5, WHITE);

  display.display();

  delay (2000);

  

// Big screen vocht

 display.clearDisplay();

 display.setCursor(30, 4);

 display.setTextSize(1);

 display.println("Vochtigheid %");

 display.setTextSize(3); 

 display.setCursor(10, 30);

 display.println(humi);

 display.display();

 delay(2000);

 

// Big screen luchtdruk

 display.clearDisplay();

 display.setCursor(20, 4);

 display.setTextSize(1);

 display.println("Luchtdruk in hPa");

 display.setTextSize(3); 

 display.setCursor(0, 30);

 display.println(pres/100);

 display.display();

 delay(2000);


 display.invertDisplay(false);

 

}

 

// end of code.

zondag 18 oktober 2020

i2c scanner code

 


//i found the scanning script at CircuitMagic.com so some credits go to them

#include <Wire.h>
#include <SPI.h>
//#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for SSD1306 display connected using software SPI (default case):
#define OLED_MOSI   9   // SDA op display
#define OLED_CLK   10   // SCL op display
#define OLED_DC    11   // DC op display
#define OLED_CS    12   // (niet op deze display aanwezig 
#define OLED_RESET 13   // RES op diplay
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,
  OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
  
void setup() {
   Wire.begin(); //i2c start
  Serial.begin(9600);
 
   // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if(!display.begin(SSD1306_SWITCHCAPVCC)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
 }

  display.clearDisplay();
  display.setTextSize(3);             // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_BLACK, SSD1306_WHITE); // Draw 'inverse' text
  display.setCursor(0,0);             // Start at top-left corner
  display.println(" Spike ");
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);        // Draw white text
  display.setCursor(10,30);             // Start at top-left corner
  display.println("Arduino");
  display.setCursor(10,50);             // Start at top-left corner
  display.println("Projects");
  display.display();// – call this method for the changes to make effect
  delay(2000);
  
}

void loop() {
 byte error, address;
  int nDevices;
  Serial.println("Scanning I2C bus...");
  display.clearDisplay();
  display.setTextSize(2);             // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE);        // Draw white text
  display.setCursor(0,0);             // Start at top-left corner
  display.println("Scanning ");
  display.setCursor(20,20);             // Start at top-left corner
  display.println("I2C Bus");
  display.display();// – call this method for the changes to make effect

  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

  display.setTextSize(3);             // Normal 1:1 pixel scale
  display.setCursor(30,40);             // Start at top-left corner
  display.print("0x");
  display.print(address,HEX);
  display.display();//

delay(1000);
 
       nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknow error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0){
    Serial.println("No I2C devices \n");


  display.setTextSize(1);             // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE);        // Draw white text
  display.setCursor(0,40);             // Start at top-left corner
  display.println("No I2C devices found");
  display.display();// – call this method for the changes to make effect
  }
 
  else
    Serial.println("done\n");
    display.clearDisplay();

  delay(1000); // wait 1 second for next scan
}

zaterdag 10 oktober 2020

Code voor tankinhoud met 2 displays

 


#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space

#include <SPI.h>

#include <ESP8266WiFi.h>

#include <BlynkSimpleEsp8266.h>

#include <SimpleTimer.h>

#include <DHT.h>                      //Temp sensor

#include <Wire.h>

#include <LiquidCrystal_I2C.h>   //LCD display

#include <Adafruit_GFX.h>         //Nokia Display

#include <Adafruit_PCD8544.h>     //Nokia display


// Nokia dispay:

// pin 7 - Serial clock out (SCLK)

// pin 6 - Serial data out (DIN)

// pin 5 - Data/Command select (D/C)

// pin 4 - LCD chip select (CS)

// pin 3 - LCD reset (RST)

//Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);


Adafruit_PCD8544 display = Adafruit_PCD8544(16,0, 13, 15, 3);


//Adafruit_PCD8544 display = Adafruit_PCD8544(16=D0, 0= D3, 13=D7, 15=D8, 3=RX);





// Configuration for the display  i2c op lolin pin D1=SCL  D2=SDA

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);


// Define Trig and Echo pin for ultrasonic sensor

#define trigPin 14  //(d05 op lolin)

#define echoPin 12  //(do06 op lolin)

// Define variables:

long duration;

int distance;

int inhoud;   




// You should get Auth Token in the Blynk App.

// Go to the Project Settings (nut icon).

char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxX"; //Enter the Auth code which was send by Blink


// Your WiFi credentials.

// Set password to "" for open networks.

char ssid[] = "xxxxxxxe";  //Enter your WIFI Name

char pass[] = "xxxxxxxe22";  //Enter your WIFI Password


#define DHTPIN 2          // Digital pin D4 op lolin voor temp sensor


// Uncomment whatever type you're using!

//#define DHTTYPE DHT11     // DHT 11

#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321

//#define DHTTYPE DHT21   // DHT 21, AM2301


DHT dht(DHTPIN, DHTTYPE);

SimpleTimer timer;


// This function sends Arduino's up time every second to Virtual Pin (5).

// In the app, Widget's reading frequency should be set to PUSH. This means

// that you define how often to send data to Blynk App.



void sendSensor()

{

  float h = dht.readHumidity();

  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit


  if (isnan(h) || isnan(t)) {

    Serial.println("Failed to read from DHT sensor!");

    return;

  }


//ultrasone sensor

  digitalWrite(trigPin, LOW);

  delayMicroseconds(1000);

 // Trigger the sensor by setting the trigPin high for 10 microseconds:

  digitalWrite(trigPin, HIGH);

  delayMicroseconds(2000);

  digitalWrite(trigPin, LOW);

  duration = pulseIn(echoPin, HIGH);

   // Calculate the distance:

  distance = duration*0.034/2;

inhoud= map(distance,200,30, 0,5000);

  

  //Blink settings

  // You can send any value at any time.

  // Please don't send more that 10 values per second.

  Blynk.virtualWrite(V5, h);  //V5 is for Humidity

  Blynk.virtualWrite(V6, t);  //V6 is for Temperature

  Blynk.virtualWrite(V7, distance);  //V6 is for Temperature

Blynk.virtualWrite(V8, inhoud);  //V6 is for Temperature


// some serial info 

  Serial.println(t);

  Serial.println(h);

    Serial.println(distance);  

    Serial.println(inhoud);


//tekst on display lcd

  lcd.setCursor ( 0, 0 );                 

  lcd.print("Afstand : "); //distance

  lcd.print(distance);

  lcd.print (" cm  ");

  lcd.setCursor ( 0, 1 );  

  lcd.print("Inhoud : ");

  lcd.setCursor ( 8, 1 ); 

  lcd.print (inhoud);

  lcd.setCursor ( 13, 1 ); 

  lcd.print ("L");



//Nokia display

  display.clearDisplay();

  display.setTextSize(1);

 // display.setTextColor(WHITE, BLACK); // 'inverted' text

  display.setCursor(0,0);

  display.print("Temp  = ");

  display.print(t);

    display.setCursor(0,10);

    display.print("Vocht = ");

   display.println(h);


  display.setTextColor(BLACK);

  display.setCursor(0,22);

 display.print(distance);

   display.print(" cm");


 display.setCursor(0,35);

display.print("Inh ");

 display.setCursor(20,30);

   display.setTextSize(2);

 display.print(inhoud);

 display.print("L");

  display.display();






    

  

}


void setup()

{

  Serial.begin(115200); // See the connection status in Serial Monitor


  // Define inputs and outputs

  

  pinMode(trigPin, OUTPUT);

  pinMode(echoPin, INPUT);


//*Just some text for testing the display

  lcd.begin(16,2);               // initialize the lcd  

  lcd.home ();                   // go home

  lcd.setCursor ( 0, 0 );        // go to the next line

  lcd.print("Tank inhoud ");  

  lcd.setCursor ( 0, 1 );        // go to the next line

  lcd.print (" Ultra sonic    ");

  delay(2000);

  lcd.clear();

//



  

  Blynk.begin(auth, ssid, pass);


  dht.begin();


  // Setup a function to be called every second

  timer.setInterval(1000L, sendSensor);




  display.begin();

  // init done


  // you can change the contrast around to adapt the display

  // for the best viewing!

  display.setContrast(60);


  display.display(); // show splashscreen

  delay(500);

  display.clearDisplay();   // clears the screen and buffer



  display.clearDisplay();

  display.setTextSize(2);

  display.setTextColor(WHITE, BLACK); // 'inverted' text

  display.setCursor(0,5);

  display.println(" Spike ");

  display.setTextSize(1);

    display.setTextSize(1);

  display.setTextColor(BLACK);

  display.setCursor(10,25);

 display.println("Arduino");

 display.setCursor(30,35);

 display.println("projects");

  display.display();


delay(500);

  

}


void loop()

{

  Blynk.run(); // Initiates Blynk

  timer.run(); // Initiates SimpleTimer

  

}

zondag 27 september 2020

De code voor data logger

 /*

Pin Digital 2 -> Pin CE - RST modulo RTC

Pin Digital 3 -> Pin I/O - DAT modulo RTC

Pin Digital 4 -> Pin CLCK - CLK modulo RTC

Pin Analogic A4 -> Pin SDA display

Pin Analogic A5 -> Pin SCL display


*/


#include <DS1302.h> // real time module

#include <Wire.h> //i2c

#include <LiquidCrystal_I2C.h> //lcd display

#include <SPI.h> // voor sd kaart

#include <SD.h> // voor sd kaart


#include "DHT.h" // temp sensor

#define DHTPIN 9 // aansluiting voor temp sensor

#define DHTTYPE DHT22 // temp sensor

DHT dht(DHTPIN, DHTTYPE); // Temp vocht sensor bepalen


int CS_PIN = 10; // cs pin van sd kaart, enige aansluiting die veranderd kan worden


int elkeseconde = 5; // ingangen voor selectie van data logging

int elkeminuut = 6;

int elkuur = 7;


//merker definieren

int merkerelkeseconde = 0;

int merkerelkeminuut = 0;

int merkerelkuur = 0;


const int chipSelect = 4; //aansturing sd kaart


// aansluitingen rtc

DS1302 rtc(2, 3, 4); // io voor RTC module


// adres van display

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);


//analoge spannings ingang 1

const int voltageSensorPin = A3; // sensor pin

float vIn; // measured voltage (3.3V = max. 16.5V, 5V = max 25V)

float vOut;

float voltageSensorVal; // value on pin A3 (0 - 1023)

const float factor = 5.00; // reduction factor of the Voltage Sensor shield

const float vCC = 4.67; // Arduino input voltage (measurable by voltmeter)


//ingang 2

const int voltageSensorPin2 = A2; // sensor pin

float vIn2; // measured voltage (3.3V = max. 16.5V, 5V = max 25V)

float vOut2;

float voltageSensorVal2; // value on pin A2 (0 - 1023)

const float factor2 = 5.000; // reduction factor of the Voltage Sensor shield

const float vCC2 = 4.67; // Arduino input voltage (measurable by voltmeter)


Time t; // real time klok definieren in t


void setup()

{

rtc.halt(false);

rtc.writeProtect(false);


Serial.begin(9600);


// indien klok moet ingesteld worden onderste lijnen juist instellen

// rtc.setDOW(FRIDAY); // Set Day-of-Week to FRIDAY

// rtc.setTime(12, 0, 0); // Set the time to 12:00:00 (24hr format)

// rtc.setDate(6, 8, 2010); // Set the date to August 6th, 2010


//Pin definities

pinMode(CS_PIN, OUTPUT);

pinMode(elkeseconde, INPUT);

pinMode (elkeminuut, INPUT);

pinMode (elkuur, INPUT);


// while (!Serial) {

// ; // wait for serial port to connect. Needed for native USB port only

// }

Serial.print("Initializing SD card...");


// see if the card is present and can be initialized:

if (!SD.begin(chipSelect)) {

Serial.println("Card failed, or not present");


lcd.begin(16, 2); // initialize the lcd

lcd.home (); // go home

lcd.print("Geen SD kaart ");

delay(1000);


// don't do anything more:

while (1);

}

Serial.println("card initialized.");


lcd.begin(16, 2); // initialize the lcd

lcd.clear();

// lcd.home (); // go home

// lcd.setCursor ( 0, 0 ); // go to the next line

lcd.print("SD kaart ");

// lcd.setCursor ( 0, 1 ); // go to the next line

lcd.print("herkend ");

delay(1000);



lcd.begin(16, 2); // initialize the lcd

// lcd.home (); // go home

lcd.setCursor ( 0, 0 ); // go to the next line

lcd.print("Data logger");

lcd.setCursor ( 0, 1 ); // go to the next line

lcd.print (" C2020 Spike ");

delay(1000);

lcd.clear();


dht.begin(); // initialize the sensor

}


void loop()

{

// read humidity

float humi = dht.readHumidity(); // read temperature as Celsius

float tempC = dht.readTemperature(); //float tempF = dht.readTemperature(true);


// check if any reads failed

if (isnan(humi) || isnan(tempC) ) {

Serial.println("Geen data van Temp sensor");

} else {

// Serial.print("Humidity: ");

Serial.print(humi);

Serial.print("%");

Serial.print(" , ");

// Serial.print("Temperature: ");

Serial.print(tempC);

Serial.println("�C ");

}


// Get data from the DS1302

t = rtc.getTime();

// Serial.print(rtc.getDOWStr()); // Dag

//Serial.print(" ");

Serial.print(rtc.getDateStr()); //Datum

Serial.print(" -- ");

Serial.println(rtc.getTimeStr()); //tijd


//Serial.println(t.hour, DEC);

//Serial.println(t.min, DEC);

//Serial.print(t.sec, DEC);


merkerelkeseconde = digitalRead (elkeseconde);

merkerelkeminuut = digitalRead (elkeminuut);

merkerelkuur = digitalRead (elkuur);


//ingang 1

voltageSensorVal = analogRead(voltageSensorPin); // read the current sensor value (0 - 1023)

vOut = (voltageSensorVal / 1024) * vCC; // convert the value to the real voltage on the analog pin

vIn = vOut * factor; // convert the voltage on the source by multiplying with the factor


Serial.print(" U1 = ");

Serial.print(vIn);

// Serial.print("V");


//ingang2

voltageSensorVal2 = analogRead(voltageSensorPin2); // read the current sensor value (0 - 1023)

vOut2 = (voltageSensorVal2 / 1024) * vCC2; // convert the value to the real voltage on the analog pin

vIn2 = vOut2 * factor2; // convert the voltage on the source by multiplying with the factor


Serial.print(" U2 = ");

Serial.println(vIn2);

// Serial.println("V");


lcd.setCursor(0, 0);


lcd.print(humi);

lcd.print(" % ");

lcd.print(tempC);

lcd.print("C ");


lcd.setCursor(0, 1);

lcd.print("V1=");

lcd.print(vIn);

lcd.println(" V");


lcd.setCursor(8, 1);

lcd.print("V2=");

lcd.print(vIn2);

lcd.println(" V");






if (merkerelkeseconde == HIGH){

Serial.println("Data logging elke seconde actief");

lcd.setCursor ( 15, 0 ); // go to the next line

lcd.print("S");

}


if (merkerelkeminuut == HIGH){

Serial.println("Data logging elke minuut actief");

lcd.setCursor ( 15, 0 );

lcd.print("M");

}


if (merkerelkuur == HIGH){

Serial.println("Data logging elk uur actief");

lcd.setCursor ( 15, 0); // go to the next line

lcd.print("H");

}


delay (800);



//logging elke seconde

if (merkerelkeseconde == HIGH) {

dataopslaan(); // Data routine om data op sd kaart op te slaan oproepen

}


//logging elke minuut

if ((merkerelkeminuut == HIGH) and (t.sec==0)) {

dataopslaan(); // Data routine om data op sd kaart op te slaan oproepen

}


//logging elk uur

if ((merkerelkeminuut == HIGH) and (t.min==0)) {

dataopslaan(); // Data routine om data op sd kaart op te slaan oproepen

}


}


void dataopslaan() {


//sd kaart

// 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.print(rtc.getDateStr());

dataFile.print(", "); // comma's om cellen later te delen in excel

// dataFile.print(rtc.getDOWStr());

// dataFile.print(", ");

dataFile.print(rtc.getTimeStr());

dataFile.print(", ");

dataFile.print(",ingang 1 =, "); //analoge ingangen

dataFile.print(vIn);

dataFile.print(", ");

dataFile.print(",ingang 2 =, ");

dataFile.print(vIn2);

dataFile.println(", ");



// read humidity

float humi = dht.readHumidity();

float tempC = dht.readTemperature();


dataFile.print(humi);

dataFile.print(",%,");

dataFile.print(tempC);

dataFile.print(",�C,");

dataFile.close();

}


lcd.setCursor(0, 0);

lcd.println("Data Logging ");





/*DISPLAY

float humi = dht.readHumidity();

// read temperature as Celsius

float tempC = dht.readTemperature();

lcd.setCursor(0, 0);


lcd.print(humi);

lcd.print("% ");

lcd.print(tempC);

lcd.print("C");


lcd.setCursor(0, 1);

lcd.print("V1=");

lcd.print(vIn);

lcd.println(" V");


lcd.setCursor(8, 1);

lcd.print("V2=");

lcd.print(vIn2);

lcd.println(" V");

*/

delay (200);

}

Data logger Temp en vocht en 2 analoge spannings ingangen van 0 - 25 v met RTC

 

Data logger Temp en vocht en 2 analoge spannings ingangen van 0 - 25 v







Data logger components
DHT22 sensor voor temp en vocht
2 maal spanningsdeler 0-25v
RTC 1302 clock module
LCD display
SD card module



pzem module op Wemos D1 ESP easy

pzem module voorzien van R 1K tussen rx en 5v RX van pzem op D8 TX van pzem op D7 Wemos Config esp easy RX: GPIO-13 (D7) TX: GPIO-15 (D8) ht...