This Tin Can tracks the phonogram with a microphone and opens its mouth
depending on the amplitude of the sound.
Step 1: The Video
The video can be viewed here https: //www.youtube.com/watch?v=X7r2SEcHtv8
Step 2: The Block Diagram
The block diagram of the device is shown in figure.
The microphone detects sounds and converts them into electrical oscillations. Of notice is that the device uses an electret microphone. The advantage of electret microphones in comparison with all others is that inside the case it already has thefirst amplifying stage that allows to make the first cascades of amplifiers less sensitive and less demanding to the shielding of the input circuits.
The microphone amplifier boosts the signal coming from the microphone to a level that can be handled by the signal detector and the ADC.
The signal detector.
The detector is meant to determine the signal power. It converts the incoming sine wave signal from amplifier to the average level of amplitude.
Microcontroller ATtiny13A has an analog-to-digital converter on board. Its task isto measure the value of the analog signal at ADC input of the microcontroller and instantly convert it into a digital value. The frequency of the conversion process is determined by the program of the microcontroller. The signal at the ADC input is sent from the signal detector.
The Pulse-Width Modulator provides PWM-signal with the specified parameters for servo. The period of the pulse repetition depends on the setting of frequency dividers of the microcontroller, and the pulse width depends on the number recorded in the register of comparison. The pulse width should range from 1ms to 2ms and depends on the current amplitude value of the input device in digital form.
Step 3: The Structure of the Control Signal
So, you should rotate the servo to a certain angle depending on the received signal. In this case, the servo is analog, i.e. it is controlled by the pulse width received at its input. The structure of the control signal is unified for analog servos and is shown in figure.
The servo is controlled by pulses of variable duration. To rotate the shaft of the servo to a 0 degree angle the PWM generates a series of pulses with a 1ms width. To rotate the shaft of the servo 180 degrees from the zero position the PWM generates a series of pulses with a 2ms width. The rotation of the spindle servo can be performed at any angle ranging from 0 to 180 degrees. For that the PWM needs to generate pulses between 1ms to 2ms.
Step 4: The Circuit Diagram
BM1 – electret microphone type CZN-15E
M1 – servo Mistery S0009 or EMAX ES08MA
D3 – any LED 5...15mA
The device is powered from a USB port of a computer or a charger with a USB output. The supply voltage is 5 Volts.
M1 – servo Mistery S0009 or EMAX ES08MA
Step 5: The Printed Circuit Board
Sketch of the PCB and the PCB with elements are shown in figures.
Step 6: The Mechanical Part #1
First, open an aluminum can with a can opener. The edges of the neck should be smooth and harmless.
Step 7: The Mechanical Part #2
The can is made of very thin aluminum. It is not recommended to secure the moving parts on its walls. And you need to keep the outer look of the device. So you should use rebar – a tin cup made from ordinary tin cans needs to be tightly inserted in the neck of the aluminum can.
Carefully use the scissors to cut the metal bottom. You need to get strips of sheet metal – we will make the insertion from it. The edges of the metal strip should be compressed by pliers. Measure the inner diameter of the neck of the can. The diameter is 52mm. The circumference of the insertion must be 52mm х 3,14=163,28mm. Cut off part of the strip 170mm long (with reserve!).
Step 8: The Mechanical Part #3
Next you bend the strip to the diameter of the can, insert the strip into the neck of the can, and mark the final strip cut to fit its ends toe-to-toe. Cut the strip at the mark. Check the position of the strips in the neck of the can. Make sure that the ends of the strip come together toe-to-toe.
Next you should polish the soldering seam with a sharp knife, and fill it with soldering acid. After that you should solder the ends of the strips. The insertion is ready! Pay attention to the edges of the insertion, they do not allow it to fall to bottom of the can.
Step 9: The Mechanical Part #4
You should mark a line on the top of an ordinary tin can. Cut by the line, put on the bottom of the inside edge of the insertion and solder.
Step 10: The Mechanical Part #5
Next you prepare the top of the device. It will be the mouth. ))) You should cut the neck of the second can with the scissors. Measure the inner diameter of the top. It is equal to 50mm. Cut a circle with a diameter of 50mm from the bottom of the tin can.
Step 11: The Mechanical Part #6
Bend hinges from a paper clip and solder them to the insertion.
Step 12: The Mechanical Part #7
Insert a paperclip into the hinge and bend. Solder the lower part of the top to the paper clip.
Drill two holes in the upper and the lower parts of the top and connect both parts with screws.
Step 13: The Mechanical Part #8
Installation of the servo. To install the servo you should make a bracket according to a template. The template will be different for other types of servo. Set the servo to the bracket. Mark and drill two holes with a diameter of 2.5 mm in the bottom of the insertion for mounting the bracket.
Step 14: The Mechanical Part #9
Cut a 3-4mm wide slit in the bottom of the insertion. Through this slit, the servo will move the to[ by means of thrust. Be very careful when doing this operation not to injure your hands (!!!).
Install the servo on the bracket inside the insertion and fasten it by screws.
Make the thrust from a paperclip.
Make a hinge from a paperclip for the top of the device. Solder the hinge to the top of the device over the insertion slit. Insert the thrust into the hinge and bend the thrust. Put the other end of the thrust into the slit to connect it with the lever. Connect the lever to the servo.
Step 15: The Mechanical Part #10
To mount the indicator and the microphone, make two boards: external and internal. Both boards should be tightened tightly by screws.
Solder nuts to the internal board ,install the power indicator (led) and the connector to the microphone.
Next, solder conductors for connecting the indicator to the inner circuit board and microphone connector to the main board of the device.
Step 16: The Mechanical Part #11
Then make a slit in the can with a sharp knife and install the boards. You can make a slit with a paper knife.
The board for the mini USB connector is installed in a similar way.
Step 17: The Mechanical Part #12
Electret microphone is connected to the device via the connector.
Screw two tin staples to the "mainboard". Solder the brackets to the insertion. Attention! Staples should be placed inside the insertion!
Attach exterior units to the main board: servo, connector mini USB, connector with indicator and microphone.
Finally, insert the insertion into the aluminum can and attach the eyes to the top.
Step 18: The Program
To load .hex file of the program into MCU you need to connect the AVRISPmkII programmer to the ISP connector on the circuit board of the device. Setting the "fuses" of the microcontroller: LOW = 0x7A, HIGH = 0xFF.
.hex file and C code are attached to this article.
The URL of the first publication: