How to: Speaking Clock

Hello 🙂

20×4 LCD interfaced with the Arduino Mega2560 board along with the LM35DT temperature sensor

Setup and Procedure

The wave shield is interfaced with the Arduino Mega 2560 as normal. A couple of pins were remapped because the wave shield was initially made for a different device. The DAC pins were remapped to pins 22,23,24 and 25 on the Arduino board. The WaveHC library also has to be modified to accommodate these changes. It is self-explanatory. The SD card communications pins MISO (Master-in-slave-out), MOSI (Master-out-slave-in), CS (chip select) and SCK (clock) are unchangeable and specific for every microcontroller used. For this project, they are pins 50,51,52 and 53. Refer to the pin mapping diagram for details.

Only four data pins were connected from the LCD to the Arduino. This is the 4-bit data transfer mode. The 4-bit mode is efficient for simple alphanumeric data transfer. The RW (Read/Write) pin was grounded because data is only being sent to the LCD and not read from it. RV1 is contrast control for the LCD.

U2 is a hex Schmitt inverter IC used in this case for debouncing the button. The RC time constant = 0.1s which is good enough for the debounce. This could have also been achieved by software easily. Note: In my project, all the buttons were debounced using U2. Software debouncing could have been used as well, I only had a few problems doing that.

The sounds could have been achieved using a voice synthesizer but that incurs some cost. Instead, the sounds were recorded and converted to forms easy to process by the microcontroller.

Each individual audio track was recorded in Audacity and converted to WAV files understandable by the computer. The track properties were set to 16-bit PCM and rate was set to 22 KHz. It is not the best audio quality but the DAC can certainly handle the processing fairly well. The tracks were converted to mono because there is only one speaker. Stereo works but would be ambiguous and pointless.

An easy procedure is to record all the tracks on a single WAV file and export selected WAV’s. Every audio track is saved to the root directory on the SD card with relatively simple files names such as ’01.WAV’ for quick access to the root folder by the microcontroller.

The SD/MMC card must be formatted with the FAT file system before any recording is stored in it. FAT16 and FAT32 file systems are common and compatible with almost every system including cameras and microcontrollers.

*Check the English and Yoruba folders for recordings. 

Atmega 2560 Pin Mapping
Refer to this to check appropriate pins on the Arduino board

WaveShield Schematic by Adafruit

Language and Recordings

Recordings for English

The following were recorded in English and converted to WAV files.

-[0, 1, 2…10, 11, 12 …20, 30, 40, 50]

-[am, pm, good morning, good afternoon, good evening, o’clock]

-[The time is…]. 

[Download the English recordings: Download]

Recordings in Yoruba (It is a bit complicated)

Yoruba English Yoruba English
Oru Midnight (12am – 4am) Kan 1
Aaro Morning (5am – 11am) Meji 2
Osan Afternoon (12pm – 5pm) Meta 3
Irole Evening (5pm – 6pm) Merin 4
Ale Night (7pm – 11pm) Marun 5
Ago Hour/Time is Mefa 6
Abo Half Meje 7
Ku Less Mejo 8
Koja Past Mesan 9
Isheju Minutes Mewa 10
Mokonla 11 Mokanle logun 21
Mejila 12 Mejile logun 22
Metala 13 Metale logun 23
Merinla 14 Merinle logun 24
Marundin logun 15 Meedogbon 25
Merindin logun 16 Merindin logbon 26
Metadin logun 17 Metadin logbon 27
Mejidin logun 18 Mejidin logbon 28
Mokandin logun 19 Mokandin logbon 29
Ogun 20

Sample statements:

1:15 – Ago kan koja isheju marundin logun

1:30 – Ago kan abo

1:45 – Ago meji ku iseju marundin logun

2:00 – Ago meji

Download the Yoruba recordings>> Download Yoruba

PART

MANUFACTURER

#

COST(£)

Arduino Mega 2560

Active Robots

1

42.72

USB Serial Programming Cable

Active Robots

1

3.80

Wave Shield kit v1.1

Proto-PIC

1

15.30

20×4 LCD

RS Components

1

8.85

2GB SD card

RS Components

1

5.50

LM35DT

RS Components

5

1.58

Waterproof 8-ohm speaker

RS Components

1

3.95

10K plastic potentiometer

RS Components

2

4.60

Push button SPNO

RS Components

2

4.32

Schmitt Trigger Inverter

Onecall

10

0.152

*Ensure you buy cheaper push buttons and Arduino board. These prices are outrageous.

Code explanation

This project is for intermediate arduino users. If you have no idea about using an arduino, please check www.arduino.cc for quickstart guides and tutorials. The website also explains the Arduino C functions. Long live open-source!

Download the program codes from here >> Download Codes

ISR(TIMER3_COMPA_vect) //timer3 interrupt service routine //Overflows every second

-The first section of that software ISR reads the LM35 temp sensor and converts the value into degree celsius, every two seconds. Note, the timer overflows every second. Read about AVR interrupts if you need any clarification. This website offered a lot of help: http://www.engblaze.com/microcontroller-tutorial-avr-and-arduino-timer-interrupts/

-The second section of the ISR calculates the second, minute and hour based on this simple order:

hr

hr1

mn

mn1

sec

sec1

Which shows the time format as: 00:00:00

where hr = hour, mn = minute, sec= second.

Other codes come with the WaveHC library. Please check: http://www.ladyada.net/make/waveshield/libraryhcplay6.html for details.

Thanks to the Adafruit community for the help and FAT16Lib.

Please endeavour to give credit to my work if you do use any of my codes.

Oluwatobi Babatunde, University of Sheffield.

Long live open-source!!! 

Advertisements

One response

  1. Dude you rock! However, is it possible to just have one language on the clock?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: