diff --git a/documentation/images/buttons_and_circuit_board.jpg b/documentation/images/buttons_and_circuit_board.jpg new file mode 100644 index 0000000..351a2ff Binary files /dev/null and b/documentation/images/buttons_and_circuit_board.jpg differ diff --git a/documentation/images/circuit_board.jpg b/documentation/images/circuit_board.jpg index 17412c3..512b61e 100644 Binary files a/documentation/images/circuit_board.jpg and b/documentation/images/circuit_board.jpg differ diff --git a/documentation/images/phat_dac_measure.jpg b/documentation/images/phat_dac_measure.jpg new file mode 100644 index 0000000..414a030 Binary files /dev/null and b/documentation/images/phat_dac_measure.jpg differ diff --git a/documentation/images/phat_dac_soldering.jpg b/documentation/images/phat_dac_soldering.jpg new file mode 100644 index 0000000..0b55ae6 Binary files /dev/null and b/documentation/images/phat_dac_soldering.jpg differ diff --git a/documentation/images/phat_dac_soldering_back.jpg b/documentation/images/phat_dac_soldering_back.jpg new file mode 100644 index 0000000..b427821 Binary files /dev/null and b/documentation/images/phat_dac_soldering_back.jpg differ diff --git a/documentation/index.html b/documentation/index.html index 48b96df..f59b211 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -90,7 +90,7 @@ h2, h3 {

AudioSphere

An easy-to-use music player for children based on the Raspberry Pi Zero and the JBL On Stage IIIp

-

In spring 2016 I finalized the Musikrakete, an MP3 player that our boys could use without assistance. This is the second version: Not a rocket anymore, but with many improvements.

+

In spring 2016 I finalized the Musikrakete, an MP3 player that our boys could operate without assistance. This is the second version, that is even easier to use. Music is played by simply placing a QR code card on top of the sphere.

- This project started about a year ago, when Anica asked me if buying a hörbert MP3 player would be a good idea. After all our boys wasted two to three CDs every week, trying to get some music out of the small player in their room. And the player in the living room also seemed to reach its end of life pretty soon due to their enthusiasm. Still I wasn't too sure about the device. In order to get new files on the SD card of the player, the case had to be opened, the navigation with 11 buttons also seemed a little confusing and a single speaker operated with four batteries also did not seem promising to me. + This project started about a year ago, when Anica asked me if buying a hörbert MP3 player would be a good idea. At the time our boys wasted two to three CDs every week, trying to get some music out of the small player in their room. And the player in the living room also seemed to reach its end of life pretty soon due to their enthusiasm. Still I wasn't too sure about this hörbert thing. In order to get new files on the SD card of the player, the case had to be opened, the navigation with 11 buttons also seemed a little confusing and a single speaker operated with four batteries also did not seem promising to me.

@@ -117,7 +117,7 @@ h2, h3 {

- As good as the description seemed to be, I wanted to make some improvements on the original design: The player should detect the QR cards on its own, all components should be put together in a single case and, most important, the MP3 should be delivered directly from our home server. No SD card replacement needed. + As good as the project description seemed to be, I wanted to make some improvements on the original design: The player should detect the QR cards on its own, all components should be put together in a single case and, most important, the MP3 files should be delivered directly from our home server. No SD card replacement needed.

@@ -131,11 +131,11 @@ h2, h3 {

PiPlayer 2.0: AudioSphere

- The major improvement in handling was switching from a QR card slot to a window on top where the QR cards are placed on. I had seen that especially the smaller one had problems getting the cards into the narrow slot. Unfortunately, this also meant that a rocket shape was not an option anymore. At first I tried to put only a hemisphere on top of the JBL speaker which would make it look like a UFO. But the webcam needed at least 10 cm distance to the card in order have the entire QR code covered. Technically, it would be possible to further reduce the size of the ball but fitting all the components in there is hard enough as it is. Also, I wanted to be able to use the cards from the first player in the new one as well. + The major improvement in handling was switching from a QR card slot to a window on top where the QR cards are placed on. I had seen that especially the smaller one had problems getting the cards into the narrow slot. Unfortunately, this also meant that a rocket shape was not an option anymore. At first I tried to put only a hemisphere on top of the JBL speaker which would make it look like a UFO. But the webcam needed at least 8 cm distance to the card in order have the entire QR code covered. Technically, it would be possible to further reduce the size of the ball but fitting all the components in there is hard enough as it is. Also, I wanted to be able to use the relatively large cards from the first player in the new one as well.

- Also, an ethernet port is now available (since we had problems with the Wi-Fi connection in the boy's room) and thanks to switching to the Raspberry Pi Zero, the Apple dock port is now able to provide power for all the components. No additonal power source needed. By incorporating a Pimoroni PHAT DAC I removed all the audio-related headaches. + Also, an ethernet port is now available (since we had problems with the Wi-Fi connection in the boy's room) and thanks to switching to the Raspberry Pi Zero, the Apple dock port is now able to power all the components. No additonal power source needed. By incorporating a Pimoroni PHAT DAC I removed all the audio-related headaches.

@@ -149,7 +149,7 @@ h2, h3 {

3D Printed Case

- First step was the design of the new case. Like the first rocket case it's public, you can find it here on Onshape. (You will need to create an account to open the document.) Or you can download the STL files for printing if you are using the very same components. Please note that you will need to rotate the top of the sphere 180° for printing. Also be careful about the Raspberry holder: The Raspberry Pi together with the PHAT DAC should have a height of about 7 mm (or less) which depends on the GPIO header that is used to solder the PHAT DAC to the RasPi. If the height exeeds 7 mm the distance has to be adjusted before printing. + First step was the design of the new case. Like the first rocket case it's public, you can find it here on Onshape. (You will need to create an account to open the document.) Or you can download the STL files for printing if you are using the very same components. Please note that you will need to rotate the top of the sphere 180° for printing. Also be careful about the Raspberry holder: The Raspberry Pi together with the PHAT DAC should have a height of 7.2 mm (or less) which depends on the GPIO header that is used to solder the PHAT DAC to the RasPi. If the height exeeds that, the distance needs to be adjusted before printing.

Preparing the JBL IIIp Speaker

- In order to drill the holes for the screws, the JBL On Stage IIIp has to be disassembled. The procedure is described here at ifixit.com for the predecessor which works basically the same way: Remove the rubber pads, then remove all screws from the case. (Don't forget the center screw in the battery case.) Once the speaker case is opened, the circuit board is unscrewed and removed. + In order to drill the holes for the screws, the speaker has to be disassembled. The procedure is described here at ifixit.com for the predecessor which works basically the same way: Remove the rubber pads, then remove all screws from the case. (Don't forget the center screw in the battery case.) Once the speaker case is opened, the circuit board is unscrewed and removed.

@@ -213,11 +214,11 @@ h2, h3 {

- After drilling, washers and screws are added and the infrared LED is glued directly in front of the speaker's IR sensor in order to send it commands. Before that the PINs of the IR LED are soldered to cables, that are long enough to connect it to the circuit board through one of the additional holes. Also, all the electronics should be tested together before anything is hot-glued into the case. + After drilling, washers and screws are added and the infrared LED is glued directly in front of the speaker's IR sensor in order to send it commands. Before that the PINs of the IR LED are soldered to cables that are long enough to connect it to the circuit board through one of the additional holes. Also, all the electronics should be tested together before anything is hot-glued into the case.

- +

- (Disclaimer: I only did a proof of concept test script for remote contolling the speaker via the IR LED until now. I am planning on using that component later on via a web app but for the time being you could as well leave it out.) + (Disclaimer: Until now, I only did a proof of concept test script for remote contolling the speaker via the IR LED. I am planning on using that component later on via a web app but for the time being you could as well leave it out.)

Electronics

- There are four electronic parts: The reflective optical sensor that triggers the QR recognition process, the LED that illuminates the QR card from within the case, the infrared LED that passes commands to the speaker and the 3 momentary push buttions that are used to pause/unpause playback and move within the current playlist. While the buttons and the LEDs are put directly in the case, all other elements are brought together on a circuit board from where they are connected to the RasPi via jumper cables. (Below is a diagram of the electronics and here's the source file for fritzing.) -

- -

- After soldering the PHAT DAC onto the Raspberri Pi (preferably using a GPIO header that directly routes through all the GPIOs) the used PINs are connected with the jumper cables. Where these were not soldered to the contact, I used hot glue to fix the connection which worked pretty well. + There are four electronic parts: The reflective optical sensor that triggers the QR recognition process, the LED that illuminates the QR card from within the case, the infrared LED that passes commands to the speaker and the 3 momentary push buttions that are used to pause/unpause playback and move within the current playlist. While the buttons and the LEDs are put directly in the case, all other elements are brought together on a circuit board from where they are connected to the RasPi via jumper cables. So this is what we're aiming for:

+ +

+ Assembling the circuit is pretty straight forward. Be careful about the optical sensor, though: There are two versions out there, one from Vishay and one from TEMIC that has the detector transistor upside down compared to the other one. Also note that I used a LED that can operate directly on the RasPi's 3.3 V without a series resistor. If you use a smaller one (which should also be sufficient for illumination), you will need one. +

+ +

+ After soldering the PHAT DAC onto the Raspberri Pi (preferably using a GPIO header that directly routes through all the GPIOs) the used PINs are connected with the jumper cables. +

+ +

+ Once everything is connected together, it can be put in the case for the software installation and final adjustments. Wait with the hot glue until everything has been tested, especially on the camera! +

+ + + + + +

+ What's missing in the pictures is how to get a screw thread behind the holes in the case: Use super glue to put three M3 nuts on washers (in order to enlarge the surface). When dried, use the super glue again to attach these nuts-on-washers behind the screw holes of the case. (Use the screws to adjust them so you can turn them in and out. I used UHU Super Strong and Safe which gives you some time for corrections after applying.) Et voilà, you now got yourself screw holes with threads on the player's case.

Software

- +

System Installation

- Before installing anything additionally, Raspbian Lite has to be installed on the SD card. When the SD card is ready, it is necessary to at least once connect a monitor and a keyboard to the RasPi for the initial setup since SSH is disabled by default. As soon as wi-fi is configured, we can remove all the cables and continue to work remotely over ssh. + Before installing anything additionally, Raspbian Lite has to be installed on the SD card. When the card is ready, it is necessary to at least once connect a monitor and a keyboard to the RasPi for the initial setup since SSH is disabled by default. As soon as SSH is enabled and Wi-Fi is configured, we can remove all the cables and continue to work remotely over ssh.

- +

- Basic setup: + From here on it's basically copy-and-paste to your SSH terminal. You might need to confirm or close something every now and then. Where a configuration file has to be edited, the contents that go to the file are also put in comments with a leading tab.

- + +

+ Basic setup (with links to the references): +

+
 # Make sure that the latest versions are installed (this might take some time) (https://www.raspberrypi.org/documentation/raspbian/updating.md)
 sudo apt update
 sudo apt dist-upgrade
 
-# Basic setup: password, keyboard layout, wi-fi channels, hostname, ssh
+# Basic setup: change the password, set the keyboard layout, Wi-Fi channels and hostname and enable SSH
 sudo raspi-config
 
 # Check kernel messages for errors
@@ -266,10 +292,10 @@ dmesg
 # Check for connected USB devices
 lsusb
 
-# Install wi-fi client (https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md)
+# Install Wi-Fi client (https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md)
 sudo apt install iw
 
-# If not done yet, plug in wi-fi adapter and reboot
+# If not done yet, plug in the Wi-Fi adapter and reboot
 sudo reboot
 
 # Scan networks and add wi-fi network to configuration
@@ -280,7 +306,7 @@ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
 #		psk="Your_wifi_password"
 #	}
 
-# Restart wi-fi
+# Restart Wi-Fi
 sudo ifdown wlan0
 sudo ifup wlan0
 
@@ -292,16 +318,17 @@ sudo shutdown -h now
 

- From here on you can connect via SSH over wi-fi. Unplug monitor, keyboard and the ethernet cable. It might also be helpful to configure a static IP for the wi-fi adapter in your router, before continuing. Then restart the RasPi, connect via SSH from a different computer and go on with the setup procedure. + From here on you can connect via SSH over wi-fi. Unplug monitor, keyboard and the ethernet cable. It might also be helpful to configure a static IP for the Wi-Fi adapter in your router before continuing. Then restart the RasPi, connect via SSH from a different computer and go on with the setup procedure.

 # Now that remote connection is available, disable HDMI (http://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-zero-conserve-energy)
+# (This line has to go *before* "exit 0" at the end of the file)
 sudo nano /etc/rc.local
 #	# disable HDMI
 #	/usr/bin/tvservice -o
 
-# Disable the ACT LED
+# Add this to config.txt to disable the ACT LED
 sudo nano /boot/config.txt
 #	dtparam=act_led_trigger=none
 #	dtparam=act_led_activelow=off
@@ -321,11 +348,11 @@ sudo shutdown -h now
 		

After the basic installation is done, it's time to bring everything together in the case. All components are connected but we'll wait using the glue gun until everything is tested thoroughly. Especially the webcam might need some in-place live adjustment. The easiest way to do this is by connecting the webcam to another computer while it is already in the case (see bash history below).

- +

Now configure the additional hardware and software that is needed for the player. Before doing that, copy the contents of the piplayer2 directory (including subdirectories sounds and test) to /home/pi (either directly or via SCP). Have also one of the test cards from the template ready for testing the QR recognition.

- +
 # Install additional software
 sudo apt install lirc zbar-tools mc moc fswebcam python3 python-rpi.gpio python3-rpi.gpio
@@ -402,13 +429,13 @@ irsend SEND_ONCE JBLIIIP KEY_MUTE
 		

When everything works as expected, everything is fixed together using hot glue. I glued the webcam, the circuit board and the USB hub in place so that nothing will fall out of place anymore, even if the player is moved around roughly.

- +

While I really like hot glue, it's got its limits: I thought I could skip soldering the buttons to their wires by just twirling the cable ends to the contacts and then fix everything down with the hot pistol - bad idea. While being hot, the glue gets in between the wire ends and the contacts and perfectly isolates them. None of the buttons worked anymore. I had to peel the glue off the contacts with a cutter knife before soldering them properly back on again...

- +

Now that everything is in place, we are ready for the final adjustments: Configure autostart for the player script and mount the SD card in read-only mode which makes the player robust against sudden loss of power. For that, we redirect the write access to a RAM disk.

@@ -452,16 +479,16 @@ sudo ln -s /tmp/resolv.conf /etc/resolv.conf # shown here with the former additions to rc.local - note that the log redirect for the player script is changed also sudo nano /etc/rc.local # ... -# +# # # make /tmp on RAM disk writable # chmod 777 /tmp -# +# # # disable HDMI # /usr/bin/tvservice -o -# +# # # start piplayer # su pi -c 'python3 /home/pi/piplayer2.py >> /tmp/piplayer2.log 2>&1 &' -# +# # exit 0 sudo reboot @@ -498,8 +525,8 @@ sudo nano /etc/rc.local HIER WEITER: - Test-MP3 zu Template und Repository hinzufügen

- - + +

Python Script

User Manual