1

member

Easy Basics: Project 051b Serial MP3 player module by Catalex, Ultrasonic Sensor HC-SR04

of Acoptex.com in UNO

Basics: Project 051b

Project name: Serial MP3 player module by Catalex, Ultrasonic Sensor HC-SR04 - Contactless doorbell or Sound alert system

Tags: Arduino, Arduino Uno, Serial MP3 player module, MP3 player, Serial, module, UART Control, MP3 Music Player Module for Arduino, AVR, ARM, PIC, 3W Amplifier, UART, Catalex, Micro SD card with adapter, MP3 audio chip YX5300, YX5300, Ultrasonic Sensor HC-SR04, Ultrasonic Sensor, HC-SR04, Contactless doorbell, Sound alert system

Attachments: sketch1, examplesound1, examplesound2

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1.Arduino Uno R3 (you can also use the other version of Arduino)

2. Serial MP3 player module by Catalex 1pc

3.Arduino IDE ( you can download it from here  )

4.Jumper cables F-M, M-M

5. Micro SD card with adapter 1 pc

6. Loud speaker 1 pc

7. Ultrasonic Sensor HC-SR04 module 1 pc

General

We will learn how to connect Serial MP3 player module, Ultrasonic Sensor HC-SR04 module to Arduino board and use it. There are several ways to use this project: as a sound guide (to guide someone to certain direction when he/she comes front of the sensor), to make yourself aware of something or someone.

Understanding the HC-SR04 Ultrasonic Module

You can read more about it here.

Understanding the Serial MP3 player module

The module is a kind of simple MP3 player device which is based on a high-quality MP3 audio chip YX5300. It can support 8kHz ~ 48kHz sampling frequency MP3 and WAV file formats. There is a TF card socket on board, so you can plug the micro SD card that stores audio files. MCU can control the MP3 playback state by sending commands to the module via UART port, such as switch songs, change the volume and play mode and so on. You can also debug the module via USB to UART module. It is compatible with Arduino/AVR/ARM/PIC.

Features:

  • Support sampling frequency (kHz): 8 / 11.025 / 12 / 16 / 22.05 / 24 / 32 / 44.1 / 48
  • Support file format: MP3 / WAV
  • Support Micro SD card (<=2G), Micro SDHC Card (<=16G)
  • 30 class adjustable volume
  • UART TTL serial control playback mode, baud rate is 9600bps
  • Power supply can be 3.2 ~ 5.2VDC
  • File system format: FAT16 / FAT32

Specification:

  • Dimensions 1.93 in x 0.98 in x 0.35 in (4.9 cm x 2.5 cm x 0.9 cm)
  • Weight 0.17 oz (4.8 g)

Control interface: It is UART TTL interface. A total of four pins (GND, VCC, TX, RX), GND to ground, VCC is the power supply, TX is the TX pin of the MP3 chip, RX is the RX pin of the MP3 chip.

TF card socket: The micro sd card can be plugged in it.

Playbck indicator: Green light. If it is ready to play or it is paused, it keeps lighting. If playing, it blinks.

Headphone jack: It can be connected with the headphone or external amplifier.

Mounting holes: 4 screw mounting holes whose diameter is 2.2mm, so that the module is easy to install, easy to combine with other modules.

You can find the datasheet of YX5300 chip (Chinese) here. You can read the manual (English) of Serial MP3 player v1.0 here.

Signals and connections of the HC-SR04 Ultrasonic Module

Trig - Trigger Pulse Input

Echo - Echo Pulse Output

VCC - power supply (+5V)

GND - ground (0V)

Duration for the sound to reach echo is twice the duration required to reach the object that will create echo. That is if you shout in front of a wall the voice to reaches the wall and returns back to your ear. The moment you hear the sound, the voice has traveled twice the distance between you and the wall. Thus the time taken will be twice as the speed of sound is constant. Hence the following formula:

d = v/t;

therefore d = 29 / (time in miliseconds / 2).

or d = 340 / (time in seconds / 2).

Signals and connections of the Serial MP3 player module

RX - receive pin. Connected to Arduino board TX pin.

TX - transmit pin. Connected to Arduino board RX pin.

VCC - power supply. Can be connected to +5VDC or +3.3VDC pin of Arduino board.

GND - ground. Connected to Arduino board GND pin.

Wiring

The following picture shows the needed connections with the Arduino Uno 

Step by Step instruction

  1. You can use Micro SD card(<=2G) or Mirco SDHC card (<=32G) with this module.
  2. Most SD cards work right out of the box, but it's possible you have one that was used in a computer or camera and it cannot be read by the SD library. Formatting the card will create a file system that the Arduino can read and write to. It's not desirable to format SD cards frequently, as it shortens their life span. You’ll need a SD card reader or micro SD card adapter and computer to format your card. The library supports the FAT16 and FAT32 filesystems, but use FAT16 when possible. See additional info here.
  3. Format the SD card as FAT16 or FAT32. Insert the SD card in your computer. Go to My Computer and right click on the SD card. Select Format...  
  4. A new window pops up. Select FAT32, press Start to initialize the formatting process and follow the onscreen instructions.
  5. Copy sound track into the micro SD card.The Mp3 chip reads the .mp3 or .wav alphabetically indexed, so if you need to make folder with the names 01 and sound track must be with the name - 001.mp3
  6. Insert the formatted micro SD card with (make sure you name the sound track 001) in the TF card socket on the back of Serial MP3 player module.
  7. Do wiring.
  8. Open Arduino IDE.
  9. Plug your Adruino Uno board into your PC and select the correct board and com port
  10. Verify and upload the the sketch to your Adruino Uno
  11. If the distance will be less than 30 cm the sound will be on. You can modify the distance.

Code

It's very well commented and easy to understand.

Summary

We learnt how to connect Serial MP3 player module, Ultrasonic Sensor HC-SR04 module  to Arduino board and use it.

Library

  • We used SoftwareSerial library. It's installed with Arduino IDE. 
    The library has the following known limitations:
    If using multiple software serial ports, only one can receive data at a time.
    Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
    Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
    On Arduino or Genuino 101 the current maximum RX speed is 57600bps
    On Arduino or Genuino 101 RX doesn't work on Pin 13
    The library has the following known limitations: If using multiple software serial ports, only one can receive data at a time;Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69);Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI);On Arduino or Genuino 101 the current maximum RX speed is 57600bps; On Arduino or Genuino 101 RX doesn't work on Pin 13

Sketch

  • See attachment on the begining of this project


Other projects of Acoptex.com
Easy Merry Xmas to everyone of Acoptex.com, Not selected 24-12-2019

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 13-03-2018
Viewed: 1487 times