Make a simple Data-Logger with Arduino UNO for your solar power plant

Published by MKDas on

Data Logger is a device that records data periodically with time and date which can be used in the analysis of the system. In this article, we’ll make a solar data logger. We will use Arduino UNO for this project. A memory card, Real-Time Clock (RTC) will be used too. Let’s make a Data-Logger with Arduino.

Disclaimer: Electricity is always dangerous. Skill required to work with electricity. Do work at your own risk. The author will not be responsible for any misuse or harmful act. This website contents are also copyright protected. Anything copied and directly posted on your website and claiming it as yours is prohibited and nonsensical. The author published all the articles as open source to help you to make your project and learning purpose only. Learn and make one for yourself. If need any help feel free to ask the author. The author will be helpful to you. Thanks.

What is Data-Logger?

A data logger is an electronic device that records data over time or in relation to location either with a built-in instrument or sensor or via external instruments and sensors. Increasingly, but not entirely, they are based on a digital processor.

A commercial data logger

Data-Logger can be different types based on data types. Different sizes, different operating systems. But they all do the same thing in basic. They record data over time. Sometimes, data is stored in local storage and sometimes, data is stored online. Here is an example of IoT based Data-Logger which logs data at an IoT server over the internet.

IoT based Data-logger [Click to check the device on their website]

Data-Logger basic block diagram:

For a basic data logger this block diagram is common which can be used for our own Data-Logger with Arduino too.

Basic Block Diagram of a Data-Logger.

About block diagram:

Most of the data-logger have this block diagram in common. There will be some inputs to sense the data. The inputs can be any type of data depending on the data logger use. These data are collected and processed in the system then stored in local storage and some data-logger sends or stores these data over the cloud or dedicated server. These types of data-logger are called IoT-based data-logger.

Here, in this project, we are going to make a local storage data logger.

Circuit Diagram:

Here is the circuit diagram of our Data-Logger with Arduino:

Arduino datalogger

Here in the circuit diagram, we used ACS712-30A current sensor to sense the current and resistors as the voltage sensor. Arduino UNO is working as our central system controller, ADCs are used to read the values and process inside. Then values are printed on the LCD display. With time reading from DS1307 RTC IC, data is being saved on MMC periodically. The total system runs on a battery and LM7805 based linear voltage regulator is used to proving a regulated 5V DC to MCU and other circuits.

About ACS712-30A:

ACS712 is a hall sensor-based current sensor. This sensor can be used in both AC and DC circuits to sense the current. The 1.2 mΩ internal conductor resistance makes it a low loss current sensor which is ideal in most cases.

ACS712-30A current sensor


#include <LiquidCrystal.h>
#include <Wire.h>
#include "RTClib.h"
#include <SD.h>
#include <SPI.h>
const int chipSelect = 4;
LiquidCrystal lcd(10, 9, 8, 7, 6, 5);
short display_mode = 0;
int i = 0;
double current = 0.0;
double voltage = 0.0;
double power = 0.0;
int minute1 = 0, minute2 = 0;
int second1 = 0, second2 = 0;
void setup()
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);//cr
  lcd.print(F("Solar Datalogger"));
  Serial.println(F("Solar Datalogger project"));
  //RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));//auto update from computer time, run this line only once.
  pinMode(chipSelect, OUTPUT);
  MMC_int(); // mark when simulating only
  Creat_file();// mark when simulating only; Unmark in real hardware
  display_mode = 0;

void loop()

  current = 0;
  for (i = 0; i < 20; i++)
    current += float((2490 - (analogRead(0) * 4.8828125)) / 66.00); //in mV range 
  current /= 20;
  current = abs(current);

  lcd.setCursor(0, 1);
  lcd.print(current, 3);

  voltage = 0;
  for (i = 0; i < 20; i++)
    voltage += float(analogRead(1) * 0.54555368); //in mV range
  voltage /= 20;
  voltage = abs(voltage);

  lcd.setCursor(0, 0);
  lcd.print(voltage, 3);

  power = float(voltage * current);
  lcd.setCursor(8, 1);
  lcd.print(power, 3);

  DateTime now =;
  lcd.setCursor(11, 0);
  if (display_mode == 0)
    lcd.print(now.hour(), DEC);
    lcd.print(now.minute(), DEC);
    //lcd.print(now.second(), DEC);
    lcd.print(, DEC);
    lcd.print(now.month(), DEC);
  second1 = now.second();
  if (second1 >= second2+2)
    if (display_mode == 1)display_mode = 0;
    else if (display_mode == 0)display_mode = 1;
    second2 = second1;
    File dataFile ="datalog.txt", FILE_WRITE);
    if (dataFile)
      Serial.println(F("Saving data on SD card"));
      DateTime now =;
      dataFile.print(",  ");

      dataFile.print("     ");
      dataFile.print("  ");
      dataFile.print("  ");
      dataFile.println("  ");      
      dataFile.close(); // close the file


void Creat_file()
  File dataFile ="datalog.txt", FILE_WRITE);
  if (dataFile)
    dataFile.println(" Data Logger for Soler energy started_");
    dataFile.println("Time >> Date  >>  Voltage(volts)  >>  Current(ampere) >>  Power(watt)  ");
    Serial.println("file found and ready to write");

void MMC_int()
  Serial.print(F("Initializing SD card..."));
  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect))
    Serial.println(F("Card failed, or not present"));
    // don't do anything more:
    while (1);
  Serial.println(F("card initialized."));


No special code is used in this project. All codes are very simple and arranged in the easiest way. When your PCB is ready to test, first of all, you need to set your clock. For that, you need to unmask this line:

RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));//auto update from computer time

Once your time is set, then mask the line again. Everything will be fine.


I made this project in real life and used it as a product which is being used since 2017 locally. Here is the PCB file of this project.

After making the project in hardware:

Data-logger in real life.

You can check this page for PCB design and PCB Software Help.

Test result:

I used this project as a product in a solar test field. Where it is used to log the voltage and current reading. But at that time, I did not keep any video of the project. But today, I can share the simulated result.

Proteus simulation result


In the end, I can say that as I made this project real so you can use it too in your project without any hesitation. It will work fine if you follow everything I said.

I hope this project was helpful to you. If you make one for yourself, it will be a great pleasure for me. Anywhere you need help, let me know. Please share this project and subscribe to my blog. Thank you.


I'm Mithun K. Das; B.Sc. in EEE from KUET, Bangladesh. Blog: "First, electronics was my passion, then it was my education, and finally, electronics is now my profession." I run my own electronics lab, M's Lab ( Where I work with the creation of new products from ideas to something in real life. Besides this is my personal blog where I write for hobbyists and newcomers in the electronics arena. I also have a YouTube channel where I publish other helpful videos, you can find the link inside the articles. I always try to keep it simple so that it becomes easy to understand. I hope these will help them to learn electronics and apply the knowledge in their real life.


Leave a Reply

Avatar placeholder

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