Arduino Datalogger With RTC, Nokia LCD and Encoder

Introduction: Arduino Datalogger With RTC, Nokia LCD and Encoder


  • Arduino Nano or Arduino Pro Mini
  • Nokia 5110 84x48 LCD
  • DHT11 temperature/humidity sensor
  • DS1307 or DS3231 RTC module with built-in AT24C32 EEPROM
  • Cheap encoder with 3 debouncing capacitors


  • GUI based on Nokia LCD and encoder
  • temperature, humidity, date and time can be stored every 1 to 120 minutes
  • each record is compressed to 39 bitfield only so 32kbit flash (4KB) can fit 819 records
  • optional AT24C256 chip can store even 6553 records
  • deep sleep used to save battery, ATMEGA is woken up by interrupts mainly
  • DHT11 is powered only during measurements
  • powered by single 18650 or other lithium cell
  • a few display "faces"
  • 6 fonts
  • battery level meter
  • data review and graphs
  • min/max with date/time
  • all recorded data dump via serial port in CSV format
  • LCD back light
  • own fast and low resource N5110 library used
  • own low level DHT11 data reading
  • own DS1307, DS3231 and AT24C32 I2C EEPROM handling code
  • the code uses almost all 32KB Arduino flash
  • all internal registers can be stored in external EEPROM or DS1307 internal RAM

Data compression

Following values are recorded:

  • time (hr,min)
  • date (d,m,y)
  • temperature
  • humidity

Above data is compressed to 39-bit bitfield:

  • hr 0..23 -> 5b
  • min 0..59 -> 6b
  • d 1..31 -> 5b
  • m 1..12 -> 4b
  • y 2018..2021 -> 2b
  • temp -40.0..64.0 -> 1024values = 10b
  • hum 0..100 -> 7b
  • total 39 bits

Only 5 bytes are used for 1 record:

bits   76543210    
byte0 hhhhhmmm byte1 mmmddddd byte2 mmmmyytt byte3 tttttttt byte4 hhhhhhh0

Step 1: Watch Videos

If you are interested in project features and development watch above videos

Step 2: Connections

Nokia 5110:

  1. RST to D9
  2. CS/CE to D10
  3. DC to D8
  4. MOSI/DIN to D11
  5. SCK/CLK to D13
  6. VCC to Arduino VCC
  7. LIGHT to D6
  8. GND to GND


  1. VCC to VCC
  2. DATA to D14
  3. NC
  4. GND to GND

RTC DS1307/DS3231 and AT24C32 EEPROM:

  • Arduino I2C (A4/A5)


  • PinA to D2
  • PinB to D4
  • Button to D3

Step 3: RTC Modules "LowPower" Modifications (optional)

In DS1307 cut 2 traces, remove R6 and make solder joint

In DS3231 cut 2 traces

Step 4: Firmware

Arduino sketch:

N5110 library:

Configuration options:

#define USE_DS3231 -> to use DS3231 instead of DS1307

#define REG_IN_RTCRAM -> registers are stored in RTC RAM (only for DS1307)

Sensors Contest

Participated in the
Sensors Contest

Be the First to Share


    • Battery Powered Contest

      Battery Powered Contest
    • Plywood Challenge

      Plywood Challenge
    • Plastic Contest

      Plastic Contest

    9 Discussions


    Question 1 year ago on Step 4

    Hola. El proyecto es muy bueno. ¡¡Te felicito!!
    Estoy empezando en el mundo arduino.
    Consulta, recibo este error: 'escribir' no se declaró en este ámbito
    En esta línea de programa: escriba RTCMem (REG_LOGINT, logInterval);
    Porque puede ser?
    ¡¡Muchas gracias!!


    1 year ago

    I am impressed by this program.
    Possibility to change the screen: st7920 instead.
    thanks in advance.


    Reply 1 year ago

    Unfortunately ST7920 draws more current and is not good candidate for low-power projects. And because of frame buffer memory organization it is not easy to port current software to this display.


    1 year ago

    I followed your project and everything is working fine. I am thinking that, by using the DS3231, it could be possible to use alarms (by using pin D2), settable with rotary encoder, and most importantly an external EEPROM with increased size. I know how to set alarms by using DS3231, but how can be changed your code to achieve this? I am trying to understand your code, but I am a newbie


    Reply 1 year ago

    For more new functions you would need to remove some code and current functionality because almost all ATmega flash is used. Regarding external EEPROM you can simply add it to the circuit, make sure you use correct I2C address or change it if it conflicts with RTC EEPROM.

    Alex in NZ
    Alex in NZ

    1 year ago

    Nice use of resources. Thank you for sharing your work. Thank you also for writing that 5110 library. The one I was using was really resource hungry, so I'm looking forward to experimenting with yours :-)


    Reply 1 year ago

    Thanks. My library saves as much RAM as possible and renders everything directly in N5110 frame buffer. But if you need some pixel graphics it is still possible to use smaler frame and copy it to LCD like in my above project.


    1 year ago on Step 4

    In the DS3231 all I do is remove the 200 ohm resistor in the charging circuit. This will prevent charging a non rechargeable battery and avoid any danger.


    Reply 1 year ago

    I remove power LED too, to save some energy.