Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Synopsis

Title: Music Recognition Marionette Dancing Pinocchio Organization where the project work is carried: Don Bosco Institute of Technology, Bangalore Objective: The purpose of this project is to design a dancing puppet which is musically controlled by the microcontroller. This is a simple, inexpensive dancing puppet, which can dance to any tune you want. For as little money as possible, you can bring Pinocchio to life. Pinocchio can move, twist and dance to whatever tune is being played. With a smart efficient synchronizing system, two motors, and other electrical domains such as analog circuit design, to create the most imaginable Michael Jackson puppet ever. Methodology: Software Design

ADC Filter Interface Each time the ISR fires, each ADC value is stored in an array: Abuffer. That buffer is of size 128. When that buffer is full, the ISR signals the higher hierarchy, that the buffer is full and filtering is ready to be done. This is done by setting the flag set_ready high. Bass / Midrange Frequency Signal Detection In the function filter(), after the two filtered buffers Abuffer_filtered and Abuffer_filtered_high have to be created, we analyze those buffers to detect if a strong enough signal have been heard at those frequencies. For example, if one of the array elements in Abuffer_filtered is higher that some settable threshold value, then a strong enough bass signal has been heard and we use that fact to control the motors. This is set as a threshold level which is defined as a global variable upper_th. The same check is performed on the mid-range frequencies Abuffer_filtered_high and the settable threshold variable is upper_th_hp. When such a high bass signal is detected, four actions are taken. LED5 is turned on, a flag motor_on is set to be used by the motor controller code, and timers t_motor and t_led are initialized to zero. Those are used to control how long the LED or the motor needs to be ON. A different kind of puppet action/dance is desired when a mid-range strong signal is detected. Such signals are, for example some voice signals, guitars, pianos. For those signals, we want a slower dance move. The puppet dance has two modes: A fast dance mode when bass signals are detected, and a slow dance mode when mid-range frequencies are detected. The switching between those two modes is done with a if else statement in the main while loop and implemented with the help of a variable called special. That variable is set when a mid-range frequency signal is detected. To change the dance mode from fast to slow when such a signal is detected, we change the timing of the motor, by increasing the variable time_motor_on. That makes the motor oscillate with smaller and more constant amplitudes, producing a slow dance. Motor Controller Restricted by the physical setup of the motor and the marionette, a good dance move is achieved by rotating the motor forward and backward at a fixed frequency. To achieve that, an algorithm to switch the direction of rotation each time a strong signal is detected had to be implemented. Two variables motor_fwd and motor_back are constantly set to oscillate from one to zero, one always opposite to the other. The distance of one rotation or the amplitude of the rotation is controlled by timing. This is done in the following way: As soon as a strong signal is detected, the timer t_motor is set to zero. That timer is incremented at a rate of

one every 0.5ms in the timer 0 compare interrupt. When that timer has reached a desired set value, we turn the motors off and wait for the next strong signal detection. The higher that desired set value, the further the motor would have rotated. The motor values are set using a decimal value like 1+128 which represents a binary value of 10000001. This equals to the binary number when converted as mentioned before. Being a stepper motor we move it in four steps from 0 to 3. Hardware Design The hardware design was basically split into two parts. The first part involved the basic RC Low pass filter and DC bias circuitry. This is shown in the following schematic diagram:

Fig. 3 Low Pass RC Filter and Voltage Bias circuit Here, the music is being fed from a source, namely the laptops music player Winamp. This can be replaced by any other music player, like, Ipod, MP3 etc. We initially used the Ipod for feeding the music for processing to the ADC, and shifted to playing music on the laptop due to the limitations of its battery power and plug sockets on the supply line. The music from the player is fed via a 3.5mm stereo phone jack to the speakers and the ADC. The signal is divided into two cleverly, by connecting the speaker pins directly to the ground and the signal output of the phone jack with the help of banana clips. This is done so that we can see the puppet dance to the right beats. The musical signal from the source goes to the ADC and the speaker simultaneously. In Figure 3, a two-pole RC analog low- pass filter has been used to pass the lower frequencies, removing any high frequency. The resistor values were chosen as 1K each and capacitor values as 0.1uF to give a suitable time constant for the sampling frequency. At the current sampling rate of 2kHz, we are able to filter out the treble and input the typical music for decoding. We can accurately detect the highest frequency of 1kHz. Thus, filtering, removing treble and DC biasing the signal gives a processed and conditioned output from the source ready to be fed into the ADC. The second major hardware piece involved connecting the motors. We use two stepper motors for a better control over the dance movements of the puppet. This is the output side of our system. It consists of the two motor drivers to drive the two stepper motors rated 12 Volts each, a 9 Volt power supply and PORTC pins of the microcontroller. Expected outcome: To move to the music played consequently and swiftly. Applications: Entertainment

You might also like