Electronic Time Capsule

From Alnwlsn - Projects Repository
Jump to navigation Jump to search

This is a board with a bme280 pressure, humidity and temperature sensor, a ds3232m realtime clock, and 4MB of flash memory. The clock wakes up an atmega328p, it takes readings and stores them, and then goes back to sleep. A low dropout, low quiescent current voltage regulator provides 3.3v power to the board from an external battery.

I built this to be buried inside a time capsule (though it has plenty of other uses), so it has to be able to survive freezing temperatures, and should last at least 5 years without maintenance. A quick calculation of current draw on my prototype says that it should be able to run for about 15 years (!) on AA batteries, and there is plenty of room in the flash memory for hourly measurements (15ish years worth).

Operating Instructions

The board contains 4 dip switches, which pretty much work independently, and one button. The switches should be labeled 1-4, with 1 being closest to the center of the board. The off position of the switch has the handle toward the 3 indicator LEDs, and the on position is towards the button.

The functions of the switches are:

  • Switch 1 (on) - Enters the clock setting procedure. The clock is set using only the single button, pressed a number of times to set the date and time. You can only set the clock when the board is first connected to power or reset.
  • Switch 2 (on) - Erases the flash chip. The flash must be empty to write new data from the beginning. An extra button press is needed to confirm you really want to do this. If the clock set switch is also on, then you will set the clock first, then erase the flash. You can only erase the flash when the board is first connected to power or reset. This helps avoid doing it accidentally.
  • Switch 3 (on) - Dumps the flash. Over serial, the board will output a tab-formatted table of the measurements that have been recorded. The dump will continue until either the entire chip has been read (including blank areas), or Switch 3 has been turned off. To start a dump, turn switch 3 on and then either wait for the RTC to wake up the system, or wake it up yourself with a single press of the button.
  • Switch 4 (on) - Blinks a green light every time the 328 powers up. Turn off to save power

The LED functions are, in general:

  • Green - Status - Blinks when something happens / has happened
  • Red - Working - Turns on when user input is acknowledged
  • Yellow - Waiting for user input

Example Output

This is what it looks like when running / dumping measurements in the serial terminal.

TIME CAPSULE LONG DURATION ENVIROMENTAL LOGGER - Alan J. WIlson 2018
Current time: 00/01/01 00:51:57
Flash capacity: 4194304 bytes, 131072 frames
Frame size: 32
Next ram index: 13159

Current time: 00/01/01 00:52:02
Cycle: 0
Index: 13159
Battery ADC: 0
DS3231 Temperature (C): 25.25
BME280 Temperature (C): 25.29
BME280 Pressure   (Pa): 99076.30
BME280 Humidity    (%): 69.27
Write OK

FLASH MEMORY DATA DUMP FOLLOWS
Index	Cycle	Year	Month	Day	Hour	Minute	Second	DS3231 Temperature (C)	Temperature (C)	Pressure (Pa)	Humidity (%)	Battery (10-bit ADC)
0	0	18	8	26	18	13	12	28.00	25.93	98721.45	56.25	0	
1	1	18	8	26	18	14	10	27.25	26.69	98700.82	51.92	0	
2	2	18	8	26	18	15	10	26.25	26.62	98697.11	51.89	0	
3	3	18	8	26	18	16	10	26.00	26.08	98680.39	51.73	0	
4	4	18	8	26	18	17	10	25.50	25.72	98682.92	52.41	0	
5	5	18	8	26	18	18	10	25.25	25.43	98677.75	52.36	0	
6	6	18	8	26	18	19	10	25.00	25.13	98676.18	52.90	0