Overall Device Mechanism:
-
Arduino board read the values fetched by the sensors
-
Analyze the data of the environment to make suitable mapping algorithm
-
Mapping them to suitable values
-
Set appropriate delay time to make tempo
-
Tune the sounds created by different sensors by adjusting the tone frequency
-
Use the values to create music tracks
-
Here comes the music!
Step 1: Preparation
Go to grab the needed materials, and you can always be creative and use the available resources for substitution if possible. SD card shield is an optional device to store the data for later music manipulation. Other methods like serial port data transfer or WIFI shield for cloud data storage are also possible options. If other environment parameters, such as temperature, humidity, air pressure, stand as characteristics of your testing sites, try to use the corresponding sensors to develop your own devices.
In addition, in order to receive a better light exposure, this device is developed without a case.
Step 2: Wiring
Circuit:
Schematic:
To make the wiring step and possible debugging process easier, connect the parts separately and test them individually, which may save you much time.
TSL 2561 could be replaced by another photoresistor if needed.
The 330-ohm resistor is used to limit the current to the buzzer. Adjust the resistance in specific case.
Step 3: Coding
If you have not installed the arduino software, please download it here.
The coding part is mainly divided into three parts: sensor setup, sensor data retrieving and mapping sensor data to sound.
When trying to figure out how to make multi-channel sounds, the tone library created by Brett Hagman was partially used as a reference.
The codes of the algorithm of mapping data to sound notes fit the environment of Georgia Institute of Technology. It may need some changes when applied to a new project. By developing a mapping function that using the data range as parameters, it became easy to flexibly adjust the mapping algorithm to different environments and weathers. In this case, customizing the tempo and rhythm of the music piece is realized pretty well.
Code download: https://github.com/cvcv101wh/musicOfGatech.git
Step 4: Making Case
To make a case, we have to keep in mind that the case can not reduce the light exposure and the buzzer volume. It is the principle that should be followed when you are designing the layout of the case.
The steps are shown below.
-
Use pencil to make note to cut off the undesirable parts exactly.
-
Cut holes on/beside the buzzer, light sensor and power jack.
-
Cut four gaps for the straps to go through (two gaps for each strap).
-
Fix the straps by move them through the gaps.
-
Stick the parts in the case.
Extra Libraries Needed:
Adafruit_TSL2561_U: https://learn.adafruit.com/tsl2561/use
Tone (third-party library): https://github.com/bhagman/Tone
(If you do not know how to install an additional library, more information can be get here: https://www.arduino.cc/en/Guide/Libraries)
Extension:
It is also possible to use the changes of temperature, humidity and/or other environment parameters to create more music tracks.
Code References:
-
https://www.osepp.com/tutorial-6-using-buzzer-to-play-a-melody
-
http://c783319.r19.cf2.rackcdn.com/documents_manual_342162_24_Sensors_Kit_Manual.pdf
Process:
also view it in Instructables
Materials and Tools:
The following materials and tools are required for the project:
Materials:
-
One Arduino UNO
-
One Bread board
-
One 10k-ohm Resistor
-
Two 330-ohm Resistors
-
One Photoresistor
-
One Adafruit TSL2561 Digital Luminosity/Lux/Light Sensor
-
One Active Buzzers × 2 Hook-up wires
-
One Battery Clip with Male DC Plug
-
Some 9V Batteries
-
One USB cable to connect the arduino to the computer
-
One SD card shield(optional)
-
For Case (optional):
-
One Pencil Case
-
Glue
-
Two Nylon Straps
-
Tools:
-
Solder irons (optional)
-
Cutter (optional)
-
Scissors (optional)
-
Software:
-
Arduino
-
EarSketch