Difference: RealTimeClockAndDataLogging (6 vs. 7)

Revision 72020-05-26 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="Exercises"

Exercise 9: RTC and data logging

Introduction

Line: 56 to 56
 Write a module with 2 functions synchronizing the clocks:
  • synchronize the ds1307 clock with the ESP32RTC time
  • synchronize the ESP32RTC with the ds3017 time
Added:
>
>

Exercise 5: Mount the SD card

Write a script to mount the SD card on the RTC and data logger module on "/sd". Create a directory /sd/data and check that is has been created as expected.

Exercise 6: Data logging

Write a script that

  • sets up the ESP32 RTC using ntptime
  • reads temperature and humidity values from the SHT30 every 5 s
  • write the time stamp and temperature and humidity values for the file /sd/data/sht30Data.txt
  • transfer the data to the PC and analyze them
The binary of MicroPython contains an ftp server named uftpd. You can start it by simply importing the module:

import uftpd

After that you can transfer the file with ftp to your PC

Concerning the time stamp there is a difference between MicroPython and CPython: MicroPython starts counting at 2000-01-01 while CPython uses Unix epoch, which starts at 1970-01-01.

timeStampCPython = timeStampMicroPython + time.UNIX_TIME which is the constant 946681200

MPY epoch is 2000-01-01 instead of unix epoch, which is 1970-01-01.

  -- Uli Raich - 2020-05-06
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback