I finished my long-term test of the minimal version of the data logger project after a few days. To simulate the situation for the actual usage, I setup the data logger to record data in 1 hour intervals.
The test answered these questions:
- Does the data logger function properly over several days?
- How much battery does the data logger use?
I could not answer the first question until I stopped the data logger and read all values over the TTL cable. I found this is a little bit tricky, because the microcontroller did reset as soon I attached the TTL cable. This automatically restarted the logging and logged some additional value, visible in the chart.
The battery life is hard to measure. I used a multimeter and measured the voltage on the battery. At the end, the voltage was still over 4.0V, which means the battery pack is almost full charged.
I would need to connect the battery to an analog input of the microcontroller, using a MOSFET as a switch. So I could measure the battery voltage over time.
Importing the Data
Working on Mac OS X, I am using the
screen command as serial console. If you add the parameter
-L to the command, the whole output is automatically logged in a file.
LR: ~lr$ screen -L /dev/cu.usbserial-FTHXXXXX 57600
I opened the file using BBEdit and removed any lines before and after the actual data. After the edit I saved this edited file as “data.csv”.
To get a little bit more options for the diagram, I used Microsoft Excel. After the import of the data, I formatted the columns, added a title and created a X/Y chart from it. After fine tuning all the titles, formats and lines I created a nice chart and could export it as PNG file.
You can see the chart as feature image of this article, or click on the thumbnail on the right side to see the full resolution version.
If you look at the chart you can clearly see the problem of the minimal version. It logs just integer values without fractions which is clearly not enough for the temperature. The sensor is capable of a higher precision, but not accuracy. But the higher precision will make trends better visible in the data.
What is Coming Next?
Next I will implement the simple version of the data logger. This will add additional 32KB of storage to the device, using the Non-Volatile FRAM Breakout from Adafruit. With this “vast” amount of storage, I can use a 14 bytes record which stores the date and time as unix time-stamp, using a float for humidity and temperature and a real CRC-16.
Date/Time 4b Humidity 4b Temperature 4b crc 2b --------------- total 14b
This will allow 2340 records in the FRAM, which sums up to 97 days recording time at one hour intervals.