搜索代码

Arduino Code and Video: ISD1820 Arduino Voice Recorder

Arduino Code and Video: ISD1820 Arduino Voice Recorder

The ISD1820 is a simple voice recorder module that allows you to record and playback audio using an Arduino. In this tutorial, you will learn how to set up the ISD1820 with an Arduino to record up to 20 seconds of sound and play it back on command. This project is perfect for beginners looking to explore audio processing with Arduino.

isd1820 voice recording module

Throughout this tutorial, you'll find key identifiers that are used in the code, such as REC, PLAY_E, and PLAY_L. These identifiers correspond to the pins used for recording and playback functions. Additionally, the code snippets provided will help clarify the programming logic behind this project. For a more detailed explanation, be sure to check the video at (in video at 00:00).

Hardware Explained

The main component of this project is the ISD1820 voice recorder module, which can record audio for up to 20 seconds. It features several pins for controlling recording, playback, and feed-through functions. The module operates on a supply voltage of 3V to 4.5V, making it compatible with most Arduino boards.

In addition to the ISD1820 module, you will need an Arduino board, a speaker, and a microphone. The Arduino will control the recording and playback functions through digital pins. The module's operation is straightforward: it records audio when the record pin is set high and plays audio when the playback pins are activated.

Datasheet Details

ManufacturerISD1820
Part numberISD1820
Logic/IO voltage3.3 V typ.
Supply voltage3.0 V to 4.5 V
Idle current0.5 µA typ.
Operating current30 mA max.
Recording time20 sec max.
Playback time20 sec max.
Package8-DIP

  • Ensure the supply voltage is between 3.0 V and 4.5 V to avoid damaging the module.
  • Use resistors to shift the 5V Arduino signal to the 3.3V logic level for safe interfacing.
  • Monitor current consumption; the module can draw up to 30 mA during operation.
  • Connect a low-power speaker (0.5 W) to the audio output for playback.
  • The module supports various recording lengths; adjust timing based on your needs.

Wiring Instructions

Arduino wiring for ISD1820 voice_recorder
Arduino wiring for ISD1820 voice_recorder

To wire the ISD1820 to your Arduino, start by connecting the module's VCC pin to the 3.3V output on the Arduino. Next, connect the GND pin of the module to one of the Arduino's ground pins. For the control pins, connect the module's REC pin to Arduino pin 2, PLAY_E to pin 3, PLAY_L to pin 4, and FT to pin 5.

Since the Arduino operates at 5V, you will need to use a voltage divider to safely connect the control pins. For example, connect a 5 kΩ resistor from the Arduino's pin to the control pin on the module, and then connect a 3.3 kΩ resistor from the module control pin to ground. Repeat this process for any additional control pins to ensure they receive the correct voltage levels.

Code Examples & Walkthrough

The following code snippet defines the pins used for recording and playback. This allows you to easily reference these pins in your code rather than using hardcoded values.

#define REC 2 // pin 2 is used for recording
#define PLAY_E 3 // pin 3 is used for playback-edge trigger
#define PLAY_L 4 // pin 4 is used for playback

In the setup function, we initialize the pins as outputs. This ensures that the Arduino can control the ISD1820 module effectively.

void setup() 
{
  pinMode(REC, OUTPUT); // set the REC pin as output
  pinMode(PLAY_L, OUTPUT); // set the PLAY_L pin as output
  pinMode(PLAY_E, OUTPUT); // set the PLAY_E pin as output
}

The main loop checks for user input from the serial monitor. Depending on the character received, it will trigger the appropriate actions, such as recording or playing back audio.

