Module 4: Tying It All Together

In Module 4, we tie together everything we’ve learned so far into a functional datalogger application. We’ll be implementing the temperature and humidity sensor, realtime clock, analog digital converter, SD cards, PIR motion sensor, and command line interface to implement a test version of our datalogger. We’ll then test it for functionality and check that we have things in the desired format.

In the second part of this module, we learn that everything fails and why it’s important to prepare for this. We’ll add additional safety checks to prevent what we can, diagnostic logs for documenting errors after the fact, and error codes which will be important for both fieldwork and forensic studies when a device fails in the field.

This module will be code heavy since we’re not introducing any new concepts, but integrating a lot of things together.

Click here for video slides, terminology, downloads and additional references


4.0  Tying It All Together – Lab 1

In this video we cover:

  • a recap on the basic function blocks
  • good programming practises
  • our application’s block diagram that shows the sequence of each function

In the Lab, we’ll code a test application that integrates all the basic function blocks we’ve created in Module 3. Our application will take a temperature reading and log it to a file on the SD card when we press the pushbutton, trigger the motion sensor, or set an alarm. We’ll also read and delete files from the SD card.

4.0 – Tying It All Together (PDF)



4.1 Safety Checks and Diagnostics – Lab 2

In this video we cover:

  • checking for the following errors / malfunctions:
    • sd card hasn’t initialised
    • file can’t be opened
    • battery is low
    • sensor is taking a proper reading
  • Diagnostic (error) indicators:
    • Visual – blinking an LED different times depending on the error
    • Display – printing the error to the serial monitor
    • Logging – logging the error to a file on the SD card

In the Lab, we’ll add code that checks for the different errors listed above, blinks an LED a certain number of times depending on the error, prints the error to the serial monitor, and logs the error to a file.

4.1 – Safety Checks and Diagnostics (PDF)



Supporting Materials

Terminology Sheet

Module 4 Terminology Cheatsheet (PDF)


Video Slides

4.0 – Tying It All Together (PDF)

4.1 – Safety Checks and Diagnostics (PDF)


Conversations & Troubleshooting

Module 4 Discussion (forum thread)


Copy link