Data Logger


After many trials, finally I was able to complete this small project which had been in my mind for a long time.

A data logger that store information on SD card. Using PIC18F4550, and one SD card socket I was able finally to complete this project. One Analogue input was added to the board where any analogue sensor can be placed over there. (As of now I am using a temperature sensor (NTC).

The PIC program was made using MikroC. (This made programming PIC much simpler, and saved a lot of time with its gerat libraries)

Below the final circuit picture.

My plan now is to write a small application that would get the logged data, and based on scaling information entered to the software; correct values would be calculated and plotted.

Please let me know if you were trying to build a similar project, and I’ll help you as much as possible.


// MMC module connections
sbit Mmc_Chip_Select           at LATA5_bit;  // for writing to output pin always use latch (PIC18 family)
sbit Mmc_Chip_Select_Direction at TRISA5_bit;
// eof MMC module connections
long int temp_res;
const LINE_LEN = 16;         ///012345678901234
char file_contents[LINE_LEN] = "XX,XXXXXXXXXXXX";
int temp;
char           filename[] = "TempLogF.TXT";
int i;
unsigned short loop, loop2;

char txt[12];

void M_Create_New_File() {

  Mmc_Fat_Set_File_Date(2010, 4, 19, 9, 0, 0); // Set file date & time info
  Mmc_Fat_Assign(&filename, 0xA0);          // Find existing file or create a new one
  PORTD=0xFF;                 // To clear file and start with new data
  for(loop = 1; loop <= 9999; loop++) {


    file_contents[0] = loop / 10 + 48;
    file_contents[1] = loop % 10 + 48;
    temp_res = ADC_Read(2);
    LongIntToStrWithZeros(temp_res, txt);
    file_contents[3] = (temp_res / 1000) + 48;

    file_contents[i] = txt[i-4];

    Mmc_Fat_Write(file_contents, LINE_LEN-1);   // write data to the assigned file
    Mmc_Fat_Write("\r\n", 2);   // write data to the assigned file
   // Mmc_Fat_Write('\n', 1);   // write data to the assigned file


// Main. 

void main() {
  ADCON1 = 12;                  // Configure AN pins as digital
  CMCON  |= 7;                     // Turn off comparators

  // Initialize SPI1 module

   if (Mmc_Fat_Init() == 0)    // reinitialize spi at higher speed

  else {



Download Hex File (Finally!!)

5 thoughts on “Data Logger”

  1. Hola admin. I must tell you I’m impressed with your work and it has been of great help to me. I tried running the code but received several error messages like * undeclared Identifier* where the SPI is initialised and operator *is not applicable to this operand* (line 74 reinitialize spi at higher speed) wish you could help me out.
    I’m working on a similar project where multi sensors (4) are connected to ucontroller, data from sensors are stored in an SD card and later read on the pc through the serial port. please help me if you can

    my regards


  2. Our porn purlieus offers to elation in watching the brightest and most tantalizing porn videos of the a- porn studios. We are purport to satisfy mouldy our viewers most overpowering joyfulness that pattern choice and testament entrancement to any aficionado of porn with any preference. Here you can brains inoperative of evil’s road the video with mortifying plots that created not later than well-founded porn teams’ studios which are pleased as punch their users with its high-quality contented regularly. We comprise numerous variants of sprung porn in behalf of viewers with distinguishable preferences, there are videos from the most inventive teams such as: Digital Playground, Truth Kings, Mofos, Brazzers, Wicked. Each of these sections has a nationwide thousand of clips, so each visitant with extraordinary preferences obey be positively pleased as punch with them. Each Studio has its own shooting features, choices on conceive and the cast. Here, all users could scan an special high-quality video of these porn
    plat: and

  3. Ohh, ohh Mentirosa, no me importa que de amor te mueras x2.Gather your crew and seek out new life and new civilizations.For reasons that are still debated, Lewis decided to leave the Vapors at about 2 30 a.According to a report in Manchester Evening News, Jaime was jailed for two years and eight months in 2016 after being found guilty of arson.Todas tus canciones favoritas de Reik Ft Nicky Jam Ya Me Entere las encuentras en la mejor web para bajar musica NiX.

  4. Can I simply say what a relief to find somebody who genuinely knows what they’re discussing over the internet. You definitely understand how to bring an issue to light and make it important. More people ought to read this and understand this side of the story. It’s surprising you are not more popular since you definitely have the gift.

  5. Рћ Billboard 200, 210 000.Where do you live.Bad Moon Rising 7.MAJOR CIVIL WAR BATTLES FOUGHT IN TEXAS.No voy a llorar. Primary Handbook For Snare Drum Book CD – Learn the proper methods of playing the snare drum with this internationally acclaimed book.I hope most projects succeed as I have been investing full force in many of them, as well.Maluma Jajaja Carlos Vives Shakira Maluma Colombia.Als Zigeuner werden seit dem 15.Rock Roll Hall Of Fame.

Leave a Reply

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