Society of Robots
Search and Index
 Parts List
 Robot Forum
 Member Pages
 Axon MCU
 Robot Books

 How To Build
  A Robot




 Robot Journals
 Robot Theory



    Data Logging
    Data logging is the method of recording sensor measurements over a period of time. Typically in robotics you will not need a datalogger. But there are times when you may need to analyze a complex situation, process large amounts of data, diagnose an error, or perhaps need an automated way to run an experiment. For example, you can use a data logger to measure force and torque sensors, perform current or power use measurements, or just record data for future analysis.

    Parts of a Data Logger
    Typically, data loggers are very simple devices that contain just three basic parts:

      1) A sensor (or sensors) measures an event. Anything can be measured. Humidity, temperature, light intensity, voltages, pressure, fault occurrences, etc.

      2) A microcontroller then stores this information, usually placing a time-stamp next to each data set. For example, if you have a data logger that measures the temperature in your room over a period of a day, it will record both the temperature and the time that temperature was detected. The information stored on the microcontroller will be sent to a PC using a UART for user analysis.

      3) And lastly the data logger will have some sort of power supply, typically a battery that will last at least the duration of the measurements.

    For datalogging you will need a terminal program. My favorite is HyperTerminal, of which came free on Windows up to XP (but not later versions). There are many others such as TeraTerm, Roboterm, etc. Just google around.

    HyperTerminal is a program that comes with Windows and works great for data logging. Back in the day it was used for things such as text-based webpage browsing and/or uploading pirated files to your friends over the then super fast 56k modems.

    You can download Hyperterminal here:

    HyperTerminal Data Logger

    I will now show you how to set HyperTerminal so that you may record data outputted by a microcontroller through rs232 serial.

    First, you need your microcontroller to handle serial data communications. If it has a serial or USB cable attached to it already, then you are set to continue.

    Next, you need a program that reads and prints out sensor data to serial as in this example:

    printf("%u, %u, %lu\r\n", analog(PIN_A0), analog(PIN_A1), get_timer1());

    If you are interested, feel free to read more with the printf() function tutorial and the microcontroller UART tutorial .

    The time stamp isnt always necessary, and you can always add or remove ADC (analog to digital) inputs. Note that the get_timer1() command must be called right before, during, or directly after the sensor readings - or the time recorded will be meaningless. Also, use commas to separate output data values as already shown. I will explain the importance of this later.

    Steps to Logging With HyperTerminal
    Now open up HyperTerminal
    Start => Programs => Accessories => Communications => HyperTerminal
    You should see this window:

    HyperTerminal Data Logger

    Type in a desired name and push OK. The icon doesn't matter.

    HyperTerminal Data Logger

    Now select a COM port, while ignoring the other options. Push OK.

    HyperTerminal Data Logger

    In the COM properties, select the options you want/need depending on the microcontroller and serial communications setup you have. Push OK. Chances are if you just change the Bits per second to 115200 and leave the other options as default it should work fine. To make sure, check your C code header for a line that looks something like this:

    #use rs232(baud=115200, parity=N, bits=8, xmit=PIN_C6, rcv=PIN_C7)

    Now in the menu,
    select Transfer => Capture Text...
    create a text file, and select it in the Capture Text window
    click Start

    Now connect your microcontroller to your computer (by serial/usb) and then turn the microcontroller on.

    Next you want to tell HyperTerminal to Call. Select the image of the phone:

    HyperTerminal Data Logger

    Finally, tell your microcontroller to start logging data, and you will see the data appear on screen. Even if you do not plan to save your data, this can be a great feedback tool when testing your robot.

    HyperTerminal Ouput Data

    When logging is completed, click the disconnect button:

    HyperTerminal Data Logger

    Then select Transfer => Capture Text => Stop

    You should now have a .txt file saved with all your data. But you're not done yet!

    Rename the file to a .csv, or Comma Separated Value (CSV) file format. What this does is allows you to open the file in Excel with each value seperated by columns and rows, making data processing much easier. Now you may interpret the sensor data any way you like.

    Additional Info On Data Logging
    There are many ways to log data, depending on the situation. There is event based data logging, meaning that it only records data when a specific single-instant event occurs. This event could be a significant change in sensor output or a passing of a user defined threshold. The advantage of this method is that it significantly reduces data that needs to be stored and analyzed.

    The other method is selective logging, which means logging will occur over just a set period of time (usually a short period of time). If for example you want to analyze an event, your data logger would start logging at the beginning of the event and stop at the end. The advantage of this method is that you can get high resolution data without wasting memory.

    Can I Buy a Data Logger for My PC?
    Of course. They are called DAQ, or Data Acquisition devices, and have a lot of neat built in software and hardware to make things easier for you. But they can get costly, ranging in the $100's.

Get Your Ad Here

Has this site helped you with your robot? Give us credit - link back, and help others in the forums!
Society of Robots copyright 2005-2014
forum SMF post simple machines