Arduino talking clock.

talking clock3

The code for this project along with all WAV files and a copy of the library by ecloud can be found on my GitHub page here. This project was updated on 22 March 2016 to include a larger audio file with better speech.

Another project using this talking board is the Talking Thermometer here.

I had managed to get the WT588D -U 32M to work as a stand alone module in this post here, but wanted to be able to use it with three line control. This mode is similar (identical?) to I2C, but any pins on the Arduino can be used. I started to write a library, but found a perfectly good one on the Arduino forum here and decided to use that instead.

There are several students at the school I work in who are partially sighted and I wanted to build several instruments that they could use that would allow them to be able to take part in Science experiments. Top of the list is a talking thermometer, for although they are available to buy they are expensive and designed to check food cooked on BBQs. The clock was chosen as a first project as it could be turned into a timer.

Getting the speech just right:

The biggest problem with getting this project right was to have as natural a voice as possible. I abandoned my first audio file and decided to produce a file that contained a range of words and phrases that would be useful in a range of measuring instruments. The result was the Talking Measurements file that contains a wide range of words suitable for a number of measuring instruments from Voltage and Current to GPS and Humidity. There is a list of phrases by measuring instrument in the text file Library List.txt.

The circuit:

This project uses an Arduino UNO, a WT588D -U 32M audio module and an RTC module DS1327. The clock has four connections, Vcc, Gnd, SDA (connected to A4) and SCL connected to A5. A simple push button switch is connected between digital pin 2 and Gnd, this is used to make the clock speak. The WT588D comes in several versions and the pin out for the -U version that has a USB connection is shown below.
FXP1VIHI5MD32NN.MEDIUM

Pin connections are looking down on the top of the module. Connect a small 8 ohm speaker to pins 9 and 10 and connect the module via a USB lead to a PC and startup the WT588D VoiceChip software.
waytronic2
If the program starts in Chinese click on the second menu item on the right and select English. Load the talking_measurements_winproj file using the Load a project button. Click on the compile button. Now click on the Options button and select Three Line Mode, PWM, Busy Mode – LOW and finally make sure Pull High Resistor is selected. Click on OK to exit the screen. Now click on the Upload to WT588D button, make sure the WT588D is connected to the PC, but not connected to the Arduino and click on the Connect button, the red light will turn green. To upload the audio to the WT588D click on the OneKeyDownLoad button, the green status bar will move across twice. On the second pass it should cross all the way over, if it stop about three quarters of the way over press the OneKeyDownLoad button again.

Once the audio file has been uploaded then connect the WT588D to the Arduino, the complete connection diagram for the clock is shown below.

talking clock diagram

If your DS1307 RTC is set to the correct time then upload the talking clock sketch, otherwise upload and run the sketch to set the RTC. With the clock set to the right time and the talking clock sketch uploaded press the talk button to hear the time.

Arduino acrylic baseplate

  These useful baseplates  can be purchased from eBay for less than £1.20. For example here. In addition I purchased the 400 tie point breadboard for less tha £2 from here. The breadboard comes as a small kit, the baseplates itself, a small pack of nuts, bolts and spacers and four self adhesive feet. The Arduino UNO can be mounted on either the left or right hand side by turning the baseplate over. I mounted it on the left, but this puts the digital pins furthest away from the breadboard.

Carefully remove the protective film from the baseplate and decide which side you will mount the Arduino on, the two holes closest together ar at the back of the UNO. Mount the feet on what will be the bottom of the baseplate. Mounting the UNO is a title tricky if you have big hands like me. Push the bolt through a hole and slip a spacer on it, push the bolt through the corresponding hole on the UNO and screw on the nut, loosely , this is when you are likely to lose it! I built mine up on a tray so that when I dropped anything it would not go too far. Once all four nuts and bolts are connected then tighten them, making sure the Arduino UNO is square on the board, remove the profective film from the breadboard and place it on the baseplate. Beware, once it touches the acrylic sheet it sticks  firmly and will not move without causing damage.

