Discover how our multi-message record and playback device can bring your memories to life through customizable voice recordings
A
A
Hardware Overview
How does it work?
Rec&Play Click is based on the ISD3900, a multi-message record and playback device with ChipCorder® technology, from Nuvoton. Thanks to the many useful features it offers, this IC gained its popularity very quickly. Besides several compression and de-compression CODEC, it features a fully programmable signal path with the support for several different signal types, allowing a very simple design for any kind of message-based application. Sound notification from a POS terminal, a home appliance that uses voice to notify about some event, even a Dictaphone-like device, it can all be implemented very quickly with this Click board™. Instead of using memory locations, ISD3900 allows using message indices: once stored, a message can be invoked using its index. Building of macro scripts (Voice Macros) is also possible. To allow the out-of-box functionality, the Click board™ is equipped with a small omnidirectional electret microphone, along with a miniature 8Ω speaker. The microphone is can capture a sound or voice recording. The recording can be reinforced by applying the Automatic Gain Control (AGC), which dynamically changes the input gain, helping to obtain the most appropriate signal level. The AGC function, along with many other functions, can be configured over the SPI interface. The miniature neodymium speaker (internal speaker) measures only 15 x 11mm, and it is designed to output up to 0.7W of continuous
power. It is driven by the ISD3900 IC, which integrates a small 0.5W class D amplifier. The internal speaker has an adhesive on its rims, allowing it to be easily mounted inside a small resonant box, which can reinforce its output. However, this speaker is good only when used indoors. 2-pole terminal labeled as EXT SPK allows an external passive speaker box to be connected. When the SPK SEL is moved to the EXT position, the output of the internal class D amplifier becomes routed to this connector, instead of the internal speaker. A differential BTL (Bridge-Tied Load) output is also available over the EXT SPK connector, allowing an external amplifier with differential inputs to be used. AUX IN and AUX OUT are 3.5mm jack connectors, used to connect line-level input and output signals. The AUX OUT connector offers a single-sided line-level output, compatible with most of the commercial amplifiers, active desktop speakers, sound monitors, etc. The AUX IN is a single-sided line-level input, allowing to capture sound from a home PC, TV set, MP3 player, and any other device equipped with the line-out connector. The audio sample rate is derived from an external crystal oscillator, rated at 4.096MHz. This crystal oscillator allows the master sample rate up to 32kHz. Lower sample rates can also be used, resulting in reduced sound quality. Besides the sample rate, the sound quality is also affected by the used
compression algorithm. ISD3900 supports many different CODECs. For more information, please refer to the ISD3900 IC datasheet. Besides the ISD3900 this Click board™ contains another IC: it is a non-volatile memory module labeled as W25Q64, a 64 Mbit serial Flash memory from Winbond. This memory module has a 64 Mbit density arranged in 8-bit words, allowing up to 32 minutes of audio to be stored. The ISD3900 has a set of registers that control every aspect of the device: the entire sound path can be configured by writing to the proper config registers over the SPI interface. The ISD3900 also handles Flash-related commands, such as formatting, erasing, reading, writing, and more. Although simplified, programming the ISD3900 can seem complex, but when used within the MIKROE environment, it is very easy to operate the Click board™. It is supported by the mikroSDK compatible library, which contains functions for accelerated software development. Several pre-configured sound path settings are available, saving valuable time. This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, it comes equipped with a library containing functions and an example code that can be used as a reference for further development.
Features overview
Development board
PIC18F47K42 Curiosity Nano evaluation kit is a cutting-edge hardware platform designed to evaluate the PIC18F47K42 microcontroller (MCU). Central to its design is the inclusion of the powerful PIC18F47K42 microcontroller (MCU), offering advanced functionalities and robust performance. Key features of this evaluation kit include a yellow user LED and a responsive mechanical user switch
providing seamless interaction and testing. The provision for a 32.768kHz crystal footprint ensures precision timing capabilities. With an onboard debugger boasting a green power and status LED, programming and debugging become intuitive and efficient. Further enhancing its utility is the Virtual serial port (CDC) and a debug GPIO channel (DGI GPIO), offering extensive connectivity options.
Powered via USB, this kit boasts an adjustable target voltage feature facilitated by the MIC5353 LDO regulator, ensuring stable operation with an output voltage ranging from 2.3V to 5.1V (limited by USB input voltage), with a maximum output current of 500mA, subject to ambient temperature and voltage constraints.
Microcontroller Overview
MCU Card / MCU
Architecture
PIC
MCU Memory (KB)
128
Silicon Vendor
Microchip
Pin count
40
RAM (Bytes)
8192
You complete me!
Accessories
Curiosity Nano Base for Click boards is a versatile hardware extension platform created to streamline the integration between Curiosity Nano kits and extension boards, tailored explicitly for the mikroBUS™-standardized Click boards and Xplained Pro extension boards. This innovative base board (shield) offers seamless connectivity and expansion possibilities, simplifying experimentation and development. Key features include USB power compatibility from the Curiosity Nano kit, alongside an alternative external power input option for enhanced flexibility. The onboard Li-Ion/LiPo charger and management circuit ensure smooth operation for battery-powered applications, simplifying usage and management. Moreover, the base incorporates a fixed 3.3V PSU dedicated to target and mikroBUS™ power rails, alongside a fixed 5.0V boost converter catering to 5V power rails of mikroBUS™ sockets, providing stable power delivery for various connected devices.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output
After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.
After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.
Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.
Software Support
Library Description
This library contains API for Rec&Play Click driver.
Key functions:
recplay_read_status
- Function queries the ISD3900 device statusrecplay_erase_msg
- Function erases the message starting at the specified addressrecplay_record_msg
- Function initiates a managed record at first available location in memory
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* \file
* \brief RecNPlay Click example
*
* # Description
* This application demonstrates the processof recording a message and playing it back.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes SPI interface in proper mode and performs all the necessary commands to
* put the device in proper working mode (chip reset, chip power up, chip erasing, clock configuration).
*
* ## Application Task
* Performs the chip configuration for recording message via microphone, then records a message
* for 8 seconds to specified memory location. After that, it reads the recorded message address with message length and then plays the
* recorded message. When playback is done it erases the recorded message from memory. Afterwards, it repeats all the operations every 10 seconds.
*
* *note:*
* The ISD3900 must be properly configured to work in record mode every time when user wants to record a message.
* When user wants to play a recorded message, then ISD3900 must be properly configured, but now to work in play mode.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "recnplay.h"
// ------------------------------------------------------------------ VARIABLES
static recnplay_t recnplay;
static log_t logger;
static uint32_t msg_addr;
static uint16_t msg_len;
static uint8_t temp_var;
static uint8_t volume;
static RECNPLAY_RETVAL status_byte;
static uint8_t interr_byte;
static const uint8_t config_play_pwm_spk[ 32 ] = { 0x64, 0x00, 0x44, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x57, 0x01, 0x57, 0x00, 0x00, 0xFF, 0x30, 0x02, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 };
static const uint8_t config_play_aux_out[ 32 ] = { 0x64, 0x00, 0x48, 0x00, 0x40, 0x80, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x57, 0x01, 0x57, 0x00, 0x00, 0xFF, 0x30, 0x02, 0xAB, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 };
static const uint8_t config_rec_mic[ 32 ] = { 0xA4, 0x80, 0x02, 0xFF, 0x0D, 0x40, 0x50, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x3E, 0x00, 0xD6, 0x00, 0xFF, 0xFF, 0x11, 0x82, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 };
// ------------------------------------------------------- ADDITIONAL FUNCTIONS
void wait_cmd_fin ( void )
{
status_byte = recplay_read_status( &recnplay, &interr_byte );
while ( ( interr_byte != RECPLAY_INT_CMD_FIN_MASK ) ||
( status_byte != ( RECPLAY_STAT_DBUF_RDY_MASK | RECPLAY_STAT_INT_GEN_MASK ) ) )
{
status_byte = recplay_read_status( &recnplay, &interr_byte );
}
status_byte = recplay_read_interr( &recnplay, &interr_byte );
}
void wait_ready ( void )
{
status_byte = recplay_read_status( &recnplay, &interr_byte );
while ( status_byte != RECPLAY_STAT_DBUF_RDY_MASK )
{
status_byte = recplay_read_status( &recnplay, &interr_byte );
}
status_byte = recplay_read_interr( &recnplay, &interr_byte );
}
void wait_power_up ( void )
{
status_byte = recplay_read_status( &recnplay, &interr_byte );
while ( status_byte == RECPLAY_STAT_PWR_DOWN_MASK )
{
status_byte = recplay_read_status( &recnplay, &interr_byte );
}
status_byte = recplay_read_interr( &recnplay, &interr_byte );
}
void time_record ( uint32_t seconds_time )
{
uint8_t cnt;
for ( cnt = 0; cnt < seconds_time; cnt++ )
{
Delay_ms( 1000 );
log_printf( &logger, "." );
}
}
void set_volume ( uint8_t volume_sel )
{
uint16_t volume_res;
if ( volume_sel > 100 )
{
volume = 0;
log_printf( &logger, "Volume is: 100%\r\n" );
return;
}
volume_res = 255 * volume_sel;
volume_res /= 100;
volume = 255 - volume_res;
log_printf( &logger, "Volume is: %u%%\r\n", ( uint16_t ) volume_sel );
}
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
recnplay_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
recnplay_cfg_setup( &cfg );
RECNPLAY_MAP_MIKROBUS( cfg, MIKROBUS_1 );
recnplay_init( &recnplay, &cfg );
log_printf( &logger, "Chip reset...\r\n" );
recplay_reset( &recnplay );
log_printf( &logger, "Power up...\r\n" );
recplay_pwr_up( &recnplay );
wait_power_up( );
log_printf( &logger, "Chip Erasing...\r\n" );
recplay_erase_chip( &recnplay );
wait_cmd_fin( );
log_printf( &logger, "Clock Configuration...\r\n" );
status_byte = recplay_set_clk_cnfg( &recnplay, 0x34 );
log_printf( &logger, "----------------------------\r\n" );
volume = 0;
Delay_ms( 1000 );
}
void application_task ( void )
{
uint8_t cnt;
log_printf( &logger, "Preparing to record a message\r\n" );
for ( cnt = 0; cnt < 32; cnt++ )
{
if ( ( cnt != RECPLAY_CFG0A_REG ) && ( cnt != RECPLAY_CFG1C_REG ) && ( cnt != RECPLAY_CFG1E_REG ) )
{
wait_ready( );
temp_var = config_rec_mic[ cnt ];
status_byte = recplay_write_cnfg_reg( &recnplay, cnt, &temp_var, 1 );
}
}
wait_ready( );
Delay_ms( 2000 );
log_printf( &logger, "Message recording" );
status_byte = recplay_record_msg_addr( &recnplay, 0x12000 );
time_record( 8 );
status_byte = recplay_stop( &recnplay );
wait_cmd_fin( );
log_printf( &logger, "End of recording\r\n" );
status_byte = recplay_read_msg_addr( &recnplay, &msg_addr, &msg_len );
log_printf( &logger, "Message Address: 0x%lx\r\n", msg_addr );
log_printf( &logger, "Message Length: %u\r\n", msg_len );
Delay_ms( 1000 );
log_printf( &logger, "Preparing to play a message\r\n" );
set_volume( 100 );
for ( cnt = 0; cnt < 32; cnt++ )
{
if ( ( cnt != RECPLAY_CFG0A_REG ) && ( cnt != RECPLAY_CFG1C_REG ) && ( cnt != RECPLAY_CFG1E_REG ) )
{
wait_ready( );
if ( cnt == RECPLAY_CFG03_REG )
{
temp_var = volume;
}
else
{
temp_var = config_play_pwm_spk[ cnt ];
}
status_byte = recplay_write_cnfg_reg( &recnplay, cnt, &temp_var, 1 );
}
}
wait_ready( );
Delay_ms( 2000 );
log_printf( &logger, "Message is playing...\r\n" );
status_byte = recplay_play_msg( &recnplay, 0x12000, 0 );
wait_cmd_fin( );
log_printf( &logger, "End of playing...\r\n" );
log_printf( &logger, "Status Byte: 0x%x\r\n", ( uint16_t ) status_byte );
log_printf( &logger, "Interrupt byte: 0x%x\r\n", ( uint16_t ) interr_byte );
Delay_ms( 1000 );
log_printf( &logger, "Message erasing...\r\n" );
status_byte = recplay_erase_msg( &recnplay, 0x12000 );
wait_cmd_fin( );
log_printf( &logger, "End of erasing\r\n" );
log_printf( &logger, "----------------------------\r\n" );
Delay_ms( 1000 );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END