WiFi Connected Clock With Westminster Chimes

11,864

98

63

Introduction: WiFi Connected Clock With Westminster Chimes

My latest digital clock is based on this video and the code found there.

It works very well but I wanted something that also gave me auditory announcements of the time. The classic way of doing this is with Westminster Chimes. Such chimes are found on most grandfather clocks as well as mantle clocks.

While the Arduino that I am using for this project is capable of producing rudimentary sounds that could resemble Westminster Chimes I opted to use an MP3 player that sounded out recordings of the chimes. This gives much better audio quality and flexibility to use whatever sound you choose to play. It also allows me to change the version of the chimes that is played by simply swapping micro SD cards.

One of my clocks is shown here. It continuously displays the time and sounds the chimes at 15 minutes, 30 minutes and 45 minutes after the hour. On the hour where it also chimes the number of the hour.

Step 1: Video

This video shows the clock in action.

Step 2: The MP3 Player & Sounds

I have used the MP3 player that is used in this project many times before. It is the DFPlayer, an inexpensive, high quality MP3 player that stores sounds on a micro-SD card. For more information on this device see: http://www.trainelectronics.com/Arduino/MP3Sound/...
This page also suggests where it can be purchased. Files for the MP3 player reside on a micro SD card in a folder named mp3.

There are 6 sound files for the Westminster Chimes.

0001.mp3 - the chimes for the quarter hour

0002.mp3 - the chimes for the half hour

0003.mp3 - the chimes for the three-quarter hour

0004.mp3 - the chimes for the hour

0005.mp3 - the hour chime

0006.mp3 - the hour chime with a long trailing sound at the end (used as the last chime)

The sound files that I used are in the attached file called mp3.zip

A shorter version is called mp3-shorter.zip To make these files I changed the Tempo in a sound editing program called Audacity.

Step 3: Parts

Only a few parts are needed. The processor is a Wemos ESP8266 that can be ordered from BangGood and Amazon. It requires some additional setup in the Arduino IDE that can be seen here:

https://www.instructables.com/id/Wemos-ESP8266-Get...

The DFPlayer MP3 player can be found at Amazon and BangGood as well.

The LED Matrix display can be found at Amazon and BangGood.

The display's visibility can be improved dramatically by adding a red filter. I use a red, self-adhesive film that can be found on eBay, but red acrylic will work, too.

In addition you will need a 1K resistor, a 10K (a 50K or 100K will work, too) and an 8 ohm speaker.

The unit can be powered from a USB cable to the Wemos D1 or you can use a voltage regulator circuit that supplies 5 volts.

Step 4: Schematic

As you can see from the schematic the wiring is very simple.

Power can come from a 5 volt USB power supply, USB cable, or batteries (3.7 to 5 volts will work)

Step 5: Prototype

This photo shows my prototype. It was built on a small circuit board. The Wemos D1 processor with WiFi is on the right side of the board. It is connected to a USB cable to supply power to the circuit. The DFPlayer is to its left and contains a micro SD card with the sound files. The speaker is connected to the red/black wire that goes off to the left of the photo. Be sure to use an 8 ohm speaker with the DFPlayer. If you only have a 4 ohm speaker put a 3 to 5 ohm resistor in series with the speaker.The 4 module display has been placed behind a piece of red acrylic to make it more visible.

This close-up shows the potentiometer (to the far right) that can be used to adjust the brightness of the display.

Most of the wiring is on the back of the board. It follows the schematic. The only part that is not shown on the schematic is the black capacitor that was placed on the power input connections to filter the DC power when I used a noisy external power supply. It is not necessary if you power with USB through the Wemos D1. The 1K resistor is under the white tubing.

Step 6: Arduino Code

The code is based on YouTube video from John Rogers & DFPlayer code found on my web page here: http://www.trainelectronics.com/Arduino/MP3Sound/...

The libraries used in this sketch can be found here:

