MP3 Player Cassette V2
by Gammawave in Circuits > Microcontrollers
187 Views, 1 Favorites, 0 Comments
MP3 Player Cassette V2
This is an update to a previous project MP3 Player Cassette aptly named MP3 Cassette Player V2
How is V2 different from the first version.
1: A PCB was designed to reduce the wiring, ease assembly and limit assembly faults.
2: A complete cassette was designed with all cut outs to simplifying the build process by negating manual modification of a cassette body.
3: The tape wheels (reduced in size), could now be included due to the reduced wiring and position change of the Dfplayer.
4: Modifications were applied to the retainer resulting from the previous changes.
5: Switch panel symbols to harmonise the layout style.
Some of the steps are unchanged from the original, However, rather than link to the previous version for the steps that remained unchanged I decided that it should stand completely as a self contained project.
Supplies
Filament - PLA Orange, Red and Black, although personal taste may dictate otherwise.
ESP32_C3 with 0.42 in OLED display
DFPlayer Mini MP3 Player
Tactile Switch 6(w) X 3.5(d) X 5(h) mm
Tactile Switch 6.2(w) x 6.2(d) x 3.2(h) mm - Qty 5
Springs 0.4(dia.) x 3(W) x 10(L) mm - Qty 2
Battery LiPo 3.7V/150mA 27(L) x 20.5(W) x 4.3(T)mm
Brass Rod 1.5(dia.) x 14(L) mm - Qty 2
M2 x 3mm countersunk machine screws - Qty 4
M2 x 8mm countersunk machine screws - Qty 8
Wrapping wire (30AWG single core)
100k resistor SMD 1206
43k resistor SMD 1206
Wired head/ear phones with a 3.5mm stereo plug.
0.04 in (1mm), terminal post - Qty 27
Clear adhesive tape
Masking tape.
May prove more cost effective to buy a range of values rather than individual values unless you already have them available. Some components may also have a MOL greater than the quantity specified in the component list.
No affiliation to any of the suppliers, feel free to obtain the supplies from your preferred supplier if applicable.
Links valid at the time of publication.
Tools
3D Printer
Rotary Burr
Small electric hand drill
Countersink drill bit
2 mm drill bit
3.5 mm drill bit
Wire Cutters
Small screwdrivers
Hard plastic glue
Soldering Iron
Solder
Needle Files
Sanding paper
Know your tools and follow the recommended operational procedures and be sure to wear the appropriate PPE.
Circuit
The circuit consists of an ESP2_C3 mini with integrated OLED display programmed in MicroPython.
This is a small footprint microcontroller with 16 accessible pads.
See attached diagram and details below.
Power is provided by a rechargeable LiPo 3.7V/150mAh battery connected via a slide switch to B+ (battery -Ve to B-), on the boost/charger which provides 5V to the VBUS pin (1).
A potential divider consisting of two series resistors are connected across the battery when the power switch is activated and used to monitor the battery voltage. (See Battery Monitor step)
The output from the ESP32_C3 3V3 pin (3) is connected to the DFPlayer supply pin (1).
From the ESP32_C3 pins 4 (RX) & 5 (TX) are cross connected to the DFPlayer at pins 2 (RX) & 3 (TX).
The output from the DFPlayer pins 4 (DACR), 5 (DACL) and 7 (OV) are connected to the earphone socket pins 4 (Tip), 3 (Ring) and 2 (Shield).
The Tape head inputs have serial 1kR resistors and are also connected to the earphone socket at pins 2, 3 & 4,
A switch is mounted behind the Tape head which initiates play when the mechanical play button is pressed this switch is connected to ESP32_C3 pin 8 (GPIO 0)
The user controls are connected with internal pullups (resistor from pin to 3.3V), to pins 9 (GPIO3) [VOL-], 10 (GPIO4) [VOL+], 14 (GPIO8) [FF], 15 (GPIO9) [REW] & 16 (GPOI10) [Play/Stop] via switches to OV.
The 0V line connects to -Ve on the charger/booster, the switches, pin 2 on the ESCC3, Pins 7 & 10 on the DFPlayer, pin 2 on the earphone socket and to the Tape Head.
The GPIO and pin allocations are as follows.
GP21 [p05] TX UART0 DfPlayer (RX [p2])
GP20 [p04] RX UART0 DFPlayer (TX [p3])
GP05 [p11] SDA I2C0 OLED [internally connected]
GP06 [p12] SCL I2C0 OLED [internally connected]
GP10 [p16] Button1 play/stop
GP09 [p15] Button2 rewind (REW)
GP08 [p14] Button3 fast forward (FF)
GP04 [p10] Button5 Vol +
GP03 [p09] Button6 Vol -
GP02 [p06] Battery Monitor
GPO0 [p08] Tape head Switch
PCB Design
The PCB was designed using KiCad* PCB Editor 10.0.4 and fabricated by JLCPCB*.
*No affiliations to these organisations.
Due to the small space requirements I decided to have the PCB fabricated using a 2 layer flexible PCB (FCB), with a yellow finish.
Using a PCB will reduce most but not all manual wiring.
The external control switches on the cassette body, tape head and headphone socket require manual wiring.
Pins Preparation
Some of the elements such as the Charger/Booster and Microcontroller are pin mountable.
Therefore, I needed a way to secure pins to the PCB and also mount the required elements.
I had some double ended 1mm terminal pins available which were a tight fit and therefore required turning down.
This was accomplished with an electric hand drill with the pin held in the chuck and whilst spinning applying a needle file to the surface to reduce the pin diameter to ~0.5mm
Finally the opposite end that had been inserted in the chuck is cut off and filed flat. Once inserted in the PCB hole the shoulder prevents the pin going all the way through.
The pins are inserted in the required holes and soldered in place.
During soldering a piece on stripboard is used to maintain pin spacing and alignment.
Cassette Design
Rather than modifying an existing cassette I decided to create a 3D printed cassette body to remove the task of manual modification.
This would allow a variety of single or mixed colours to be realised to suit personal taste.
The cassette body is designed in 4 pieces, 2 pieces per side (body and step).
This allows these parts to be printed flat on the bed without supports.
The step is glued to the body to create one side of the cassette.
The design incorporates all the cut outs for USB socket, SDcard and headphone jack.
Print details
Filament: PLA Orange
Layer height: 0.1mm
Infill: 100%
Bed Adhesion: Skirt
No supports
Post processing
The edges of the cassette body in contact with the bed may need to be sanded smooth.
Battery Monitor
The battery voltage is monitored using a potential divider consisting of two resistors (R1 = 100kR and R2 = 43kR), in series.
This is connect across the battery when the power switch is closed.
The potential divider ratio is 0.301 this multiplied by the applied battery voltage (Vbat), gives the centre tap voltage (Vct), for the resistor network. This is applied to the ESP32_C3 pin 6 (GPIO 2)
Vct = (R2/(R1+R2)) * Vbat
The potential divider ensures the voltage applied to the GPIO pin is considerably less than the absolute maximum of 3.6V.
In this case even if the potential divider is connected to 5V, Vct = 1.5V
The battery charge, discharge cut offs and nominal voltage specs are 4.2V, 3V and 3.7V
Current drain on the battery of 29.4uA = Vcharge/(R1+R2) = (4.2V/143kR), plus additional pin leakage (<50nA).
These values yield Vct voltages of 1.26V, 0.902V and 1.11V which are catered for by ADC_6db attenuation with a linear range of 0mV to 1300mV. Reference ESP32_C3 Datasheet
The actual value will likely differ from the calculated values due to component tolerance, non linearity, noise, drift and other variances.
These effects can be compensated for with filtering, calibration, tight tolerance components, entering numerical values for calculations that match actual values but always verify the results against a reference to assess the offset.
A moving average filter is applied to the raw data.
Subject to variation a 100nF MLCC (Multilayer ceramic capacitor), can be connected between the ADC input and 0V
Use 1% or better and SMD resistors due to the small space.
Confine voltages within the linear range of the ADC.
However, the monitor will not be displaying the voltage but a percentage of charge based on the charge and discharge cut off limits using the following:
Vpct = int(((vf - Vpd_min) / (Vpd_max - Vpd_min)) * 100)
where
vf = round(((adcval / 65535.0 * 1.6) - Verr),2)
(adcval = moving average value, 65535 due to using adc.read_u16, attenuation = 1.6, Verr is offset correction.)
Rratio = R2/(R1+R2) = 43k/(100k +43k) = 43k/143k = 0.301
Vpd_max = round(bat_max*Rratio,2) = 1.26V if bat_max = 4.2V
Vpd_min = round(bat_min*Rratio,2) = 0.902V if bat_min = 3V
Therefore, if the battery voltage = 3.7V, vf = 1.11V
Vpct = int(((1.11 -0.902)/(1.26 - 0.902)) * 100) = 58%,
A variation of 10mV equates to 2.8%.
Retainer
The retainer fits within the cassette with compartments to retain the main elements in place with routing channels for manual interconnecting wiring.
Open areas were left under the MP3 module and the microcontroller as these did not compromise the integrity of the retainer any additional material under these elements would impact closure.
Under the areas upon which the charger/booster and battery sat a thin layer (<=0.2mm), of material was added to maintain structural integrity whilst not impacting closure.
Reverted back to a more rigid filament due to fine vertical partitions being less robust.
Adjustments were made to the positioning of the DFplayer to move it closer to the corner and further from the cassette spools.
Cut outs for the decoupling capacitor, potential divider, front panel switches, tape head switch and tape head terminals.
Fingers to align and retain the power switch.
Lower corner fingers to reduce movement.
Additional screw fixing locations which incorporate locating cut outs.
Print Details:
Filament: PLA Red
Layer Height: 0.1mm
Infill: 100%
Build Adhesion: Skirt
Post processing
The extreme edges of the retainer may need to to sanded smooth to ensure a fit into the cassette body.
Downloads
Cassette Spool
Printing and assembly
The cassette spool consists of two halves which once printed are stuck together.
Its printed as two halves as a lip is required on both sides to retain it between the two halves of the cassette.
Two completed spools are required.
Print details
Filament: PLA White
Layer Height: 0.1mm
Infill: 100%
Build Adhesion: Skirt
Post processing
Lightly sand the base of the spools and clean with IPA and allow to dry.
Ensure the cut outs on the outer circumference of the spool and the inner teeth align.
Apply a plastic adhesive and allow to dry.
Ensure the inner surface of the spool is clear of aberrations that may prevent the sprockets in the player fitting using a needle file.
Downloads
Centring Frame
The centring frame is used to align the tape heads between the cassette and the player.
Once assembly is complete this is fitted by simply sliding over the tape head.
Dimensions
Outer: 13.875(w) x 9.875(h) x 4(d) mm
Inner: 12.5(w) x 5.5(h) x 4(d) mm
Print Details
Filament: PLA Orange
Layer Height: 0.1mm
Infill: 100%
Build Adhesion: Skirt
Post Processing
There may be a lip on the inner and outer edges at the surface in contact with the print bed.
With a needle file remove the lip to level the sides.
Downloads
Tape Head
The tape head was removed from a multi cassette adapter.
Alternatives are one from an old tape machine or purchasing individual heads.
If you use a different cassette adapter it may result in a different removal method and/or an incompatible fixing.
The tape head is connected via signal limiting 1K resistors and a small PCB to a lead which at the end has a 3.5 mm jack plug.
Once removed from the case most of the lead connected to the jack plug would be cut off, leaving a short length connected to the tape head PCB.
The two springs would also be used in the project.
However, in the event that a spring or springs gets lost alternatives are listed in the supplies.
Removal of the tape head is straight forward.
The spring retainer is a friction fit and can simply be removed by pulling it out with small pliers, taking care not to lose the springs.
Ensure that the solder connections on the tape head PCB are filed level but still slightly raise by ~1mm so as to retain structural integrity whilst maintaining the electrical connection.
Switch Cover
The switch cover was modified to simplify the theme and layout and was applied to the volume symbols, removing the + & - and the V's become up and down arrows.
The buttons are mounted on the exterior of the case in a 3D printed cover.
Print Details:
Filament: Black PLA
Layer Height: 0.1mm
Infill: 100%
Build Adhesion: Skirt
Dimensions: 65(l) x 19(w) x 2.5(h) mm
Post Processing
Smooth the edges with sanding paper if necessary to remove any irregularities
Assembly
Five tactile switches are required to control the player.
The functions are annotated with a letter and/or with symbols.
1: ^ - Increase Volume
2: V- - Decrease Volume
3: >= - play/stop
4: >> - Fast Forward
5: << - Rewind
Arranged left to right in the order listed above.
The switch cover is designed with pockets within which sit the tactile switches.
A single enamelled coated wire {ECW), connects the same terminals of all the other switches together and this wire becomes the common switch terminal.
Single wires connect the remaining terminal switches to the microcontroller.
Once all the switches are wired and aligned in the pockets a strip of clear tape is used to keep the switches in place and attached to the cover.
The switch cover with switches is mounted on the front of the cassette body using 4 x M2 x 3mm countersunk screws.
Align the switch cover such that its step meets with the step in the cassette body.
Feed one wire of each switch through each of its associated holes and secure the retainer in place with 4 x M2 x 3mm countersink machine screws at the two ends and the two centre of the retainer.
Run the wires parallel to each other and coincident with the step and tape in place.
In order to improve legibility of the symbols on the switch cover a slip of paper can be placed under the gap between the switch cover and the cassette body, white or a fluorescent yellow are ideal.
Downloads
Tape Head Switch
Fitting the tape head in the cassette retainer.
Prior to fitting the tape head a switch needs to be fitted in the pocket behind the tape head.
Solder (keeping application to a minimum), two long wires [6cm (0V)and 3cm (GPIO 0], to the switch and test operation with a DMM if there are no issues pass the wires through the two holes either side of the switch pocket.
Test the fit of the switch in the pocket as excessive solder can impede the fit.
Remove any excess solder as necessary to allow the switch to fit.
Refitting the Tape Head
The removed tape head is fitted to the retainer with two 14(L) x 1.5(dia.) mm brass rods and the springs.
The rods are cut from longer stock either using a hacksaw or a stout wire cutters.
Be sure to round off at least one end on each rod to enable easier insertion.
The rods are passed through the front of the two holes in the retainer, through the holes of the tape head PCB and through the springs and into the coincident holes.
The tape head requires a horizontal front to back travel of 4mm with the switch activated at the end of the tape heads travel.
The short wire stub from the tape head is passed through the channel that runs behind and parallel to the tape head.
The end of the stub is attached to the three terminal pins (TS/J8), identified from left to right; R, L and 0V.
An additional length of the wire used to make the stub is extended from the earphone socket to the nearby terminal pins identified from left to right; R, L and 0V.
Switch Shim
The switch shim sits between the tape head and the switch.
This controls the amount of travel required to activate the switch when the head of the cassette player contacts the head of the tape cassette.
It may be necessary to adjust the thickness to compensate for variations in travel between players.
The shim can be sanded thinner if necessary or the thickness increased by the addition of thin tape or by a suitable thickness of clear flat PET from a blister pack.
The switch shim has the raised centre due to the step in the cassette body which would prevent a uniform shim making contact with the switch button.
Dimensions: 15(l) x 7(w) x 1.75(h)
Downloads
DFplayer Mini
The DFPlayer Mini as supplied comes with headers.
However, these headers prevent the DFPlayer fitting into the cassette.
To enable it to fit within the cassette the header pins will need to be shortened by cropping the pins.
An alternative is de-soldering although the possibility of opens due to track breaks or shorts due to solder bridging or localised heat related issue were considered but cropping and sanding were considered less damaging.
Preparing the DFPlayer.
Due to the likelihood of static generation during this process that may damage the device observe anti static precautions
With cutters crop the pins close to the body of the header.
Next carefully remove the body of the header by pulling with pliers.
Tightly wrap the device with aluminium foil, ideally placing the sanding paper on an ESD mat and wearing an ESD wrist strap. In any event sanding in a slow circular should be favoured instead of rapid circular motions to reduce static build up and allowing dissipation between cycles.
Lightly sand the header pin stubs on a sheet of sanding paper level with the IC's taking care not to sand the text off the IC's.
Carefully remove the foil and remove any dust with an air blower and/or static free brush.
No issues were found using this method.
Micropython Install
Micropython will need to be installed on the ESP32_C3 prior to use if this is not already the case.
Installing Micropython using Thonny.
Within Thonny select the following:
Tools > Options
On the options menu select the Interpreter tab.
Select the 'Micropython (ESP32)' from the dropdown.
Plug the ESP32_C3 into the USB port whilst holding the Boot button.
Select the port on the 'Port or WebREPL' dropdown.
Select 'Install or update Micropython (esptool)' then OK
On the resulting menu populate the empty fields as per the example image.
Noting that the Target port will reflect your USB port allocation.
Select Install
Once installation is complete close the window.
A successful install should show the version in the Thonny Shell.
If its not shown select Run > Stop/Restart backend to refresh the Shell.
Since the previous version was created a new version v1.29 has been issued.
Application Software
Prior to wiring the elements together load the software on to the microcontroller as this will cause less disturbance to the wiring.
Create a folder on the ESP32_C3 named lib.
Into this folder copy the following libraries.
ss1306oled042b.py (OLED display driver)
dfplayer.py (DFPlayer mini driver)
Save the file dfplay_espc3_6.py to the ESP32_C3 as main.py in the root directory.
This will cause the application to autorun on powerup.
References to sources for the libraries (display and DFPlayer), used are listed in the software.
I was able to upload the library files as text/py files however for some reason I was unable to upload the application file as is which is also a text/py file. Therefore this had to be converted to PDF before uploading.
Wiring
Plug in the USB lead in the charger/booster..
Monitor the voltage at the output pads of the charger/booster with a DMM and adjust the potentiometer to set the output to 5V.
Remove the USB lead and put this to one side while the rest of the circuit is being built.
Colour coding the wires can aid in wiring consistency and fault finding.
In the absence of colour coded wiring a simple stripe marking system can be applied to the wires with a permanent ink pen. 1= 1 stripe, 2 = 2 stripes etc.
As the new design utilises a PCB much of the wiring is simplified or negated.
However, terminal pins are used to attach the charger/booster, microcontroller, battery and switch and wiring from the tape head and headphone socket.
Prior to populating with pins or attaching modules tin the required pads with solder.
Insert and carefully solder the pins to the PCB, the pins are held in alignment with a strip of perforation board.
Solder the SMD 43K & 100K resistors and 100nF capacitor to the PCB.
Align the DFplayer on the PCB and carefully solder the pins to the PCB
Fit the retainer in place.
The wires on the battery as supplied are too long and need to be shortened to around 7mm in length.
Sit the slide switch in its pocket and solder to the terminal pins.
Place the battery in its respective pocket and solder the +Ve lead to the B+ terminal and the -Ve lead to the B- terminal.
Ensuring the power switch is in the off position.
Fit the charger/booster in its pocket and solder the four visible pins.
Wire the the tape head switch to terminal TS and 0V.
Wire the tape head to the earphone socket.
Wire the control switches to the ESP32_C3 at the relevant pads keeping the wires as short as reasonably possible as this will enable the top half of the cassette shell to be removed allowing easy access to the required elements.
The wires from the front switches should be short, parallel and held as flat as possible whilst allowing the two halves of the cassette to open out flat this ensures minimum bunching when closing the two halves.
In this respect the wires are held in place with tape, glue could be applied but this make repositioning difficult.
As during the wiring process it may be required to close the two halves of the cassette to check the wiring position and high spots.
Temporarily secure the two halves of the cassette together with lengths of masking tape on the two sides and along the top. As this will prevent screw holes being worn by over use.
Remedy any high spots found.
Finally connect the ESP32_C3 to the pins and solder in place.
Double check the continuity of the connections to ensure there are no shorts or open circuits.
Check that the cassette closes evenly around the edges.
Secure the cassette body with eight M2 x 8mm countersunk screws.
Setup
Due to variations in the mechanical mechanisms in different cassette players, some adjustment to compensate for these differences may be required.
The cassette head may have insufficient travel due to the switch being too far forward, preventing the players mechanism locking in place.
Alternatively, the switch may be too far back and not engaged by the cassette head.
1: Switch.
This can be moved forward by adding a 6(l) x 3.5(w) mm spacer of suitable thickness behind the switch.
Additionally the switch shim included can be thinned by sanding.
Sanding down the solder on the back of the cassette head PCB ensures the switch shim connects squarely with the switch button.
Check that the switch engages when the cassette tape head is pressed.
2: Centring Frame.
Designed to align the heads of the player and the cassette.
However, the player head can have different configurations which may affect how this interfaces with the cassette head, such as two to four tape guides which could be straight or bent.
This may require some filing of the centring frame to prevent fouling.
Temporarily secure the two halves of the cassette together with lengths of masking tape on the two sides and along the top.
Fit the frame around the cassette tape head.
You should be able to press the cassette tape head to engage the switch and the head should return to its rest position. If it sticks file the inner surface of the frame to widen the opening
Remove the temporary tape and secure with the screws.
Music Files
The DFPlayer supports MP3, WAV and WMA formats on a MicroSD card up to 32Gb.
Prior to use format the MicroSD card to FAT32.
Using this library you can create up to 99 folders with 255 files per folder.
Each folder is numbered sequentially without gaps using the format NN, E.g. 01, 10
Each file is numbered sequentially without gaps using the format NNN, E.g. 001.mp3, 010.mp3, 100.mp3.
Unfortunately this entails renaming a clear filename to a numeric filename losing any descriptive meaning.
Operation
The unit can be powered by USB only with the power switch disengaged or via the battery with the power switch engaged.
Charging is accomplished with the unit powered by USB and the power switch engaged.
Charging current consumption is dictated by the state of battery charge reducing as the battery nears full charge.
Operational current consumption is ~50mA.
There are two modes of operation stand alone and paired.
In either mode the unit requires a correctly formatted Micro SD card with the required folder structure and naming convention.
Switch on the player using the slide switch situated on the upper left hand side.
If there are music tracks on the player the display will show the number of directories and files and stop in the following form.
DNN FNN
STOP []
If there are no tracks or no SDcard the following will be displayed:
No_Trk
STOP {}
Stand alone mode
In this mode of operation the player is controlled by the front panel buttons.
Insert the 3.5 mm plug of the headphones into the socket.
Adjust the start track using the FF or REW buttons if required and press play
Adjust the volume as necessary this will be shown on the display as VOL NN (where NN is the value)
The player will progress through the tracks until it reaches the end of the files and stop.
Pressing play/stop at any time will stop the player at the current track.
Press play/stop to continue playing.
The battery charge will be shown on the display in the following form Bat NN% (where NN is the value)
Paired mode
Not to be confused with BLE pairing, this requires two devices the tape cassette player and the MP3 cassette.
Insert the cassette into the tape cassette player and press the play button on the tape cassette player.
The player will progress through the tracks until it reaches the end of the files and repeats from the beginning.
Press stop on the tape cassette player to stop the player.
The control buttons are not accessible due to the door or flap on the tape cassette player.
In either mode do not forget to switch off the MP3 cassette to save battery power.
Display Blanking
The display will be blanked after a period of time (60 sec), to conserve the display due to pixel ageing if the buttons are not pressed. No significant reduction in current consumption occurs with the display blanked.
If a button is pressed the display will be reactivated and reset the blanking timer.
Finally
Thanks for reading.