Nieuw project Hulp nodig?
bera
  • Labs project

ESP32 talking clack - both RTC & NTP model

Status: Voorstel
45
1
stemmen
23 maart 2020
thumb-20200323141145.png
ESP32 talking clock

The MP3 shield that has come from aliexpess for for a mere $1.3 a piece was lying on the table for quite some time as I was really not able to find a spare micro SD card to check out how it works ! Then Reon , my friend’s son asked me for a talking clock which will alert him at different time of day with different musics of his choice. The clock should also be able to speak up other parameters like sensors value etc.

Construction hurdle: Since the entire MP3 capability is inbuilt into the shield, not much computing power is required to run and manipulate the song sequences while in use. Therefore, an Arduino UNO is enough for it. But the problem comes when I tried to attach a TFT display ( ILI9163 128*128 ) with the UNO , the UNO could not run it. Therefore, I preferred my favorite MCU – ESP32 which has more muscle power , low power consumption and more GPIOs to tinker with.

Sound files preparation: For preparation of sound file one can use his own voice , microphone and recording system. Audacity is an excellent sound software for creating the mp3 files from microphone sound. However, my choice is Python with text-to-speech facility. First I install python and then I install python-text-to-speech (pyttsx / gTTS) and then create my mp3 files from simple sentences. There are about 52 languages in which you can create your own mp3 files. The Indian languages included are – Bengali & Hindi

sudo apt-get install python
sudo pip install pyttsx
sudo pip install gTTS

After installing these softwares you can straight away create your mp3 files from command line itself.

gtts-cli.py "1" -l en -o /home/mp3/0001.mp3
gtts-cli.py "2" -l en -o /home/mp3/0001-speak-two.mp3
gtts-cli.py "The time is now” -l en -o /home/mp3/0101-speak-time-now.mp3

However, I’ve included a text-to-speech.py file to create your mp3 files at relax. Therefore, the first big job for the task is to create the mp3 files and then save them in the format like 0001.mp3, 0002.mp3 etc. Some discretions can be added like
0001-speak-one.mp3
0002-speak-two.mp3
0003-speak-three.mp3
However, the MP3 shield will pick up the 0001-speak-one.mp3 as the first file and 0002.mp3 as the 2nd file etc.

Type of MP3 files:
The MP3 shield has an SD card on it’s back. In the root directory of it, create a folder called ‘mp3’ and then dump all the mp3 files in it. For clock sound you will require all the sounds from 0 to 59. To start the dialog you may like to have an mp3 file like - “The time is now”. You also may like to have a music at the beginning of the speech. Dump all these variety of files in the mp3 directory of the sd card and you are done for the mp3 file creations.

Special note: In case you find there is sputtering noise from the speaker then put a 1K resistor between ESP32 Tx and MP3 Rx pin.

Time keeper: RTC module DS3231 which comes for about $1.5 a-piece from aliexpress.com is far more superior to the other RTC module as it has inbuilt quartz which is again corrected by an inbuilt temperature sensor. It’s very precise ,runs on 3.3 volt and maintains precision over a very long period of time.

RTC DS3231:


Software: Is developed on Arduino IDE using ESP32 dev. board. Besides talking about initial music, day, date, time, AM or PM the clock also speaks the temperature from the RTC inbuilt temperature sensor. First we have to set the RTC clock for which I’ve put a the codes in the setup section to set the time . Every time while flushing the ESP32 with the sketch the time get set. But you need to care about the time of the computer. I’ve also added a separate sketch for setting up & displaying the time.

It requires only 6 wires to run the MP3 module – Tx,Rx, Vcc,Gnd, Spk1,Spk2. The RTC runs on I2C bus and the TFT runs on SPI bus. The entire schematic is shown in the picture. On ESP32 the Tx1 and Rx1 , I could not run so I choose Tx2 and Rx2 and it works. The maximum volume level of the MP3 shield is 30. Beyond 30 it will be limited to 30 only.

Clock with NTP time server:
In the absence of RTC3231 one can run the clock using time from the NTP server. For that I’ve also added the sketch where one has to enter the wifi id and password.

Power supply: Any 5 volt smart phone charger is enough to run the clock. However it can also be run from a Li-Ion 3.7 volt cell by giving the supply on the 3.3 volt line and the ground line.


Schematic:

Aftermath: This inexpensive talking machine can be used for more sensible purposes like audio alarm for gas leakage with leakage level and wind direction. It's the moment when people neither can see, nor can comprehend. They only need direction to follow
..... Gas leakage at Post A, Run towards B gate. The machine will measure leakage level, identify wind direction and then issue instruction. All can be achieved instantly.


BOM:
ESP32 $7.5
TFT 1.44” $3.5
RTC DS3231 $1.2
8 Ohm speaker (0.3 watt), Micro SD Card, wires, board, power supply etc extra.

Prototype:



The youtube video is here:
https://youtu.be/ryscF5IYixQ


Bera S
Vindhyanagar
Lees het volledige stuk
Toon minder
Afbeeldingen
Schematic diagram
Talking clock
MP3 shield
Overige
  • Fileslist icon
    software (10.72 KB )
    ESP32 software for the talking clock

Reacties worden ingeladen...