Temperature Data Logger

This is a more complex sketch which logs the temperature values to the EEPROM. This is a special memory space on the Circuit Playground that remains even if power is lost. Total storage space allows for a little over 500 readings to be stored (511 if you must know). The stored values can be sent over the serial port in one of several formats.

There are two settings you can change to configure the temperature logger. They are found on the following lines of code near the top of the sketch.

// OK to change these
#define LOG_WRAP    false // Set log wrapping
#define LOG_RATE    1000  // Set log rate in milliseconds

Use these to change whether the log buffer wraps when full and how often to measure the temperature as follows:

  • LOG_WRAP: If true, the log buffer will wrap when full and start overwriting older data. If false, logging will stop when the log buffer is full.
  • LOG_RATE: Sets how often the temperature is measured and saved to the log. The value is in milliseconds.

With this sketch loaded and running on the Circuit Playground, you choose between one of two modes using the slide switch.

  • LOGGING MODE (Slide switch = +): Use this mode to start/stop/clear temperature log.
  • READOUT MODE (Slide switch = -): Use this mode to output current log contents to serial port.

Logging Mode

With the slide switch in the left (+) position, the Circuit Playground is in logging mode. The NeoPixels on the left half will be lit green to indicate this mode. To control logging, use the two push buttons as follows:

  • Left Button: Press to start/stop logging. The #2 NeoPixel, next to the left button, will change to show stopped (red) or running (green).
  • Right Button + Left Button: Press both together to clear the log buffer and reset logging. All NeoPixels will temporarily light red.

Logging Mode Indicator Lights

The NeoPixels on the left indicate logging mode and whether the log is running or not. When the log is running, the red LED next to the USB connector will blink. The NeoPixels on the right indicate data buffer status.

Log is running. Buffer is 4/5 full.

  • #2 NeoPixel is green.
  • Red LED is blinking.
  • 4 of 5 white lights on right are lit indicating log space used.

Log is stopped. Buffer is full. (wrap off)

  • #2 NeoPixel is red.
  • Red LED is not blinking.
  • All lights on right red, indicating full buffer.

Log is running. Buffer is full. (wrap on)

  • #2 NeoPixel is green.
  • Red LED is blinking.
  • All lights on right red, indicating full buffer.
  • White light indicates current wrap position.

Readout Mode

With the slide switch in the right (-) position, the Circuit Playground is in readout mode. The NeoPixels on the left half will be lit light blue to indicate this mode. To control readout, use the two push buttons as follows:

  • Right Button: choose output format (see figure below).
  • Left Button: output to serial port using current output format.

Readout Mode Indicator Lights

The NeoPixels on the left indicate readout mode. The NeoPixels on the right indicate the currently selected output format.

The first two format options are meant to be used with the Serial Plotter. The last three format options are meant to be used with the Serial Monitor.

Last updated on 2016-11-01 at 12.44.15 PM Published on 2016-11-01 at 01.39.41 PM