For me this represents a leap in small project trialing, everything staying firmly together. I also added a breadboard power supply like this one on eBay for £1. This is definitely a worthwhile addition to my workshop.

WTD588D – U 32M Audio Module

 

You can download the sketch and software to upload sound files to the WTD588D on my GitHub page

The WTD588D -U 32M is a digital record and playback device. It can operate as a standalone  playback device or it can be controlled by a microprocessor such as an Arduino. It exists in a number of formats, the  -U shows that the board has a USB to allow uploading sound files, if this is missing the board will have a smaller footprint, but not have a USB chip. The memory storage is shown by 32M (32 m byte) and there are also 16mb versions. The USB versions can be obtained for less than £3 from China, like this one on eBay.

To make the most of the WTD588D you need two pieces of software, a sound editing software like audacity (download for free from http://audacityteam.org). The other piece of software required, WT588D VoiceChip V1.6, is included on my GitHub page. Run the software (PC only) and it opens up in Korean. To switch to English click on the  second menu button from the right, shown underlined in green in the screenshot below.

To save having to do this each time go to the programs folder on your hard drive and find the folder Waytronic, look for WT_App.exe, and send to the desktop as a link. Click on this shortcut to run the English version each time.

The sound files need to be in WAV format and a rate of 20,000  and Audacity is used to edit your sound files ready to be uploaded to the WT588D. The VoiceChip software will not accept WAV files saved at a rate higher than 20,000.

Start by creating a new project. Click on the File  menu option (or the blank page icon on the top left of the screen) and give the project a name ( I found that for some reason not all of the keys were available on my keyboard!), then right click on the left hand pane, select LOAD from the drop down menu. Navigate to the folder containing your WAV file and click on it. The file will appear. Now right click in the right hand pane, select the file and it will be shown.

waytronic1

waytronic2

Click on the COMPILE button, once the file has compiled clock on the OPTIONS button and make sure the Control mode is set to KEY for this test (up to four keys can be defined and are operated by taking the KEY pin LOW (keys are connected to pins 16, 17, 18 and 19). Make sure the WT588D is connected to your computer via the USB  and click on the UPLOAD button to upload the WAV file to the WT588D. On the UPLOAD screen click on the CONNECT button and if the WT588D is connected the STATUS lamp will turn green. Use the browse button to find the desired BIN file (created with COMPILE) and click on ONE KEY DOWNLOAD. Wait for the upload to complete.

To test that everything had worked I plugged the WT588D onto a breadboard, I connected a LED (with a 220R resistor in series) between pins 21 and 22, this is the busy LED and will light when the sound is being played.. I connected a pair of headphones (in Mono mode) between pins 9 and 10. Lastly I connected a flying lead to pin 19.

FXP1VIHI5MD32NN.MEDIUM

Touching the flying lead from pin 19 to pin 14 (Gnd) started the sound playing, the LED lighting. I had uploaded a full music track (which took up almost half of the available memory!) and I was surprised at the quality of playback, there seemed to be no extraneous pops or crackles and no obvious clipping.

An 8 ohm speaker connected to the two PWM pins, 9 and 10, will provide 0.5w. If a larger output is required an amplifier cannot be connected to the PWM outputs. Instead connect the input of the amplifier to the DAC pin (pin 8) and Gnd (pin 14) as shown in the diagram below.

Deleting sound files and emptying the WT5888D:

To delete individual sound files,  right click in the left hand pane to show a menu. DELETE will remove selected files and EMPTY will erase all the sound files from the library. To erase files to be uploaded, click on the right hand pane, select a file and then right click will show a menu. Delete individual files or delete all files. Recompile, then upload the new set of files to the WT588D. To Erase the flash memory click on the DOWNLOAD button (second from the right) and click on ERASE.

Tracks and playing continuous or one at a time:

The column of hexadecimal numbers in the centre of the screen, labeled EQUATION NUMBER can be thought of as the track numbers. If you load all your sounds into one EQUATION NUMBER then they will all play one after another. However, if you save each sound file to a different EQUATION NUMBER and in OPERATIONS/KEY SETUP change Key 1 to NEXT LOOP, the tracks will play one at a time. Each time KEY 1 is pressed the next sound file will play, looping back to the start once all tracks have been played. If KEY 1 is changed to NEXT UNLOOP the last track will keep playing each time KEY 1 is pressed and not loop back to the start. Keys can be configured in a number of ways including PAUSE, VOLUME UP, VOLUME DOWN etc.

Setup in this manner a simple sound player can be obtained, the four available keys can me set to play, pause, stop and turn the device on or off. To be more useful providing voice to such devices as a speaking clock or to provide spoken instructions etc one of the other modes available, I2C , must be used and this will be the topic of a later blog.

TEA5767 FM Radio with IR control and OLED Display

TEA5767 with IR and OLED

The sketch for this project can be found on my GitHub page here.

My last blog used the little FM radio, TEA5767, with a two line LCD and keypad display. I felt that it was a little clumsy and so decided to use an Infra Red controller and display the radio data on an OLED Display. I have gone for a number of preset stations and not to use the scan function. As it stands the sketch has six preset stations and the infra red remote is used to switch between them. There is also a favourite station button, press this and the radio tunes straight to your favourite. Two other buttons on the IR controller allow fine tuning up or down, this increases or decreases the frequency by 0.1 mHz.

The display:

TEA5767 OLED 1.

The radio wil automatically switch from Stereo to Mono if the signal strength drops to a level that affects sound quality. The display shows the audio mode, in this case it has switched to mono. The radio reports the signal strength and this is shown as a figure from 1 to 10. The third row shows the frequency the radio is tuned to, this is the value reported by the radio, for example a value of 102.0 mHz had been sent to the radio, but the radio had tuned to 101.99 mHz. The next row down is the station name and the last row is the tuning scale from 80 mHz to 110 mHz, a cursor shows the frequency.

Connections:

The TEA5767 and the OLED Display are I2C, connect Vcc and Gnd to the Arduino 5volts and Gnd. Connect SDA to Arduino pin A4 and SCL to Arduino pin A5. The infra red receiver has three connections, Vcc, Gnd and signal. Connect the signal, or data out, to Arduino data pin 3 and Vcc and Gnd to Arduino 5 volts and Gnd. Connect a flying lead to Arduino digital pin 3, this will be used to switch the display to the IR decode display. Almost any IR controller can be used and the sketch allows a setup mode to be entered, and this displays the decimal value of the key press. Decide which keys you are going to use for Preset Up, PresetDown, Favourite, fineTuneUp, finetuneDown and Radio On/Off. Put the sketch into setup mode by connecting the flying lead from pin 3 to Gnd, point the controller at the IR receiver and press a key (the onboard LED will light) and its value will be displayed as shown below. Press the key a few times to confirm the value and once you have all the key values needed put them into the sketch.

TEA5767 OLED 2

Adding the station names and frequencies:

Make a list of up to six stations you want to listen to (this can be increased or decreased by changing the values of stationMHZ[n]  and stations[n] where n is the number of preset stations + 1. Station names and frequencies are stored in these arrays, for example:

stationsMHZ[1] = 88.58;
stations[1] = “BBC Radio 2”;
stationsMHZ[2] = 96.10;
stations[2] = “Radio Solent”;

the maximum number of preset stations and the favourite are set as follows:

maxPresets = 6; // number of stations in list, change this as required
favourite = 6; // select your own favourite

The favourite station will play when power is first applied.

TEA5767 libraries:

I found a number of libraries on the internet, but settled on this one by Marcos R. Oliveira and this is the library I have used here. I have included a copy of this library on my GitHub page as shown at the top of this blog.