Three major elements can be broken down for our project: Platter (the spinning top-plate of the record),
Tone-arm, and the Speaker.
The platter will be emulated with a motor that runs when music is played and stops otherwise.
Typical record players spins at 45rpm, and the DC motor in spins at 100rmp at 6V. Given 5V power supply,
PWM signal with a 54% duty cycle (provided by the microcontroller) will bring the motor's rpm to the desired
45rpm.
Similar to the actual record player, the tone-arm will primarily be used as a hard stop for the playing of the songs.
The base of the arm will be a rotary potentiometer and be connected to the internal comparator of the microcontroller.
Vref can be configured so that when the arm is out of the record's range, Vout rails to ground.
The speaker will be connected to the DF player module, which will be communicated through UART.
Record Player
Preliminaries
Universal Asynchronous Receiver/Transmitter (UART) is a serial protocol that uses 2 wires as a receiver and a transmitter. Each transmission has a length of 7-9 bits: start bit of zero, data bits, an optional parity bit, and a stop bit of 1. The parity bit is incorporated when accuracy of data is crucial. The size of the entire UART frame varies for different devices; in particulat, our DFplayer module utilizes 8-9 bytes of data.
A voltage comparator is an integrated circuit that compares two voltage inputs: Vin and Vref . When Vin > Vref , the output of the comparator will rail to the VDD of the device. Otherwise, the output will rail to its virtual ground, VSS . PIC16F627A possesses two comparators, which we will be utilizing one of for this project.
Prototype
Below is a draft of the schematic.
Pins Description
# 1, 2, 3, 4, & 5 are buttons that performs individual tasks: play song, pause song, song toggle, vol up, and vol down.
# 8 & 9 are those of the internal comparator: Pin 8 as Vref and pin 9 as Vout .
# 10 outputs pwm signal that is responsible for controlling the speed of the motor.
# 13, 14 & 15 LEDs act as an indicator for current song selection.
# 17 & 18 are data pins of the DF player module. Pin 17 is the controller's UART TX pin.
Pin 18 is set high by the DF player module when a song is playing, and low otherwise.
We use this to prevent overlapping "play" input. Controller's RX pin is not used since we are not expecting any fedback from the module.
Code for the microcontroller can be found here as "Project_main.c".