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.
Attachments
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:
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!
- ubiube made it!
- RANDOM KNOWLEDGE made it!
- RANDOM KNOWLEDGE made it!
- RuiB2 made it!
75 Comments
2 months ago
Hello,
I Heard correctly the tone during the boot. But i didn't see anything happen at quarter end hour. I didn't understand why. Could you tell me an Idea?
Thanks a lot,
John
Reply 2 months ago
I would try a DFPlayer from a different source as some are not genuine and don't work correctly
I have had good luck with Amazon
https://a.co/d/cTKe4eY
dave
Question 8 months ago on Introduction
Hello, I've be trying to verify your code but after changing the DFplayer and the lines that you detail below (where you split the code into 2 lines) I receive an error "Error compiling for board NodeMCU 1.0 (ESP-12E Module)" The same error occurs with just the generic ESP8266 board as well, if you could help this novice I would be very grateful, thanks Paul
Answer 8 months ago
There may be a problem when using the newer IDE version
See if you can find IDE version 1.8.13 and try that
Good luck!
dave
Reply 8 months ago
Thanks for your reply Dave. I installed 1.8.13 and the version of DFplayer on the page to no avail. It seems that these scripts are perhaps only valid at the time of publishing and once the program or libraries have been updated then sadly it may not work any longer. Perhaps I'm chewing off to much not knowing that enough about the various differences between versions and syntax that maybe effect the compiler. Anyway many thanks for your time, cheers Paul
Reply 8 months ago
Paul - I just got it to compile with IDE version 1.8.16
I had to add the wire and lcd libraries that are here
http://trainelectronics.com/DCC_Arduino/DCC_Booste...
on my web page. You can add these by copying the folders to the Library folder in the Arduino folder in the ProgramFiles(x86) folder
I also added the DFPlayer library found here
https://github.com/DFRobot/DFPlayer-Mini-mp3/archi...
add this with the library manager in the IDE
Hope that works for you
dave
Reply 8 months ago
Dave, just a quick update. Installed a clean version of IDE 1.8.16 and installed ESP8266 etc. After verify your sketch there was just the one line that stopped the verify;
String line;
client.setNoDelay(false);
When commented out it verifies ok, however the default Board was the Uno and after changing this to NodeMCU 1.0 it failed on other lines. Your input is very much appreciated, thank you.
Paul
Reply 8 months ago
Hello Dave,
I’ve tried the following;
1.Installed
IDE version 1.8.16
2.The
link http://trainelectronics.com/DCC_Arduino/DCC_Booster/LCD-wire.zip
did not work so entered it manually and downloaded zip file
3.Downloaded
https://github.com/DFRobot/DFPlayer-Mini-mp3/archive/refs/heads/master.zip
4.Copied
the LiquidCrystal2 and Wire folders to the Library folder in the Arduino folder
in the ProgramFiles(x86) folder
5.Tried
to install master.zip but failed as invalid – copied DFPlayer_Mini_Mp3 folder
to C:\Users\pc\Documents\Arduino\libraries
6.Ran
verify and error on line “WiFi.begin(ssid, password);” Error = exit status 1
invalid conversion from 'const
char*' to 'char*' [-fpermissive]
7.Commented
out line and re-run verify and error on line “client.setNoDelay(false); Error =
exit status 1 'class WiFiClient' has no member named 'setNoDelay'
8.Comment
out line and re-run verify and error exit status 1 Error compiling for board
NodeMCU 1.0 (ESP-12E Module).
The verify log in red is below, if that helps;
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:15:57: error: 'const char OK []' redeclared as different kind of entity
15 | #define PROGMEM __attribute__((section(".progmem.data")))
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:18:17: note: in expansion of macro 'PROGMEM'
18 | const char OK[] PROGMEM = "OK";
| ^~~~~~~
In file included from C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/esp8266_peri.h:27,
from C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:38,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:17,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2/tools/sdk/include/c_types.h:71:5: note: previous declaration 'STATUS OK'
71 | OK = 0,
| ^~
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:15:57: error: 'const char FAIL []' redeclared as different kind of entity
15 | #define PROGMEM __attribute__((section(".progmem.data")))
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:19:19: note: in expansion of macro 'PROGMEM'
19 | const char FAIL[] PROGMEM = "FAIL";
| ^~~~~~~
In file included from C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/esp8266_peri.h:27,
from C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:38,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:17,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2/tools/sdk/include/c_types.h:72:5: note: previous declaration 'STATUS FAIL'
72 | FAIL,
| ^~~~
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:15:57: error: 'const char BUSY []' redeclared as different kind of entity
15 | #define PROGMEM __attribute__((section(".progmem.data")))
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:26:19: note: in expansion of macro 'PROGMEM'
26 | const char BUSY[] PROGMEM = "busy";
| ^~~~~~~
In file included from C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/esp8266_peri.h:27,
from C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:38,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:17,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2/tools/sdk/include/c_types.h:74:5: note: previous declaration 'STATUS BUSY'
74 | BUSY,
| ^~~~
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp: In member function 'bool SerialESP8266wifi::begin()':
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:157:27: error: cannot convert 'STATUS' to 'const char*'
157 | if (readCommand(1000, OK, NO_CHANGE) == 0)
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:165:27: error: cannot convert 'STATUS' to 'const char*'
165 | if (readCommand(1000, OK, NO_CHANGE) == 0)
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:170:39: error: cannot convert 'STATUS' to 'const char*'
170 | flags.started = readCommand(3000, OK, NO_CHANGE) > 0;
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp: In member function 'bool SerialESP8266wifi::connectToAP()':
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:204:24: error: cannot convert 'STATUS' to 'const char*'
204 | readCommand(15000, OK, FAIL);
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp: In member function 'bool SerialESP8266wifi::isConnectedToAP()':
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:211:21: error: cannot convert 'STATUS' to 'const char*'
211 | readCommand(10, OK); //cleanup
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp: In member function 'char* SerialESP8266wifi::getIP()':
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:222:25: error: cannot convert 'STATUS' to 'const char*'
222 | readCommand(10, OK, ERROR);
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:225:23: error: cannot convert 'STATUS' to 'const char*'
225 | readCommand(1000, OK, ERROR);
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp: In member function 'char* SerialESP8266wifi::getMAC()':
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:236:25: error: cannot convert 'STATUS' to 'const char*'
236 | readCommand(10, OK, ERROR);
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:239:23: error: cannot convert 'STATUS' to 'const char*'
239 | readCommand(1000, OK, ERROR);
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp: In member function 'void SerialESP8266wifi::disconnectFromServer()':
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:286:23: error: cannot convert 'STATUS' to 'const char*'
286 | readCommand(2000, OK); //fire and forget in this case..
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp: In member function 'bool SerialESP8266wifi::startLocalServer()':
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:327:51: error: cannot convert 'STATUS' to 'const char*'
327 | flags.localServerRunning = (readCommand(2000, OK, NO_CHANGE) > 0);
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp: In member function 'bool SerialESP8266wifi::startLocalAp()':
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:334:28: error: cannot convert 'STATUS' to 'const char*'
334 | if (!readCommand(2000, OK, NO_CHANGE))
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:346:47: error: cannot convert 'STATUS' to 'const char*'
346 | flags.localApRunning = (readCommand(5000, OK, ERROR) == 1);
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp: In member function 'bool SerialESP8266wifi::stopLocalServer()':
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:352:42: error: cannot convert 'STATUS' to 'const char*'
352 | boolean stopped = (readCommand(2000, OK, NO_CHANGE) > 0);
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp: In member function 'bool SerialESP8266wifi::stopLocalAP()':
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:361:42: error: cannot convert 'STATUS' to 'const char*'
361 | boolean stopped = (readCommand(2000, OK, NO_CHANGE) > 0);
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp: In member function 'bool SerialESP8266wifi::send(char, const char*, bool)':
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:425:54: error: cannot convert 'STATUS' to 'const char*'
425 | byte sendStatus = readCommand(5000, SEND_OK, BUSY);
| ^~~~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:73: note: initializing argument 3 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp: In member function 'WifiMessage SerialESP8266wifi::listenForIncomingMessage(int)':
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:554:60: error: no matching function for call to 'min(byte&, unsigned int)'
554 | readBuffer(&msgIn[0], min(length, sizeof(msgIn) - 1));
| ^
In file included from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\algorithm:62,
from C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:225,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:17,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algo.h:3479:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
3479 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algo.h:3479:5: note: template argument deduction/substitution failed:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:554:60: note: mismatched types 'std::initializer_list<_Tp>' and 'unsigned char'
554 | readBuffer(&msgIn[0], min(length, sizeof(msgIn) - 1));
| ^
In file included from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\algorithm:62,
from C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:225,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:17,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algo.h:3473:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
3473 | min(initializer_list<_Tp> __l)
| ^~~
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algo.h:3473:5: note: template argument deduction/substitution failed:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:554:60: note: mismatched types 'std::initializer_list<_Tp>' and 'unsigned char'
554 | readBuffer(&msgIn[0], min(length, sizeof(msgIn) - 1));
| ^
In file included from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\specfun.h:45,
from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\cmath:1927,
from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\math.h:36,
from C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:34,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:17,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
278 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algobase.h:278:5: note: template argument deduction/substitution failed:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:554:60: note: deduced conflicting types for parameter 'const _Tp' ('unsigned char' and 'unsigned int')
554 | readBuffer(&msgIn[0], min(length, sizeof(msgIn) - 1));
| ^
In file included from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\specfun.h:45,
from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\cmath:1927,
from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\math.h:36,
from C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:34,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:17,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
230 | min(const _Tp& __a, const _Tp& __b)
| ^~~
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algobase.h:230:5: note: template argument deduction/substitution failed:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:554:60: note: deduced conflicting types for parameter 'const _Tp' ('unsigned char' and 'unsigned int')
554 | readBuffer(&msgIn[0], min(length, sizeof(msgIn) - 1));
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:558:25: error: cannot convert 'STATUS' to 'const char*'
558 | readCommand(10, OK); // cleanup after rx
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp: In member function 'WifiMessage SerialESP8266wifi::getIncomingMessage()':
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:591:60: error: no matching function for call to 'min(byte&, unsigned int)'
591 | readBuffer(&msgIn[0], min(length, sizeof(msgIn) - 1));
| ^
In file included from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\algorithm:62,
from C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:225,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:17,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algo.h:3479:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
3479 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algo.h:3479:5: note: template argument deduction/substitution failed:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:591:60: note: mismatched types 'std::initializer_list<_Tp>' and 'unsigned char'
591 | readBuffer(&msgIn[0], min(length, sizeof(msgIn) - 1));
| ^
In file included from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\algorithm:62,
from C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:225,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:17,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algo.h:3473:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
3473 | min(initializer_list<_Tp> __l)
| ^~~
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algo.h:3473:5: note: template argument deduction/substitution failed:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:591:60: note: mismatched types 'std::initializer_list<_Tp>' and 'unsigned char'
591 | readBuffer(&msgIn[0], min(length, sizeof(msgIn) - 1));
| ^
In file included from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\specfun.h:45,
from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\cmath:1927,
from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\math.h:36,
from C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:34,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:17,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
278 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algobase.h:278:5: note: template argument deduction/substitution failed:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:591:60: note: deduced conflicting types for parameter 'const _Tp' ('unsigned char' and 'unsigned int')
591 | readBuffer(&msgIn[0], min(length, sizeof(msgIn) - 1));
| ^
In file included from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\specfun.h:45,
from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\cmath:1927,
from c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\math.h:36,
from C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:34,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:17,
from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
230 | min(const _Tp& __a, const _Tp& __b)
| ^~~
c:\users\pc\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits\stl_algobase.h:230:5: note: template argument deduction/substitution failed:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:591:60: note: deduced conflicting types for parameter 'const _Tp' ('unsigned char' and 'unsigned int')
591 | readBuffer(&msgIn[0], min(length, sizeof(msgIn) - 1));
| ^
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:595:25: error: cannot convert 'STATUS' to 'const char*'
595 | readCommand(10, OK); // cleanup after rx
| ^~
| |
| STATUS
In file included from C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.cpp:9:
C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master\SerialESP8266wifi.h:181:47: note: initializing argument 2 of 'byte SerialESP8266wifi::readCommand(int, const char*, const char*)'
181 | byte readCommand(int timeout, const char* text1 = NULL, const char* text2 = NULL);
| ^
Multiple libraries were found for "Wire.h"
Used: C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\Wire
Not used: C:\Program Files (x86)\Arduino\libraries\Wire
Using library ArduinoJson at version 6.19.4 in folder: C:\Users\pc\Documents\Arduino\libraries\ArduinoJson
Using library ESP8266wifi-master in folder: C:\Users\pc\Documents\Arduino\libraries\ESP8266wifi-master (legacy)
Using library WiFi at version 1.2.7 in folder: C:\Program Files (x86)\Arduino\libraries\WiFi
Using library Wire at version 1.0 in folder: C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\Wire
Using library DFPlayer_Mini_Mp3 in folder: C:\Users\pc\Documents\Arduino\libraries\DFPlayer_Mini_Mp3 (legacy)
Using library SoftwareSerial at version 6.12.7 in folder: C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\SoftwareSerial
Using library SPI at version 1.0 in folder: C:\Users\pc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\SPI
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
Reply 8 months ago
Sorry, Paul, but nothing comes to mind- will let you know if I have any ideas
dave
Reply 8 months ago
Thanks anyway Dave. I'll Install Arduino IDE on a fresh system and see if that makes any difference and will let you know
Paul
Reply 8 months ago
Thank you very much Dave, I have downloaded the files and will give it a go tomorrow and let you know how I get on.
Paul
Tip 4 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
}
}
Reply 2 years ago
Hello Mike. could you pls share with me the complete modified code? If I understand you well you made 2 separate mp3 folders. One is named Long.mp3 and the other Short.mp3.
Reply 4 years ago
Interesting code - thanks for sharing!
dave
Question 2 years ago
Best regards, Witold
Answer 2 years 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
2 years ago
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
Reply 2 years 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
Reply 2 years 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
Reply 2 years ago
Witold Raj witoldgrzegorz.raj@gmail.com