[Diao Ye learns programming] Arduino hands-on (31)---ISD1820 recording and playback voice module 3

The reference to 37 sensors and modules has been widely circulated on the Internet. In fact, there must be more than 37 sensor modules compatible with Arduino. In view of the fact that I have accumulated some sensor and actuator modules on hand, according to the concept of true knowledge (must be hands-on), for the purpose of learning and communication, here I am going to try and do more experiments one by one.

[Arduino] 168 kinds of sensor module series experiments (data code + simulation programming + graphics programming)
Experiment 31: ISD1820 recording voice module 8-20 seconds voice module megaphone module onboard microphone 0.5W speaker

insert image description here
ISD1820 Voice 20-second recording and playback module experiment hardware list Laser
head transmitting module X1
Laser head receiving module X1
8 ohms 0.5 watts small speaker X1
Infrared photoelectric obstacle avoidance module X1
Arduino Uno development board X1
DuPont lines (9 pieces prepared)
HC-SR04 ultrasonic distance measuring module X1
IIC/I2C 1602 LCD LCD screen module X1
ISD1820 voice 20-second recording and playback module X1
LED light-emitting diode (green, blue) X 2
Proto Shield prototype expansion board (with mini breadboard) X1

insert image description here
Software platform required for sensor module experiments
Code programming Arduino IDE (version 1.8.19)
simulation programming Linkboy (version V4.6.3)
graphics programming Mind+ (version V1.7.0 RC2.0)
and learning while editing (online platform https://ide.codepku.com/?type=Arduino)

Wiring diagram of Arduino experiment

insert image description here

Program 5: Human body infrared SR-501 intrusion LED voice alarm
Experiment open source graphics programming (Mind+, edit and learn by playing)

insert image description here

Experimental serial port return

insert image description here

Arduino experiment scene diagram

insert image description here

Procedure 6: Infrared photoelectric obstacle avoidance module human voice prompter
Experimental wiring diagram (the actual wiring has been adjusted)

insert image description here

[Arduino] 168 sensor module series experiments (data code + simulation programming + graphics programming)

Experiment 31: ISD1820 recording voice module 8-20 seconds voice module megaphone module onboard microphone 0.5W speaker

Program 6: Infrared photoelectric obstacle avoidance module with human voice prompter

Arduino experiment open source code

/*
  【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  程序六:红外光电避障模块有人语音提示器
*/


#define IR  8 //外光电避障模块接D8
#define REC 3//录音接脚D3

#define PLAYE 4//播放接脚D4
#define PLAYL 5

void setup(){
    
    
 pinMode(IR, INPUT);//设置外光电避障模块为输入
 pinMode(REC, OUTPUT);//录音为输出
 pinMode(PLAYE, OUTPUT);//播放为输出

 Serial.begin(9600);
}

void loop(){
    
    
 int i = digitalRead(IR);//读取外光电避障模块的值
 if(i == 0)
 {
    
    
   Serial.println("有人来了!!");
   digitalWrite(REC, 1);//开始录音

   delay(10000);
   digitalWrite(REC, 0);
    delay(1000);
    digitalWrite(PLAYE, 1);//开始播放
   delay(10000);
   digitalWrite(PLAYE, 0);
 }
}

Experimental serial port return

insert image description here
Arduino experiment scene diagram

insert image description here

[Arduino] 168 sensor module series experiments (data code + simulation programming + graphic programming)
experiment 31: ISD1820 recording voice module 8-20 seconds voice module megaphone module onboard microphone 0.5W speaker
program 7: laser voice broadcast doorbell
Arduino reference open source code

/*
  【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  程序七:激光语音播报门铃
*/


int Laser = 6;//激光头接D6
int Detector = 7;//接收器接D7
int Play = 4;//录音播放接4

void setup() {
    
    
  Serial.begin (9600);
  pinMode(Laser, OUTPUT);//激光为输出
  pinMode(Detector, INPUT);//接收器为输入
  pinMode(Play, OUTPUT);//播放器为输出
}

void loop() {
    
    
  digitalWrite(Laser, HIGH);
  boolean val = digitalRead(Detector);
  Serial.println(val);
  if (val == 0)
  {
    
    
    digitalWrite(Play, HIGH);//语音播放2秒
    Serial.println("有人来了!");
    delay(2000);
  }
  else
  {
    
    
    digitalWrite(Play, LOW);
  }
}

Experimental serial port return

insert image description here
Arduino experiment scene diagram

insert image description here

[Arduino] 168 sensor module series experiments (data code + simulation programming + graphics programming)

Experiment 31: ISD1820 recording voice module 8-20 seconds voice module megaphone module onboard microphone 0.5W speaker

Program 8: Message machine with LCD1602 liquid crystal display

Arduino experiment open source code

/*
  【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
  程序八:带LCD1602液晶显示屏的留言机
*/

#include <LiquidCrystal_I2C.h>  //液晶显示屏库
LiquidCrystal_I2C mylcd(0x27, 16, 2); //建立液晶显示对象,传递地址、字符、行数参数初始化

void setup() {
    
    
  pinMode(4, INPUT);  //按键录音
  pinMode(3, OUTPUT);//ISD1820的REC端口
  pinMode(5, INPUT);//按键放音
  pinMode(2, OUTPUT);//ISD1820的P-l端口
  mylcd.init();//初始化LCD显示屏
  mylcd.backlight();//打开背光
  mylcd.clear();//清屏
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
}

void loop() {
    
    
  if (digitalRead(4) == HIGH) {
    
    
    //按下按键开始录音,显示屏显示字符
    while (digitalRead(4) == HIGH) {
    
     //”writing the voice....”
      mylcd.setCursor(1 - 1, 1 - 1);
      mylcd.print("writing the ");
      mylcd.setCursor(1 - 1, 2 - 1);
      mylcd.print("voice....");
      digitalWrite(3, HIGH);
    }
    digitalWrite(3, LOW);
    while (digitalRead(5) == LOW) {
    
    
      //松开按键显示字符“have messages to listen”
      mylcd.setCursor(1 - 1, 1 - 1);
      mylcd.print("have messages");
      mylcd.setCursor(1 - 1, 2 - 1);
      mylcd.print("to listen.");
      if (digitalRead(5) == HIGH) {
    
    
        break;
      }
    }
    delay(50);
  }
  else {
    
    
    digitalWrite(3, LOW);
    mylcd.clear();
    mylcd.setCursor(1 - 1, 1 - 1);
    mylcd.print("answer maching");

  }

  if (digitalRead(5) == HIGH) {
    
     //按下按键放音,显示屏显示字符“reading  the voice......”
    while (digitalRead(5) == HIGH) {
    
    
      mylcd.setCursor(1 - 1, 1 - 1);

      mylcd.print("reading  the ");
      mylcd.setCursor(1 - 1, 2 - 1);
      mylcd.print("voice......");
      digitalWrite(2, HIGH);
      digitalWrite(3, LOW);
    }
  }
  else {
    
    
    mylcd.setCursor(1 - 1, 1 - 1);
    mylcd.print("answer maching");
    digitalWrite(2, LOW);
  }
}

Arduino experiment scene diagram

insert image description here
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/weixin_41659040/article/details/131821303