ArduinoJson

ESP9266WiFi

DFPlayer_Mini_Mp3

To install the libraries go to each link above, select "Clone or Download" and download the ZIP version. Install in the Arduino IDE with Sketch/Include Library/add ZIP Library

Step 7: Going Farther

The clock with its accompanying Westminster chimes has been operating in my workshop for some weeks and provides a very reliable time and pleasant tones every 15 minutes. I plan on making high quality recordings of my mantle clock's chimes to substitute for the sound I now have on the micro SD card. The next project will be to add hands to the clock and to mount it in an appropriate enclosure.

I hope you have a chance to experiment with WiFi connected clocks, too!

4 People Made This Project!

Recommendations

  • Battery Powered Contest

    Battery Powered Contest
  • Plywood Challenge

    Plywood Challenge
  • Plastic Contest

    Plastic Contest

63 Discussions

0
witoldgrzegorz.raj
witoldgrzegorz.raj

Question 5 weeks ago

Hey Dave, what do I have to change in your file to change the time on the last weekend of March and October

Best regards, Witold
0
davebodnar
davebodnar

Answer 5 weeks ago

Witold - I just took a quick look at the code (haven't touched it in many moons!) and believe you would make a change in the getTime() routine - I don't have time right now to experiment and test but I am sure you can figure it out - that is part of the fun!
enjoy & good luck!
dave

0
witoldgrzegorz.raj
witoldgrzegorz.raj

3 months ago

Hello Dave I'm an Arduino novice liked your clock design with chime, I have a problem with the last write in Your file the compiler stops on the line :
long epoch = round(curEpoch + 3600 * (utcOffset + summerTime) + 86400L) % 86400L;
and shows an error :
invalid operands of types 'double' and 'long int' to binary 'operator%'

Witold
0
davebodnar
davebodnar

Reply 3 months ago

Interesting problem - I just tried to compile the code and got the same error - there must be some change in the libraries or board setup ----
I changed this line
long epoch = round(curEpoch + 3600 * (utcOffset + summerTime) + 86400L) % 86400L;

into these two lines and it compiles

long epoch = round(curEpoch + 3600 * (utcOffset + summerTime) + 86400L);
epoch = epoch % 86400L;

That got it to compile - hopefully it still does the correct time!

Let me know if that helps you out

dave

0
witoldgrzegorz.raj
witoldgrzegorz.raj

Reply 3 months ago

Thanks to Dave it helped, I want to use the node mcu 1.0-esp 12e board for this, do I have to change something in this file, unfortunately I do not know English enough, I use google translator if there are any errors sorry
Witold Raj

0
witoldgrzegorz.raj
witoldgrzegorz.raj

Reply 3 months ago

Dave connected mcu 1.0-esp 12e, it works! .What do I have to change in the max7219.h file to rotate the displayed time by 90 degrees, and change the time zone to Europe ,Poland

Witold Raj witoldgrzegorz.raj@gmail.com
0
davebodnar
davebodnar

Reply 3 months ago

That is great news! Well done

As to rotating digits, I didn't see anything obvious in the code - sorry, but you may need to do some experimention to find the trick within the code.
Good hunting!
dave

0
witoldgrzegorz.raj
witoldgrzegorz.raj

Reply 3 months ago

Dave from the time that is displayed, I conclude that you live somewhere on the East Coast because it is time for New York, and I need Central Europe time, and for text rotation, I want to use 4 modules that you dealt with in 2014 where you combined 8-9 of them szt and you displayed the text atu is the difference between this display in the clock design with a chime

Dave with the time zone setup I managed to do.
And that the setting of displaying the text vertically or horizontally is in the file *ino and I just don't know where it is
0
dgbodnar
dgbodnar

Reply 3 months ago

You are right - I am in Pittsburgh, PA, in the US Eastern Time Zone.

You can change the time zone by modifying this line

float utcOffset = -5;

change the -5 to 0 (zero) to get London time - Central Europe might have you change it to a 1 or a 2 - experiment a bit

Not sure if the work I did on the other display can be applied to this one -

dave

0
don_kleinschnitz
don_kleinschnitz

2 years ago

Dave,
I found my D2 mini lite board library problems, Wemos is now LOLIN(WEMOS) :( and I missed that item in the menu.
Also note that the libraries that you linked to have the names changed in the acutual code which requires the INCLUDE names to be changed.
This is the first time I have used a Wemos Esp8266 and in the process of doing research I noticed that the ADC cannot handle more than 1v max. The D1 has a resistor network connected to the ADC pin that drops the voltage to that level on A0 from 3.2v. Your schematic shows the intensity control connected to 5V. I think when adjusted to its limit it may blow out the A0 pin which would exceed the 1v max?

0
davebodnar
davebodnar

Reply 2 years ago

That is all good information, Don - thanks for passing it along.
I have not seen an issue with the A0 pin but it would be wise to keep it down to 3.2 volts - thanks!
dave

0
don_kleinschnitz
don_kleinschnitz

Question 2 years ago on Step 3

I am having trouble with running on the D1Mini light.

The board connects and appears to download ok but it will not run a program (blink).

Some research suggests that the problem is that the lite is 1M and I can only select 4M when using the board library installed as above.

Have you had this problem and what board library did you use assuming you are using the same Wemos board?

0
davebodnar
davebodnar

Answer 2 years ago

Sorry, Don, but I have not had the problem you describe - I have not tried using the D1Mini lite.

dave

0
don_kleinschnitz
don_kleinschnitz

Question 2 years ago

Where do I find the right display library did not notice a link above?

0
davebodnar
davebodnar

Answer 2 years ago

Take a look under Step 6 Arduino Code above.... If that is not what you are looking for let me know

dave

0
don_kleinschnitz
don_kleinschnitz

Reply 2 years ago

Ah, in the zip with the main code, missed it!

0
mickeypop
mickeypop

Tip 2 years ago

while working on my Fibanacci Clock variant, i was experimenting and thought you might like this idea, though i did remove all the print statements it is basically the same code with a twist, It now tracks just 1 "flag" variable instead of 4

replace all the chime code on loop() with 1 function and with just a switch setting change from short to long chimes on the same SD card. Just make sure to sort the files in different folders.

// IE; WestMinster( digitalRead( some_pin ) );

void WestMinster( int l_s )

{

int LongOrShort = 0;

if( l_s == 1) // 0 WM long, 1 WM short

{ LongOrShort = 6; }

if( m == 15 & flag == 1)

{

mp3_play( 1 + LongOrShort );

flag = 2;

}

if( m == 30 & flag == 2)

{

mp3_play(2 + LongOrShort );

flag = 3;

}

if( m == 45 & flag == 3)

{

mp3_play(3 + LongOrShort );

flag = 0;

}

if( m == 0 && && flag == 0)

{

mp3_play(4 + LongOrShort );

flag = 1;

if (h >= 2)

{

if (h >= 13)

{

h = h - 12;

}

if (h == 0)

{

h = 12; // at midnight do 12 chimes

}

for (i = 1; i <= h - 1; i++)

{

mp3_play(5 + LongOrShort ); // 5 is chime without end tail

}

}

mp3_play(6 + LongOrShort ); // 6 is chime with long tail sound

}

}

0
davebodnar
davebodnar

Reply 2 years ago

Interesting code - thanks for sharing!

dave

0
mickeypop
mickeypop

Tip 2 years ago

NOTE; the DFPlayer runs from 3.2 - 5.4 Volts

R1 is not needed with the 3.3v power instead

0
mickeypop
mickeypop

2 years ago

i liked the Westminster idea

added it to my Atomic Fibonacci Clock with a night silence option (instructable coming)

Also adding a voice option over the Westminster.