Introduction: Arduino + Mp3
I love light, physics, optics, electronics, robotics and everything related to science. I started working with data transfer and wanted to try the Li-Fi method, something innovative and that is growing.
I know about the high data transfer speeds achieved by the Li-Fi, so I wanted to work something related to this and come up with something useful. In this project, I thought of making it economical and interesting, so I decided to use something that everyone likes, music.
At first I thought it would be something expensive but as everything worked in digital it turned out to be incredibly cheap to perform.
With the ease of arduino I can generate frequencies to produce sounds, the project is to code a song and leave everything ready so that people can code other songs and sending data through LED without having connected the horn directly to the Arduino.
Step 1: Design
We can observe that the project was carried out in a protoboard, since tests are being carried out and soon amplifiers will be added to improve the signal. Something that I observed is that the horn signal is very low therefore I must amplify the signal before connecting to the horn.
Step 2: What You Will Nedd
Tools and equipment:
- Multimeter: At least you need to check the voltage, polarity, resistance and continuity for troubleshooting.Go Link
- Cautín.Go Link
- Welding.Go Link
- Cutting pliers.
- Jack: We can recycle many audio objects, in this case I found one that was used to connect to non-functioning speakers.
- Arduino: We can use any arduino, for this purpose I used an arduino one.
- LED: I recommend an LED that generates white light, since it did not have white light LED I used a RGB LED taking in always the 3 colors to generate white light (Important: With red LED, green LED and blue LED will not work ours circuit).
- Resistor: If you use RGB LED I recommend using 1k Ohms resistors, and if you use a White LED you can use 330 Ohm resistors.
- Battery: Preferably it is 9V.
- Connector for 9V battery.Go Link
- Cable: To facilitate the cuts and connections I used JUMPERS.Go Link
- Photoresistor(solar cell)
Step 3: How the Circuit / Diagram Works
Here's how the system works:
Since the human eye can not see the light in some intervals of spectrum, using the light emitted by the LEDs we can send signals by means of interruptions in the frequency. It's like turning the light on and off (like Smoke signals).The circuit runs on a 9V battery that powers our entire circuit.
Step 4: Audio Cabling
When cutting the Jack we can check with our multimeter continuity to know which cables corresponds to ground and signal, there are jack with 2 cables (ground and signal) and others with 3 cables (ground, right signal, left signal). In this case when cutting the cable I obtained a silver cable, a white cable and a red cable. With the multimeter I could identify that the silver cable corresponds to ground and by conclusion the red and white are the signal. To make the cable stronger, what I did is to divide the cable 50% -50% and I will twist it so I would have 2 wires of the same polarity stronger and again the twine (This is to strengthen the cable and I do not know Break easily).
Step 5: Audio Wiring (Continued)
Since the cable is very thin and with the cutting tool is very easy to break, I recommend using fire, in this case a lighter was used.
Simply ignite the tip of the cable with fire and when burning you must remove with the fingers or some instrument the cable while it is hot (What we are removing is plastic that covers the cable).Now let's put the white and red wire in a node.
Step 6: Photoresistor
In this case I used a solar panel to cover a larger area, for this cell simply welded jumper cables on the positive and negative terminals.
To know if our cell is in operation by means of the voltmeter we can know the voltage that provides if we put it in the light of the sun (I recommend that it is in 2V ± 0.5)
Step 7: Construction of Our LED Circuit
Using RGB LED and with resistance of 1k ohms we can obtain the white color, for the circuit in the protoboard we will perform what is shown in the diagram where we will have the battery of 9V feeding the LED positive and the earth is connected to the signal that sends Our player (music signal). The jackpot ground is connected to the negative side of the LEDs.
Being experimenting I wanted to try another type of color to observe what happened and did not get results with red, green and blue LED.
Step 8: Theory to Get the Frequency of Notes
A sound is nothing more than a vibration of the air that a sensor can pick up, in our case the ear. A sound with a certain pitch is dependent on the frequency at which the air vibrates.
The music is divided into the possible frequencies in portions that we call "octaves" and each octave in 12 portions that we call musical notes. Each note of an octave has exactly half the frequency of the same note in the upper octave.
Sound waves closely resemble the waves that occur on the surface of the water when we throw an object, the difference is that the sound waves vibrate the air in all directions from its origin unless an obstacle causes a shock and Distorts it.
In general, a note "n" (n = 1 for Do, n = 2 for Do # ... n = 12 for Yes) of the octave "o" (from 0 to 10) has a frequency f (n, O) that we can calculate in this way(Image):
Step 9: Arduino Programming
For programming we will simply take a song and we will go selecting the type of note, something important are the times to consider. First, in the program is defined the output of our speaker as pin 11, then follow the float values corresponding to each note we are going to use with its frequency value. We have to define the notes since the times between note type is different, in the code we can observe the main notes, we have a time bpm to increase or decrease the speed. You will find some comments in the code so that they can be guided.
Step 10: Connection Diagram
Let's connect the arduino earth to the ground of our Jack cable and the positive to the positive 9V battery. The signal will come out of the pin 11 that will be connected to the negative of the battery.
Step 11: Music
Now that we have loaded the code in our arduino and all the connections, it's time to play! We will see how our horn starts to sound without being connected to our arduino, we are simply sending signals through the LED.
Step 12: Final Considerations
In the horn the sound will be very reduced so I recommend adding a circuit to amplify the signal. When programming the song that each one wants, it should take into account the waiting time and patience since we will have to tune the ear a lot for incredible results.
Participated in the
Microcontroller Contest 2017