RPI-NetSpider-BT-music-box

by yoyojacky in Circuits > Raspberry Pi

548 Views, 8 Favorites, 0 Comments

RPI-NetSpider-BT-music-box

bt-01.jpg
Snip20170504_1.png

Today, I am a little bit lazy~ due to finished my work in time, so I want to enjoy music for a while. But I have no speaker except a Xiaomi Bluetooth music box and a Raspberry Pi 3 Model B. So I was going to try Bluetooth on the Raspberry Pi 3B. After burning the operating system on the TF card and connecting the Raspberry Pi to my wireless Access Point in my office, I ran this command to search and play music as my will.

How to Set It Up?

1. Download the lastest image from www.raspberrypi.org/download. I've choose the Raspbian OS for my project.

2. Burned the image into TF card and plug it to your Raspberry Pi 3B.

3. Power on Raspberry Pi.

4. Update your system and git clone the code which i was prepared before and uploaded to github.com, my repositories.

5. Install the Bluetooth management software and connect to Xiaomi bluetooth music box.

6. Play the music and enjoy it.

1.Download the Latest Image

Snip20170504_6.png

Access this URL https://www.raspberrypi.org/downloads/ and choose this version.

Burn the Image by Using Etcher Tool on Mac

Snip20170504_11.png

Insert your TF card to the card adapter and then insert it into your PC or Laptop, using Etcher to burn image on TF card is one of your options, you can try win32_disk_imager if you were in windows environment; or you can just use dd command to restore the image file to TF card in Linux environment.

Linux : sudo dd if=/home/jacky/2017-03-02-raspbian-jessie.img of=/dev/sdb bs=1M

Note: of=/dev/sdb means the second disk on my linux environment, it can be different if you have more than 2 disks on you system.

Download the 52Pi Repository From Github.com

I have already write down a python script which called spider, it can access the music web site and get the music links so that i can play on my raspberry Pi.

You may need to install the git tool first by using this command on your terminal:

sudo apt-get update

sudo apt-get -y install git

cd

git clone https://github.com/yoyojacky/52Pi.git

cd ~/52Pi/

python music.py

and then input the name of the song or the author, press enter...

Nothing happened ? Due to you does not setup the bluetooth.

Pair the Bluetooth Music Box With Your RPi.

Snip20170504_13.png

At the command line type:

sudo apt-get install --no-install-recommends bluetooth

Once the software is installed, type:

sudo service bluetooth status

You should see bluetooth is running. If not, reboot and try again.

Open a terminal and type:

sudo bluetoothctl

and then type :

agent on

default-agent on

scan on

and then using this command to pair your bluetooth music box:

pair 00:0e:1d:13:33:25 #########This is MAC address of my bluetooth device, you may use yours.

and change the audio output to the bluetooth device, and try that python script again, you will hear the music that you want.

Thanks for watching~