Spotifypod is a modified 4th gen iPod that is capable of running Spotify and streaming audio to a bluetooth speaker. This post describes the steps needed to recreate what Guy Dupont did in this great implementation: sPot: Spotify in a 4th-gen iPod (2004).
Make sure you first visit his project and get familiarized with the concept. As soon as I saw this project, I knew there was no way back! had to do it 🙂 .
I tried to reproduce what Guy Dupont did, introducing small variations that fitted what I had on my desk at the moment of starting with this build. One of my goals was also to try to reduce costs from the screen side since here in Germany the suggested Adafruit display is not that easy to find.
I take absolutely no credit for this build. This is inteded to be just a step by step guide for those who would like to have this super cool upgraded 4th gen iPod sitting gracefully on their desk ;).
Another important point to mention: This post is mostly focused on the hardware side. The software side is dynamically being updated in the GitHub repository 😉
In this post it is assumed that the raspberry pi has been already configured according the README instructions from the original project.
Having said that, lets go to the following section!
The following parts and components are necessary for the Spotifypod build:
- Premium Spotify Account if you want to have full functionality
- Raspberry Pi Zero W
- 1 x Adafruit PowerBoost 1000C
- SD Card (16Gb should be ok)
- 2inch LCD Module ST7789V controller 240 x 320 Pixels
- FFC FPC 8 Stift 0,5mm adapter
- Polyimid tape
- 2 x Schottky diode ( BAT42 )
- 2 x Small Signal Diode (1n4148)
- 1 x button (4.5mm*4.5mm*4.3mm)
- 1 x Mini Vibrationsmotor
- 1 x MMBT3904 NPN transistor
- 1 x 1k Ohm resistor
- 3D printed parts
- Base plate
- Key press extension
- SpotifyPod holder (optional!)
- 1 x Battery 750mAh with JST PH2.0 Connector
- Flat band cable
Please note that the items listed above with a link are inteded to be just a refrence to show exactly what was used.
Open the iPod
In order to open the iPod safely and without breaking anything, go ahead and watch some tutorials on YouTube first!
This one was particularly helpful:
Remove “unnecessary” electronics
Once you managed to open it, make sure to remove everything but the clickwheel and the little upper board from the metalic side.
The rest of the parts are not going to be needed for this proyect.
Isolate the metallic case
Make sure to fill generously all the metallic case surface with Polyimid tape. This will avoid unwanted shortcircuits later when mounting the electronic components. The 3D printed Base plate will also help to isolate, most of the components from the metallic part, but the Polyimid tape will also cover critical areas, for example, where the Raspberry Pi Zero is going to be mounted.
Since the display will not fit on our iPod, it is necessary to do two carry out two steps:
- Desolder the connector
- Trim the sides. I used a Dremel for this.
After these steps, yout display should see like this:
These steps will help us to ensure that the display fits our iPod case and also that you can safely close the case without any internal components coliding.
The required display connections will be later soldered directly on the pads where the connector was previously soldered.
We will come back to this point later.
3D printed parts
These items are optional, not everyone has a 3D printer at home but… it has been helpful to have a plate that makes sure that the components stay at their places and also helps to place the Powerboost at the right height so the usb connector can be accessed from the bottom side. On the other hand, the base plate makes sure that a distance of 2mm is kept from each side so the clips from the plastic lead dont collide with raspberry py connectors or the battery.
Once we have all trhe components ready to go, we can start connecting all together.
The following connection diagram shows all the modules interconected. Please notice that there are some variations in comparison with the original project, therefore the implemented software will have some differences when it comes to GPIO configurations. The reason of these variations is that in the original project a composite signal is used whereas for this implementation an SPI display has been implemented. The signals required for this type of interface come in conflict with some of the original GPIOs definitions. Dont worry, we are just talking about updating a few code lines 😉 As tip, it is better to start working with the minimal amount of components involved. I would sugest for the first step having just the Raspberry Pi connected with the Display.
Before starting with the connection, it is a good idea to place the components already on their definitive locations. This will help us to have a better idea about cable lengths and will help to avoid later surprises when trying to close the iPod case.
The cable lenght that you use, should allow to open the case while everything is still connected. This will lead to have longer connections, but you will be thankful later if you have to open the iPod again!. This can be seen in the following picture.
Wiring the Display
We will focus on the following connections only. The whole system can be powered directly from the RPI Zero micro usb connector.Make sure that the display is placed where the original iPod display was. The RPI Zero should be placed on the metallic side holded by the 3D printed plate. Start wiring each of the eight signals according to the schematics showed above.
The following page was extremelly helpful – See Option 2: Mirroring Raspberry Pi HDMI Video to a ST7789 1.3 inch LCD Display
Just make sure that for this setup you use the following cmake options
cmake -DST7789=ON -DGPIO_TFT_DATA_CONTROL=24 -DGPIO_TFT_RESET_PIN=25 -DSPI_BUS_CLOCK_DIVISOR=30 -DSTATISTICS=0 -DDISPLAY_BREAK_ASPECT_RATIO_WHEN_SCALING=ON -DUSE_DMA_TRANSFERS=OFF ..
If the connections are ok and the driver has been correctly installed, you have already a working display!
It is time to wire the Clickwheel interface! Pay close attention to the pinout!!! I almost fried mine since the pinout description was mirrored on the bottom side :s.
The valid pin numbers for us are the one from the 0.5mm side. I removed the connector from the 1.0mm side in order to gain more space and avoid posible collisions.
The following pocture shows the connection between the clickwheel interface and the adapter.
The Clickwheel will be wired as follow:
Once again, make sure that the adapter is properly located so the cable lenght can be estimated. For this build it was placed below the display module and isolated with Polyimid tape:
Once the wiring is ready, the Clickwheel interface can be tested! Before compiling the source code click.c the following line must be changed:
#define DATA_PIN 25
will be now:
#define DATA_PIN 5
Once the code has been updated, it can be compiled with the following command:
gcc -Wall -pthread -o click click.c -lpigpio -lrt
Once it has been compiled, a “click” file will be generated. Make sure you make this file executable:
sudo chmod +x click
Now you can launch the clickwheel software and test it. If everything runs as it should, you will get feedback every time you interact with the wheel.
Looking at the original schematic from Adafruit we see that the EN signal is pulled up high. That means that the PowerBoost module will be enabled unless we pull the EN pin down. For our implementation we would like to make sure that unless we pull EN high, the PowerBoost module remains disabled. This behaviour can be achieved by connecting R13 directly to ground.
R13 will be placed as shown below so it keeps pulling EN pin down.
The idea is to be able to activate the power boost so it can power up the the RPI Zero. But on the other hand, it would be expected that the RPI Zero can be gracefully powered off so no damage to the data structure is made. A concept for this is shown in the diagram below.
- Let us assume that the system is powered off. That means, that thanks to our modification on the PowerBoost module, the EN pin is deactivated.
- Once the Power Button is pressed, the EN pin of the PowerBoost is activated since it is getting its high value from the battery through the schottky diode. At this point the PowerBoost is activated and providing 5V to the RPI so it start booting up.
- If the power button until the RPI has initialized the UART module, the UART_TX pin will become automatically high since it is the default satus for this interface – Keep in mind that the UART interface must be activated from raspi.config. At this point, the EN pin from the PowerBoost module is still being feed from the battery.
- Once the power button has been released and the UART interface is active, the UART_TXD will be noh holding high the EN pin of the PowerBoost module as long as we keep the Raspberry up and running. At this point, if we executo the command halt the Raspberry will start the power off sequence and at the en, it will deactivate the UART interface, making UART_TXD pin going back to Low. That means, that no signal will be pulling EN high and therefore, the Powerboost module will be automatically disabled.
Low Battery signal
The PowerBoost module can signalize a low battery status. The signal must be adapted since it is not 3,3v compatible with the expected voltage range input of the RPI. Whe the battery level is higher than 3,2V, the LBO pin will have VBAT value. When the battery goes below 3,2v LBO will be 0v.
Since VBAT can reach values of 4,7v for a Battery recently loaded, it is important to make sure that we do not let the RPI GPIO be exposed to this “high” voltage. This issue can be easily solved by adopting the following implementation:The principle is more than simple and self explanatory. In case you are still wondering what it does, here is some help:
The VBAT coming from LBO doesnt ever reach the Raspberry Pi GPIO port. Only the 0V does. LBO can go from 3,2v up to 4,7v. When LBO outputs VBAT, the diode is non-conducting and thus, the GPIO is pulled to 3.3V by the resistor. When LBO outputs 0V, the diode is conducting and the GPIO is pulled to 0.4V by LBO. The pull up resistor can be easily implemented as an internal pullup when configuring the RPI GPIO 😉
Adding a diode in parallel with the motor provides a path for the dissipation of stored energy when the transistor is opened. The flyback diode allows the charge to dissipate without damaging the transistor, or without flowing back to ground through the +5V voltage supply. For further references, the following link contains additional information about this: https://cdn.sparkfun.com/assets/resources/4/4/DC_motor_circuits_slides.pdf
R1 should be 1 KOhm in order to make sure that the transistor switches correctly.
The following pictures show how the haptic motor was implemented. Since here size does matter, I tried to keep it as small as possible!
The motor was then glued below the adapter board and it fitted nicely in the lower right corner. The motor itself is then also glued directly to the metallic case. The first attempt I did was gluing it to the 3D printed base, but the vibration was somehow attenuated.
Make it look nice!
I have included on the 3D files a support that fits the Spotifypod nicely. The iPod can sit on this support while charging its battery through its usb port.
This is work in progress! Stay tuned for more 😉