[Diao Ye learns programming] Arduino hands-on (212) --- 9-in-1 expansion board to complete Arduino's 10th expansion experiment DFPlayer Mini TF card MP3 player module

insert image description here

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 sensors and modules on hand, according to the concept of practice (hands-on try), for the purpose of learning and communication, I am going to do experiments one by one here, and will record them regardless of whether they are successful or not. It is a difficult problem, and I hope to be able to throw bricks and spark jade.

[Arduino] 168 kinds of sensor module series experiment (data code + simulation programming + graphics programming)
experiment 212: 9 in 1 multi-function expansion board DHT1 device temperature and humidity LM3 temperature 5 buzzer 1 compatible with UNO

insert image description here

Take the combination of "Arduino program code" + "Mind + graphics programming" + "Linkboy simulation programming"

Complement each other, lay a solid foundation, and promote understanding

insert image description here

Experiment catalog (Arduino hands-on)
1. LED experiment
01 Blink: D13 blue LED blinks
02 Blink2: D12, D13 red and blue LEDs blink alternately
03 Blink3: Simulate flashing alarm light
04 Breath_LED: D9 full-color LED simulates red breathing light
2. Button experiment
05 Button: D2 button controls D13 blue LED
06 Button_Lock: D3 button controls D13 blue LED self-locking experiment
3. Potentiometer experiment
07 RS232_AD: serial port reads A0 potentiometer to collect value (rotation angle 270° output 0 -3.3V/5V voltage signal potentiometer resistance value 10K)
08 Rotation_LED: A0 potentiometer controls D11 full-color LED blue terminal brightness
09 RC_Motor: A0 potentiometer controls the steering gear at the output port of D7 to control its rotation angle (the steering gear needs to be automatically Arduino needs external power supply)
4. RGB full-color LED experiment
10 LED_RGB_Text: full-color LED basic color change
11 LED_RGB: full-color LED rainbow change
5. Infrared sensor D6 experiment (infrared remote control needs to be prepared by yourself)
12 IRrelay: press infrared remote control Any key of the device can control the D13 LED switch (control distance 1-8 meters, frequency 38KHz, compatible with most infrared remote controls on the market)
13 IRrecord: The serial port displays the read infrared remote control code
6. Temperature sensor experiment
14 LM35_RS232AD: The serial port
displays the temperature read by the LM35 temperature sensor on the A2 port (it can test the indoor and outdoor temperature, the range is -50-150°C, and the sensitivity is good).
Taken temperature and humidity data (temperature measurement range 0-50°C, humidity range 20%-90%PH)
8. Brightness sensor experiment
16 Light Sensor: serial port displays the value collected by the photoresistor of port A1
17 Light_LED: control of the photoresistor of port A1 D13 LED switch (sensitive to light, suitable for teaching experiments and civilian equipment)
9. Buzzer experiment
18 Buzzer: D5 port passive buzzer to simulate an ambulance siren (can make simple music sounds, music needs to be programmed)
10 , Extended experiment
19 Analog ultrasonic ranging sensor (detection type I, IIC/I2C interface)
20 Bus DS18B20 temperature sensor (numeric type, connected to the digital D7 interface of the expansion board)
21 TM1637 four-digit digital tube (digital tube and dot matrix type, connected to Expansion board digital D7/D8 interface)
22 GY-BMP280-3.3 Atmospheric pressure altimeter sensor module (numeric type, IIC/I2C interface)
23 GY-NEO-6MV2 new flight control GPS satellite signal receiving module (numeric type, TTL interface)
24 5V low-level trigger single-channel relay module (executive type, digital D7 interface)
25 4-wire sound sensor module with electret microphone (trigger type, digital D7 interface)
26 BH1750FVI digital light intensity module light sensor (numeric type, IIC/ I2C interface)
27 Open source DFPlayer Mini TF card MP3 player module (output actuator type D7/D8 digital interface)
28 LCD1602 LCD screen module (output display type, IIC/I2C interface)
29 Human body infrared pyroelectric motion sensor module (trigger type, digital D7 interface)
30 DS1307 clock module Tiny RTC I2C module (detection sensor type, IIC/I2C interface)
31 compatible HC-06 slave Bluetooth module (communication and storage type, TTL interface)
32 0.96 inch OLED12864 LCD screen module (display type, IIC interface)

