Close
0%
0%

ESP32 Small Alarm Clock

Small alarm clock with ESP32 module, 0.96" OLED panel and small speaker.

Similar projects worth following
This is a small alarm clock which wakes you up every morning.
Clock is synchronized with NTP protocol over WiFi.
To make this as small as I can, I omitted enclosure and made the PCBs into a box.
Boards are connected with pin headers/sockets.

Power source is a 400mAh LiPo battery. Battery can be charged via USB.
To save energy, device is usually in deep sleep state and display is off.

This can also tell time with button push.

This is successive project of http://ktmizugaki.so.land.to/ele/wifi_voice_clock.htm .
While that clock is working perfectly for two years, I broke LCD and decided to upgrade project instead of replacing broken LCD.

The challenge for me is using OLED. I also tried to fix some of broblems and reduced width slightly.

featrues

  • Wakeup Alarm at configured time
  • Synchronize clock with NTP protocol over WiFi
  • Say time with button push
  • Show clock with button push
  • Support LiPo battery and can charge battery
  • Deep sleep to reduce power consumption
  • Check battery to prevent complete discharge
  • Web UI for configuring clock

structure

Clock consists of 7 boards.

  1. MCU boards
    This board is center of clock, enclosed by other six boards.
    ESP32 module, 3.3V regulator, 32768Hz crystal.
  2. PSU board
    This board is bottom panel and has power related components.
    PH connector for battery, mini B USB connector, charger IC and charge indicator LEDs
  3. IO board
    This board is top panel with switches and a speaker.
    Also it has resistors to measure input voltage.
  4. display board
    This board is front panel with OLED dislay.
    I added two LEDs to just fill space.
  5. two side panels
    These boards connects PSU board and MCU board (both electrically and physically)
  6. back panel
    Just a panel, no circuit on this board but has holes so that USART and reset circuit can be connected to MCU board.

Portable Network Graphics (PNG) - 95.23 kB - 06/14/2021 at 13:00

Preview
Download

Adobe Portable Document Format - 172.54 kB - 06/14/2021 at 12:57