void loop() {
  while (Serial.available() > 0) {
    char inChar = (char)Serial.read();
    if (inChar == 'p' || inChar == 'P') {
      digitalWrite(PLAY_E, HIGH); // Start playback
      delay(50);
      digitalWrite(PLAY_E, LOW); // Stop playback
    }
}

This conditional structure allows for flexible control of the ISD1820 based on user input, making it easy to record and playback audio as needed. For further details, the full code loads below the article.

Demonstration / What to Expect

Once everything is set up and the code is uploaded, you should be able to record audio by sending the r command via the serial monitor and playback using the p command. The expected behavior includes a response in the serial monitor indicating when recording starts and stops, as well as when playback begins and ends. Keep in mind the timing set in the code; for instance, recording is set for 3 seconds, and playback for 5 seconds (in video at 05:00).

图像

Arduino wiring for ISD1820 voice_recorder
Arduino wiring for ISD1820 voice_recorder
isd1820 voice recording module
isd1820 voice recording module
isd1820 voice recording module
isd1820 voice recording module
isd1820 voice recording module
isd1820 voice recording module
72-This is the Arduino code and video: ISD1820 Arduino Voice Recorder
语言: C++
/*
 * ISD1820 Arduino Voice Recorder
 * to record and playback sound using Arduino and ISD1820 Sound Recorder

 * Watch the video https://youtu.be/IfK8z_o5vbk
 * get this code from https://robojax.com
 * Get this code and other Arduino codes from Robojax.com/RJT58
 
Learn Arduino step by step in a structured course with all material, wiring diagrams, and libraries
all in one place. 

/*
 * ISD1820 Arduino Voice Recorder
 * Code Written by Ahmad Shamshiri for Robojax.com
 * on Jan 04, 2018 at 08:57, in Ajax, Ontario, Canada
  * Permission granted to share this code given that this
 * note is kept with the code.
 * Disclaimer: This code is "AS IS" and for educational purposes only.
 */
#define REC 2 // pin 2 is used for recording
#define PLAY_E 3 // pin 3 , P-E is used for playback-edge trigger
// when PLAY_E goes HIGH, playback STARTS and continues
// ISD1820 Arduino Voice Recorder for Robojax.com 

#define PLAY_L 4 // pin 4 , P-Lis used for playback  
// when PLAY_L is HIGH, it will playback. As soon as it goes LOW, playback STOPS
// So you have to keep it HIGH to keep playing


#define FT 5 // pin 5 is used for feed through
// if the SPI (speaker) pin is used to send audio to another device, 
// set FT to high and any audio from the microphone will pass through the SPI connector
// and will NOT record

#define playTime 5000 // playback time 5 seconds
#define recordTime 3000 // recording time 3 seconds
#define playLTime 900 // press and release playback time 0.9 seconds

void setup() 
{
  // ISD1820 Arduino Voice Recorder for Robojax.com 
  pinMode(REC,OUTPUT);// set the REC pin as output
  pinMode(PLAY_L,OUTPUT);// set the PLAY_L pin as output
  pinMode(PLAY_E,OUTPUT);// set the PLAY_e pin as output
  pinMode(FT,OUTPUT);// set the FT pin as output  
  Serial.begin(9600);// set up Serial monitor   
}

void loop() {
  // ISD1820 Arduino Voice Recorder for Robojax.com 
    while (Serial.available() > 0) {
          char inChar = (char)Serial.read();
            if(inChar =='p' || inChar =='P'){
            digitalWrite(PLAY_E, HIGH);
            delay(50);
            digitalWrite(PLAY_E, LOW);  
              Serial.println("Playback Started");  
            delay(playTime);
            
              Serial.println("Playback Ended");
            break; 
            }// if          
            else if(inChar =='r' || inChar =='R'){
              digitalWrite(REC, HIGH);
              Serial.println("Recording started");
              delay(recordTime);
              digitalWrite(REC, LOW);
              Serial.println("Recording Stopped ");              
            } 
            else if(inChar =='l' || inChar =='L'){
            digitalWrite(PLAY_L, HIGH); 
              Serial.println("Playback L Started");  
            delay(playLTime);
            digitalWrite(PLAY_L, LOW);
              Serial.println("Playback L Ended");            
            }             
    // ISD1820 Arduino Voice Recorder for Robojax.com         
      Serial.println("**** Serial Monitor Exited");      
    }// wihile
Serial.println("**** Enter r to record, p to play");

  delay(500);
}

|||您可能需要的东西

资源与参考

尚无可用资源。

文件📁

Fritzing 文件