insert image description here

10. Extended experiment
27 Open source DFPlayer Mini TF card MP3 player module (output actuator type D7 digital interface)

Knowledge point: YX5200-24SS chip
is an MP3 chip that provides serial ports, and perfectly integrates hard decoding of MP3 and WMV. At the same time, the software supports TF card driver and USB driver, as well as external FLASH. Support FAT16, FAT32 file system. It can play the specified music and how to play the music through simple serial port commands, without cumbersome bottom-level operations, easy to use, stable and reliable are the biggest features of this product.

insert image description here
YX5200-24SS serial voice chip parameters
MP3 file format: support all bit rates 11172-3 and ISO13813-3layer audio decoding, sampling support (KHZ): 8/11.025/12/16/22.05/24/32/44.1/48 , support Normal, Lazz, Classic, Pop, ROCK, etc.
USB interface: 2.0 standard
UART interface: standard serial port, TTL level, baud rate can be set
Input voltage: 3.3-5V
Rated current: 15ma (without U disk)
Size: 8.4*8mm
package: SSOP24 package
Operating temperature: -40 degrees -80 degrees
Humidity: 5%-95%.

Features
1. Support sampling rate (KHz): 8/11.025/12/16/22.05/24/32/44.1/48 2. 24-
bit DAC output, dynamic range support 90dB, signal-to-noise ratio support 85dB
3. Fully support FAT16 , FAT32 file system, maximum support 32G TF card and U disk
4, multiple control modes, parallel port control mode, serial port mode, button control mode
5, radio language insertion function, you can pause the background music being played
6, audio data press Folder sorting , support up to 100 folders, each folder can be assigned
1000 songs Adjustable volume, 10 kinds of EQ adjustable 11, support external expansion NORFLASH and NANDFLASH. Onboard supports NORFLASH by default



insert image description here
Mini MP3 Player player module

It is a small and cheap MP3 module that can be directly connected to speakers. The module can be used alone with the power supply battery, speaker, and buttons, or it can be controlled through the serial port as a module of UNO or any single-chip microcomputer with a serial port. The module itself perfectly integrates hard decoding of MP3, WAV, WMA. At the same time, the software supports TF card driver and supports FAT16 and FAT32 file systems. Playing the specified music and how to play music can be completed through simple serial port instructions, without cumbersome bottom-level operations, easy to use, stable and reliable.

insert image description here
insert image description here

Module Pin Diagram
Pin No. Pin Name Function Description Remarks
1 BUSY Output high level when playing, stop as low busy signal
2 RX UART asynchronous serial port data input 3.3V TTL level
3 TX UART asynchronous serial port data output 3.3V TTL level
4 DACR DAC right channel output can be connected to external power amplifier, headphone
5 DACL DAC left channel output can be connected to external power amplifier, headphone
6 SPK1 external mono speaker connected to 3W/4Ω or 2W/8Ω passive speaker
7 SPK2 externally connected Mono speaker connected to 3W/4Ω or 2W/8Ω passive speaker
8 VCC positive power supply 3.6-5V
9 IO5 trigger input 5 ground trigger
10 IO4 trigger input 4 ground trigger
11 IO3 trigger input 3 ground trigger
12 IO2 trigger input Port 2 Ground trigger
13 IO1 Trigger input 1 Ground trigger
14 GND Power supply negative system ground
15 DP USB data cable Read U disk or connect computer with USB data cable to replace TF card content
16 DM USB data cable

insert image description here
The tenth category of extended experiment
27 is one of the programs of the open-source DFPlayer Mini TF card MP3 player module (output actuator type D7/D8 digital interface), which
loops and plays 0003.MP3 in the TF card (in the MP3 folder), volume 20
Material: 1.5W Small Speaker One
Arduino-------dfplayer
5V-------------VCC
GND-----------GND
D7--------- --TXD
D8-----------RXD

Arduino experiment open source code

/*
Eagler8系列实验程序列表
第十类 扩展实验
27 开源DFPlayer Mini TF卡MP3播放模块(输出执行器类D7/D8数字接口)
程序之一,循环播放TF卡内0003.MP3(MP3文件夹内),音量20
材料:1.5W小型扬声器一个
Arduino-------dfplayer
5V-------------VCC
GND-----------GND
D7-----------TXD
D8-----------RXD
*/

#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

SoftwareSerial mySoftwareSerial(2, 3);

DFRobotDFPlayerMini myDFPlayer;

void setup()
{
    
    
mySoftwareSerial.begin(9600);

myDFPlayer.begin(mySoftwareSerial);

myDFPlayer.volume(20);

myDFPlayer.loop(3);   
}

void loop()
{
    
    
}

Eagler8 series experimental program list
Tenth extended experiment
27 Open source DFPlayer Mini TF card MP3 player module (output actuator type D7/D8 digital interface)
program 2, switch to the next song every 3 seconds, volume 20 (speed play TF All MP3 songs in the card)
can print detailed information from dfplayer to handle different errors and status.
Material: 1.5W small speaker an
Arduino-------dfplayer
5V-----------VCC
GND-----------GND
D7----- ------TXD
D8-----------RXD

Arduino experiment open source code

/*
Eagler8系列实验程序列表
第十类 扩展实验
27 开源DFPlayer Mini TF卡MP3播放模块(输出执行器类D7/D8数字接口)
程序之二,每3秒切换到下一首歌曲,音量20(速播TF卡内所有MP3歌曲)
可以打印来自dfplayer的详细信息以处理不同的错误和状态。
材料:1.5W小型扬声器一个
Arduino-------dfplayer
5V-------------VCC
GND-----------GND
D7-----------TXD
D8-----------RXD
*/

#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

SoftwareSerial mySoftwareSerial(8, 7);
DFRobotDFPlayerMini myDFPlayer;
void printDetail(uint8_t type, int value);

void setup()
{
    
    
  mySoftwareSerial.begin(9600);
  Serial.begin(115200);

  Serial.println();
  Serial.println(F("DFRobot DFPlayer Mini Demo"));
  Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));

  if (!myDFPlayer.begin(mySoftwareSerial)) {
    
      
    Serial.println(F("Unable to begin:"));
    Serial.println(F("1.Please recheck the connection!"));
    Serial.println(F("2.Please insert the SD card!"));
    while(true);
  }
  Serial.println(F("DFPlayer Mini online."));

  myDFPlayer.volume(20);  
  myDFPlayer.play(3);  
}

void loop()
{
    
    
  static unsigned long timer = millis();

  if (millis() - timer > 3000) {
    
    
    timer = millis();
    myDFPlayer.next();  
  }

  if (myDFPlayer.available()) {
    
    
    printDetail(myDFPlayer.readType(), myDFPlayer.read());
  }
}

void printDetail(uint8_t type, int value){
    
    
  switch (type) {
    
    
    case TimeOut:
      Serial.println(F("Time Out!"));
      break;
    case WrongStack:
      Serial.println(F("Stack Wrong!"));
      break;
    case DFPlayerCardInserted:
      Serial.println(F("Card Inserted!"));
      break;
    case DFPlayerCardRemoved:
      Serial.println(F("Card Removed!"));
      break;
    case DFPlayerCardOnline:
      Serial.println(F("Card Online!"));
      break;
    case DFPlayerPlayFinished:
      Serial.print(F("Number:"));
      Serial.print(value);
      Serial.println(F(" Play Finished!"));
      break;
    case DFPlayerError:
      Serial.print(F("DFPlayerError:"));
      switch (value) {
    
    
        case Busy:
          Serial.println(F("Card not found"));
          break;
        case Sleeping:
          Serial.println(F("Sleeping"));
          break;
        case SerialWrongStack:
          Serial.println(F("Get Wrong Stack"));
          break;
        case CheckSumNotMatch:
          Serial.println(F("Check Sum Not Match"));
          break;
        case FileIndexOut:
          Serial.println(F("File Index Out of Bound"));
          break;
        case FileMismatch:
          Serial.println(F("Cannot Find File"));
          break;
        case Advertise:
          Serial.println(F("In Advertise"));
          break;
        default:
          break;
      }
      break;
    default:
      break;
  }
}

Experimental open source graphics programming (Mind+, programming while learning)

insert image description here

Experimental open source simulation programming (Linkboy V5.33)

insert image description here
insert image description here
insert image description here
insert image description here
Arduino experiment scene diagram

insert image description here
insert image description here

Guess you like

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