Preview
Download

  • 1 × ESP32-SOLO-1
  • 1 × 0.96" OLED panel
  • 1 × 400mAh LiPo battery

  • Battery voltage measurement

    teru05/02/2022 at 11:22 0 comments

    Changed battery voltage measurement to measure input of voltage regulator battery voltage measurement using circuit from https://jeelabs.org/2013/05/17/zero-powe-battery-measurement/. Also display battery level on the clock screen.

    Previous version measured voltage output from GPIO pin so value is capped to 3.3V, which was enough to see if battery is too low but not so nice for displaying battery level.

    Fortunately it wasn't hard to modify - replace resistor between Vout and Vmes with BSS138, connect drain of BSS138 to new resistor, and connect the other side of the new resistor to vcc.

    kicad image of the modification

    Unfortunately, measurement didn't work. It shows greater value than correct voltage. Modification was worked fine when tested with develeopment board. It turned out that ADC of the ESP32 of the clock seems to be broken. The adc pin reads as almost 0 as expected when connected to GND, but the adc pin reads as 4095 (maximum of 12bit) when it is left open.

  • Firmware update

    teru12/26/2021 at 08:42 0 comments

    Added firmware update to Web UI. Firmware can be updated by uploading file using browser or curl.

    I first tried to use multipart/form form but it turns out it is difficult to handle multipart/form data.

    I searched a bit and I found that javascript can be used to upload file without any encoding/encapsulation. So ESP32 simply writes recieved body to flash. This is same behavior as previous version, but I added callback functions to receive start/end of update and display start/end status.

    updating
    updated, restarting

  • Add alarm functionality

    teru11/23/2021 at 08:56 0 comments

    Alarm and deep sleep functionality is added. Also say time is implemented.
    It is working as alarm clock for 2 weeks now.

    Here is a demo video for alarm and say time.

  • Implemented display

    teru10/04/2021 at 12:01 0 comments

    Show SSID and password while in soft-AP mode.

    Show clock.

    Next things to do:

    • Sleep when idle
    • Check and show battery level
    • Alarm at configured time
    • Automatically synchronize clock
    • Update firmware from web interface

  • OLED worked... at least once

    teru08/30/2021 at 12:00 0 comments

    This picture was taken at Aug. 7

    I assembled updated PCB and it worked at least once. And it stoped working after I soldered optional LEDs.
    I suspect too much heat damaged the panel.

    But that is not a large problem as I have one working display and display is not critical for this alarm clock.

    Anyway I finally implemented the speaker and electronics part is done. I did not make much progress to software part though, considering electronics part took more than 1 year to be done, I believe it will be reach somewhere in the future.

    As for the speaker, I picked CES-26138-16L030 and CDS-25148-L100 for their sizes. Then I compared 2 speakers and felt that CES-26138 sounds better and used it.

    By the way, I used this repository to test display.

  • Uploaded files and code to GitHub

    teru07/26/2021 at 12:28 0 comments

    Uploaded files and code to GitHub:
    https://github.com/ktmizugaki/wifi-voice-clock

    Current status of code is:

    • When ESP32 is started, it becomes AP and HTTP server.
      • SSID and password is printed to serial console.
    • WiFi settings can be added using Web UI.
      • URL will be http://192.168.4.1/wifi_conf
    • ESP32 can connect to added SSID.

    I haven't touched displaying part yet.(SSID and password will be shown on the display in the future)

  • Fixed display board

    teru07/05/2021 at 12:35 0 comments

    I fixed display board and satisfied with layout. I hope this will be good this time.

    And it's about time to order a speaker...

    While waiting for new parts arrive, I'll start coding using almost working object here.

    My plan is, when first powered up, the clock becomes an AP and user sets SSID and password via Web UI. So first thing I need to implement is:

    • Put SSID/password of clock AP on display
    • HTTP server and HTMLs

  • Make OLED work

    teru06/29/2021 at 13:34 0 comments

    I solderd OLED FPC cable to board. Then connected it to ESP32 dev baord and nothing happend.

    I was depressed and didn't know what to do next. All what came up is checking datasheet and checking voltage of each pin.

    When I compared pin table of datasheet and schematic, it turns out the symbol I used is not for my OLED panel.
    Guessing from pin names, it seems like I referenced SH1106 version when I created the symbol.

    I was able to patch circuit and now it works. Pins marked with red needs to be connected to GND and green pins are connected to GND, I added jumper cable to connect them

  • 2 in 1 PCB

    teru06/25/2021 at 13:47 0 comments

    One thing I am concerning about ordering PCB is minimum quantity is usually 5 but I only need 1 clock, and remaining 4 boards will be unused.

    So I tried to reduce unused boards by creating 2 in 1 PCB.
    Since this clock is rectangular box, each opposite panel has same dimensions and I combined each opposite pair of panels to single panel.
    This theoretically reduces unused materials by roughly 60% when measured by area.

    I also made the MCU board as minimal and exposed as many pins as possible so that the board possibly be used for future projects.

    Well, in the rea world, PCB manufacturer send me 8 wrong thickness boards and 8 correctly remade boards.
    Now I have 14 unused PCBs. lol

View all 9 project logs

  • 1
    Cut PCB

    First of all, cut PCB along white line.

    Below is separeted and arranged boards

  • 2
    MCU board

    Solder ESP32 module, decaps and reset circuit for EN pin on top of board.

    Solder 3.3V regulator, 32768Hz clock crystal, capacitors and pin socket to program ESP32 at bottom of board

    I could't find SMD right angled pin socket of this size, I bent leg of socket so that it looks as if a SMD socket.

    then solder pinheader at left and right side. Remaining pad to solder pin socket to connect front panel will be soldered later.

    Now you can check if ESP32 works.

  • 3
    IO board

    Solder resistors, capacitor and transistor at bottom of board.

    Solder switches and pull-up resistors on top of board.

    Cut leg of sockets to slightly less than board thickness before soldering so that the leg does not scratch fingers.

    I covered unused pads with tape so that they don't interact with speaker when I placed on.

    Solder speaker contact and adhere speaker to board.

View all 9 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates