6.1 Introduction to Data Loggers


Until now, you have only taken environmental measurements at one point in time by pushing a button or communicating using the computer. Either way, you’ve had to be there to tell your microcontroller to take a measurement. But what if you wanted to take measurements at night while you were asleep? What if you wanted to collect data in a place that was farther away? What if you wanted to take one measurement every minute? It would be impractical to physically be present every time you wanted to collect data. In these situations it is important to have a sensor that can log data for you at pre-determined times.

Materials Needed:

… and one or more of these environmental sensors:

Introduction to Loggers:

Conditions in the environment change over time. Over the course of the day, it gets sunnier and warmer during the day and colder and darker at night. Over the course of a year, it gets colder and darker in the winter and warmer and sunnier in the summer.  But we can only observe these changes if we collect data over longer periods of time. It is easier to do this, when your microcontroller automatically collects data at set time intervals (for example every 30 min) and saves it for you to view later. Then we can graph the data to better understand what is going on in the environment.

Figure 6.1

Knowing the time you collected a measurement can make can you help better understanding your environment. For example, comparing temperature readings taken at the same time from a sensor above the soil surface to another beneath it can tell us how the environment changes over very short distances.  Comparing two different quantities, such as solar intensity and temperature, can help us understand weather patterns. Readings at different times can help us understand rates of change, such as cooling or warming of soil or air exposed to sun vs. shade, or across seasons. Knowing the time a measurement was taken is also key for comparing to other data, such as online weather or tide stations. 

Most microcontrollers keep track of time using a Real Time Clock, or RTC for short. While there is a clock on the microcontroller itself (onboard RTC), it turns off when the microcontroller isn’t powered and therefore stops keeping track of time. To get around this problem, you will use an external RTC that has its own battery so it can keep the correct time even when the microcontroller is off. This will allow you to make sure your logger is collecting accurate timestamps when you leave it out collecting data!