Skip to content

A simple IOT music player that uses a Particle Photon, and a Uart serial MP3 Player to control music via the internet

Notifications You must be signed in to change notification settings

SaifSabban/InternetMusicPlayer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 

Repository files navigation

InternetMusicPlayer

A simple IOT music player that uses a Particle Photon, and a Uart Serial MP3 Player to control music via the internet

Notes

This project can play music using 2 methods, either directly sending a serial command to the photon, or via the internet by using the Particle functions, found on the particle app.

Getting Started

Prerequisites

This project Uses 5 or 6 items:

Adding Music To SD Card

The MP3 player reads the .mp3 & .wav using an alphabetical index, so you need to make folders with the names such as 01, 02, 03. As for songs, they need to be given names such 001xxxxx.mp3, 002xxxx.wav, 003xxxx.mp3.

Communicating With Serial MP3 Player (Educational)

If you'd like to communicate directly to the MP3 Player you'd need a USB to Uart module. Set the Baud Rate to 9600, and you'd need to use Hex data that uses an 8 integer array, Structures as: 0x7E 0XFF 0xaa 0Xbb 0X00 0Xzz 0Xyy 0XEF Where:

  • The first and the last integers are fixed with 0x7E and 0xEF values, respectively.
  • 0xFF is the version number(Keep As Is).
  • aa: The number of bytes of the command has, without taking into account the starting and ending byte.
  • bb: is the actual control command
  • zz: Feedback request command (0x00 = No Feedback, 0x01 = Feedback)
  • yy: A second byte of data

The Commands are As Follows:

Connecting Components

The Basic Connections are:

  • 1: Connect the 3v3 pin from the Particle Photon, to the VCC on the Serial MP3 Player.
  • 2: Connect a GND pin from the Particle Photon, to the GND on the Serial MP3 Player.
  • 3: Connect the RX pin from the Particle Photon, to the TX on the Serial MP3 Player.
  • 4: Connect the TX pin from the Particle Photon, to the RX on the Serial MP3 Player.
  • 5: Connect the WKP pin from the Particle Photon, to the SP on the PAM8302A.
  • 6: Connect the 3v3 pin from the PAM8302A, to the VCC on the Serial MP3 Player; or 3v3 pin from the Particle Photon or VIN pin from the Particle Photon.
  • 7: Connect a GND pin from the PAM8302A, to the GND on the Serial MP3 Player; or GND pin from the Particle Photon.

Getting Mono Sound

To Get Mono Sound:
  • 1: Connect the A- pin from the PAM8302A, to the Gnd pin of the Audio Jack on the Serial MP3 Player.
  • 2: Connect the A+ pin from the PAM8302A, to the right or left speaker pins of the Audio Jack on the Serial MP3 Player.

Getting Stereo Sound

To Get Stereo Sound:
  • 1: Connect the Right speaker pin of the Audio Jack on the Serial MP3 Player, to a leg of a 1K ohm resistor.
  • 2: Connect the left speaker pin of the Audio Jack on the Serial MP3 Player, to a leg of anoter 1K ohm resistor.
  • 3: Connect the free legs of both 1K resistors to each other.
  • 4: Connect the A+ pin from the PAM8302A, to the joint legs of both 1k resistors.

Uploading Code

One needs to have the Particle Photon initialised and setup to their Wi-Fi and account. Following the guide at the Particle Website.

Next, if you're using the Web IDE click on this Link. It should open your Web IDE with all the necessary files needed. If you're using a computer application, you can find the necessary files needed under the InternetMusicPlayer_V2 Zip.

Understanding The Particle Functions

01_PlayFolderSong: Choose a song & file to play. You can only go between 0 and 65535. Song limit 0-654, folder limit 0-99. Type as one number.

02_MusicState: Choose if you want to play, pause or stop a song. 0 = Pause, 1 = Play, 2 = Stop. Or type in the words play, pause or stop.

03_SkipSong: Choose if you want to skip to next or previous song. 0 = Previous Song, 1 = Next Song. Or type in the words Previous, or Next.

04_Volume: Choose what volume level you want, you can only go between 0 and 100.

05_Cycle: Choose if you want to cycle the current folder. 0 = Stop Cycle, 1 = Allow Cycle.

06_SpeakerState: Choose if you want to enable or disable speaker. 0 = Disable Speaker, 1 = Enable Speaker.

07_MP3PlayerState: Choose if you want to have player go to sleep, wakeup, or reset. 0 = Sleep, 1 = Wake, 2 = Restart. Or type in the words Sleep, Wake or Restart.

08_PlaySong: Choose what song you want to play from current file. You can only go between 0 and 255. (Needs Fixing)

09_PlayFolder: Choose a file & play the first song there. You can only go between 0 and 255. (Needs Fixing)

10_Restart_0: Restarts Particle Photon, type; Yes Or 0.

Understanding The Particle Variables

1_Music: Shows what state music is at Playing, Paused, or Stopped.

2_VolLevel: Shows Current Volume Level.

3_CycleState: Shows Current Cycle State. 0 = Stopped Cycle, 1 = Cycling.

4_SpeakerState: Shows Current Speaker State. 0 = Disabled Speaker, 1 = Enabled Speaker.

5_PlayerState: Shows Current MP3 Player State. 0 = Sleeping, 1 = Awake.

6_Song: Shows Current Song.

7_Folder: Shows Current Folder.

About

A simple IOT music player that uses a Particle Photon, and a Uart serial MP3 Player to control music via the internet

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published