AVR WAV PlayerRecorderis absolutely new product on the market of these type modules not only in Poland.
Properties and advantages:
Player ofanylength WAV files
Recorder ofaudiothrough a built-in microphone for WAV files (which can be immediately played by the device or using a PC).
Quality of audio is comparable to MP3 player.
Possibility to use memory cards to write and read both in the device and a PC.
Configuration software on a PC (radio Communications via Bluetooth or cable RS232)
Possibility of a remote control via typical infrared remote (standard RC5) or RS232 and Bluetooth (wireless)
Cooperation with mobile phones via Bluetooth
WAV stereo files playing max up to 22 kHz sampling rate or mono up to 44 kHz.
For who is that module? (evaluation kit) ?
If you build and intelligent microprocessor system you can enrich it with any audio communicates
you can use the module as a start-up kit for the book: "C language Passion of 8-bit controllers programming", because basing on it you can do many interesting exercises described in the book and related to audio support , at the same time you can learn by creating this kind applications.
high quality (16-bits DAC built-in) allows to use audio communicates for the most demanding Project keeping a minimum simplicity of execution, workload costs
building your own simple voice recorder or recording direct communicates won’y causa any bigger problems
For the first time such a module was enriched with the possibility of audio writing/recording directly into SD memory card and directly into WA file – hence the name "Recorder". It is pioneering solution as the Atnel company definitely extended common audio modules capabilities based on small 8-bits AVR microcontrollers by using high quality digital- analog DAC 16 converter, 16-bits resolution. We are saying about a specialized chip TDA1543. Until now similar competing systems used, and they still do - only PWM signal to generate a sound. Of course it gives some possibilities however it shows up that with only a bit bigger costs you can have a hundred times better quality of played sounds, comparable with common MP3 players. So we can ask why should we care about construction and software of such devices when we can find on the market cheap and ready small MP3 players which we can successfully adapt do our own applications. The answer seems to be obvious.
MP3 players must be adapted and they cannot be used in a free way.
Creating own even small series of devices we must take into account a lack of repeatability because some models of MP3 may be available only shortly.
More than once the adaptation will require our own project extension and it may increase our costs and they can be higher than costs of the solution presented here.
Having a possibility to build such a device from the beginning, understanding it then whole the project is limited only by constructor’s imagination.
Taking it all into account preparing such a project, based on a cheap MP3 player (from sales usually) may show up a time-consuming and unrepeatable project and you are only satisfied with this own individual device that you have created for yourself. Meanwhile the solution from the "C language Passion of 8-bit controllers programming" book will let you to learn how to create and build this type devices in very easy way not only from the electronic side (what you can see looking at TDA1543 systems applications) but also from the programming side. For the first tim , author of the book showed in an open way a possibility of programming suchlike own devices basing ONLY on the C language without necessity to use just a one so called “assembler insert”. It is a big advantage because it allows practically to everybody , even a hobbyist to build own high quality audio player basing on small AVR microcontrollers. The book includes very interesting, practical examples with full source codes, descriptions and wide comments on a DVD. After two months our book was on the market many readers have already done practical exercises described in the book. We present below a simplify, schematic description of the module possibilities.
It is nice for us to present in this place also a special construction, an evaluation board to perform all the tests and to prototype own ideas and at the same time specially dedicated to our book: "C language Passion of 8-bit controllers programming". It has ATmega32 microcontroller buit-in (version with audio player only) or ATmega644PA (full version, player, WAV sound recorder). Also the kit is equipped with: TDA1543T (SMD version because of miniaturization), speaker / headphone amplifier circuit TDA1308 (SMD) and also two circuits of high quality operational amplifiers for audio purpose NE5532. One of them serves as a preamplifier for final speaker amplifier, the second one serves as microphone preamplifier. All is powered with 5V voltage in few options. Power supply options are related to a microphone preamplifier use. For sounds recording you should strictly separate gnd: analog and digital - what is provided in the PCB board construction but also a power supply. Therefore there is a need to use two LDO stabilizers type LM1117-5.0. Only this power configuration provides the ability to record the sound without any noises from the digital part of whole the system. We will be able to analyze this carefully on a scheme of the module.
As you can see in the scheme, the construction actually can be an evaluation kit not only for the use of the book's audio characteristics, but also for many other purposes. On the board we have a possibility to connect:
Bluetooth ATB-BTM-222 module for wireless communication
Infrared receiver TSOP 36kHz for a communication via IR remote
Temperature sensor 1wire DS18B20 type
LCD Alphanumeric displays (as a standard 2x16)
Relays or micro switches on I/O lines
POWER SUPPLY: because of rather high requirements related to power supply quality if you want to use the option of sound recording, the module can be powered in three different ways, depending on the needs. The first and the simplest version is designed for fast test of the device in case we do not have an optional equipment in the form of a special converter ATB-PWR3 with output voltage about +6,8V. Each variant of the power supply associates with proper SMD jumpers settings that are placed on a PCB board. However the setting mean that the SMD jumper you should just solder with a drop of tin or just to take the tin out by using e.g. braid. These operations should be performed very carefully to not overheat the SMD pads as it may cause their physical damage.
It assumes power supplying for the entire module with one well stabilized external voltage +5V which can be leaded directly to a screw connector located in the module. Unfortunately using such a solution and specially poor quality +5V external power supplies you shouldn’t expect the best parameters, of the sound either. You should take into account that on the power supply wire there may be some voltage drop, so the module with +4,5 V will work but we can hear sounds unpleasant to an ear, noise or buzzing in the speakers. It is recommended to use +5V power supply with current efficiency at least 600 mA in such case. Below we present a scheme drawing where you can exactly see which jumpers should be closed and which should not. In this variant we do not use any power supply converter and any linear stabilizers, that is why these elements are crossed out in the drawing with a red cross.
It assumes power supplying for the entire module of ATB-PWR3 converter with output voltage +5V. This option assure high power supply +5V quality to power the module and possibility to use a wide range of voltage on an input from+8V up to +20V. At the same time we can power the module from any, even non-stabilized power supplier. However the voltage must be straightened and we do not have to be afraid if it will be for sure +9V or +12V or e.g. +16V. But in this option we will still have some problem with a microphone sound recording quality. This variant is used by those who want to use this only for playing a sound. Each variant of power supply with ATB-PWR3 converter, enables the use of software power off to the module from the software level in microcontroller. It is of great importance when we are using the device with a battery power e.g. in the car (voice communicates). Thanks to it we can switch off the power remotely or automatically and at the same time we have discharge protection for the accumulator. Below we present a scheme drawing where you can exactly see which jumpers should be closed and which should not..
WARIANT III – correct quality of microphone sound recording.
It is an option that require complete separation of +5V Power into two independent branches. One to the digital art and the second one to the analog part. Only this configuration of power supply with proper analog ground distribution on a PCB allows for the best quality of sounds recorded by a condenser microphone connected to the module. On a PCB there must be two stabilizers LDO LM1117-5.0. To avoid an overheat of these stabilizers it is worth to power them with voltage not much higher than 5V. For this purpose we can use a special version of ATB-PWR3 converter with +6,8V output voltage or an external power supplier (preferably stabilized) about +7-8V. In this variant all the jumpers usually stay open (not soldered). Also this variant with the use of ATB-AWR3 allows you to control its power from the software level in a microcontroller. These options will be described in detail later in this article. See the picture below:
The ATB WAV Player Recorder module can support few different and optional I/O devices e.g. for remote communication, with wire and wireless, for infrared communication or for a data display on an alphanumeric LCD 2x16 display, compatible with HD44780 controller. Besides the module has both speakers outputs as there is a small power amplifier TDA 1308 but also and audio output with low power from the preamplifier NE5532. Also a microphone can be added and you can use any condenser microphone. Below we present a precise description of all connectors of the module.
For the player module you can easily connect the speakers singly (L and R channels) but you can also connect one speaker in the mono mode, it is just enough to connect its two wires to two end pins, so we will hear both, sound from the left and from the right channels if it is stereo.
Recording option uses and ADC digital-analog converter, built into the ATmega644PA microcontroller, working in one of selection mode. You can software configure the device to work in a 10 bit or 8 bit mode. All samples no matter 10 or 8 bit are software converted to 16 bits anyway because of DAC converter used (digital-analog) in the player. These are not all parameters you can configure regarding the quality of recording. We have namely a possibility for smooth adjustment of sampling rate from 3kHz up to 44 kHz! However you should remember that the SMD memory cards affects the sound quality. It is not about their model or a manufacturer but their speed class what connects with a possibility to get high transfers on SPI can, during sound recording writing in PCM (WAV) format on the card. By default the module settings are: sampling rate 9 kHz, (only mono sound), bites number in single sample 8 or 16 (8 by default) we can also set an ADC prescaler (16 by default). All mentioned parameters including memory card speed will have direct effect on recorded sound quality. It should also be mentioned that to get quit good sound quality having all the parameters set we should use CLASS 10 memory card. CLASS 8 or CLASS 4 or even slower cards (the oldest) will require to decrease the recording parameters. In sum we should select the parameters to our own needs taking into account the card type we have and target quality of recorded sounds.
The module has lead outs built in to connect 10 buttons which can directly play so called files with sounds effects. It means that on a memory card you should prepare a folder called “FX” and place 10 sound WAV files in it with these file names: 0.wav, 1.wav, 2.wav, 3.wav .....till the last one 9.wav. Each button pressing will cause immediately playing the last sound file. You can e.g. prepare the whole series of voice communicates to a car and connect a sensor instead of buttons. This way we can get voice communicates e.g. about doors are not closed, seat belts reminder and so on. It all depends on your own imagination. Of course if you install the module in a car electrical installation you should care about opto-isolation or a galvanic isolation of input signals as the buttons connectors are lead out directly from a microcontroller.
The module can be controlled from outside on many different ways.
The first, basic way is to use an infrared remote working in a RC5 standard. It lets to control the player, type: play/pause/stop/next to play sound WAV files from a memory card. Besides using a numeric keyboard we can also play particular sounds of effects assigned to particular buttons as it was described above in manual control section. During development of software for remote control there may new option show up. Meanwhile in a PC , if the module is also connected to the computer with wire or wireless, we can read codes of buttons we pressed on a remote and we can control some functions in the PC using the infrared, e.g. remote switching on, mute, selected functions activation etc.
RS232 / Bluetooth:
The module has got pins for RS232 communication in TTL standard (signals level 0-5V). Because wireless function is enable, there was used pins standard compatible with bluetooth module of the Atnel company, ATB-BTM-222. This kind of communication allows a much wider range of possibilities than in case of infrared. For that purpose we prepared two types of programs that let for full, remote operation not only of the player but also possibility fo remote configuration and files exploration on a SD memory card. The basic software was wrote for PC computers, and Windows operation system. The second application was for mobile phones and Android and Symbian systems. Applications for mobile phones currently offer a bit less possibilities than a PC program. Below you can see some screenshots from PC application thanks to which you can control the module remotely but also configure and read data from a remote and also capture in software an LCD screen and display own data on it even during music playing.
Software for a control and configuration for a PC
PC software is still developed and it is free for all owners of the modules and includes all updates. The same applies to Android application. Below a view of the first test application. The one for the Symbian is underway. Naturally mobile phones connections are done via Bluetooth using ATB-BTM-222 module.
Control application for mobile phones on android
Control via AT commands
You can use the methods of communications described above because the module allows for communication and control using typical AT commands. You can for a test you can give the commands even from a common terminal under any operation system e.g. Windows/Linux etc. Thanks to complete documentation of AT commands that serves to control the module, everyone who have it can write his own application that ontrol the module work just the way he wants. Thanks to it you can easily control the module from other microprocessor system. The possibility to use AT commands allows you to use this method of control and communication for BASCOM programmers. Below- full description implemented AT commands.
Transmission parameters: RS232: 115200, 8, n, 1
It can serve to check if the module works correct
echo turn OFF
echo turn ON
Module version information
Software restart (needed when we use a bootloader)
AT+PLAY=all – this version allows for playing in sequence all WAV files that are in a main folder of a memory card
AT+PLAY=file_name – enter a file name after “=” and you can play any WAV file that is on the memory card in any folder e.g. AT+PLAY=/FX/3.WAV
Pause file playing
Stop file playing
Start next file playing (if we earlier used a command AT+PLAY=all)
Download all files and folders list from a SD memory card
AT+FDEL=name – this way we can delete files or folders on a memory card givin a correct name to delete
Module power off (converter), if available
Set a bitrate – a parameter for sound recording via a microphone (by default 9000 Hz)
Start sound recording from a microphone to a file (look at: AT+GCFG)
Enter current sound file name
AT+ULCD=1 – LCD display control capture LCD, AT+ULCD=0 return LCD control to the module
AT+LGOTO=y,x - move the cursor to a specific location on the LCD
AT+LSTR=text_string – display any string (a text string) on the LCD
Delete LCD display content
This command lets us to read urrent configuration of the module AT+GCFG=? Read parameters show up as follows:
sample_rate, sample_bytes_cnt, preskaler_adc, auto_rec_filename, user_lcd , DEV_NAME
Set chosen prescaler ADC, permissible values 2,4,8,16,32,64,128 (by default 16)
Set bites number in a sample 8 or 16 (by default 8)
AT+ARECN=0 or 1 – set automatic name change of recorded file (by default = 0)
Below a life view on the AT commands during program operation in a TERMINAL tab.
A similar effect can be achieved by connecting to the module with a common terminal and giving AT commands manually.
KEYS TO CONTROL THE MODULE - PILOT RC5
Below we present a picture, in which you can see keys of the RC5 remote assigned in microcontroller software, that are used for basic module operation.
Map of keys of RC5 infrared remote for control of the module
SOUND FILES CONVERSION INTO *.WAV
An important element in the procedure described of the module start up is sound files conversion into correct WAV format. You can find many programs for conversion files: mp3, flac, ogg, wma, aac etc. into WAV files. One of worth – recommending is "Nero WAV Editor". You should open in this program the sound file you want to convert and select proper parameters related to sampling rate to write it in WAV format. You should remember that the module will not be able to play WAV files if it will be files with sampling rate 44 kHz ! (stereo). Such files you should convert to sampling rate 22,050 kHz. Below you cans see example picture with conversion settings for the module.
WAV conversion in Nero WAV Editor
The fact that the module can’t handle with WAV files and 44kHz sampling is related to too low clock rate of the microcontroller, only 20 MHz. To enable playing of this files (actually all that are typically available on a PC) you should increase the clock rate of microcontroller to 27MHz. If a user will replace a crystal oscillator with a bigger one then he can ask our company for a batch to the microcontroller prepared for such frequency. You should also remember that if you convert a file that has 44kHz sampling and we decrease channel number from two (stereo) to one (mono) and bites number in the sample from 16 to 8, the file will be played even of it has factory-installed crystal oscillator 20 MHz. For comparison, playing the mono sound at 44 kHz sampling with 16 bits samples requires minimum clock rate 24 MHz. In the cases above we are overclocking the microcontroller but it has no influence on its lifetime or a possibility to damage. The only side effect can be improper working while internal EEPROM using.
The module can be operated using simple, described commands, successfully with any microcontroller, programming language even a BASCOM. Below we present a possibility to send AT commands to the module using the Bascoma. It is just about simple command “Print” after which, in quotation marks we enter command according to description from the table above. You should only remember to select proper clock rate to get correct transmission speed 115200 bps. For that purpose as you can see below we used external crystal oscillator11,0592 MHz and we configured the speed 115200. You should remember that clocking selection in a form of external crystal oscillator you should do by settings of proper Fuse-bits in a microcontroller.. For better cooperation with the module we recommend using external oscillator but clock rate values may be different. It is worth to select the oscillator “RS232 friendly” with values e.g. 1,8432 MHz, 3,6864 MHz, 7,3728 MHz, 11,0592 MHz, 14,7456 MHz or 18,432MHz.
Example use of BASCOM environment to control the module.
Print"AT+PLAY=demo.wav"' play demo.wav file Print"AT+NEXT"' play next WAV file Print"AT+STOP"' stop playing Print"AT+PAUSE"' pause Print"AT+ATI"' download information about the device
Attention! A batch uploaded to the processor is only for commercial use and that is why when we launch the device we can here from the speakers www.atnel.pl. The next thing is to necessarily place in a main folder, two files that you can find below zipped (ZIP).
ATNEL Modern Solutions - programowanie AVR w C | pisanie programów dla AVR | pisanie programów ATmega | pisanie programów dla AVR | programowanie mikrokontrolerów | mikrokontrolery AVR programowanie | programowanie w C mikrokontrolerów | programowanie ATmega | programy w C AVR
Realization: Dpl Agency - Tworzenie Stron Internetowych