For our project, we created a musical box with 3 different components.  One component was an electrical piano that could play a one octave scale.  This piano was made of 8 touch sensors that were attached through the back by 3 different axels and taped together for extra support. The 8 sensors were then attached to the front of the inside of the box and the buttons poked out of a hole in the top.  The second component was 5 motors attached through the box to a tire with a spacer below it so the motors were easy to turn.  3 were in the front of the box and 2 on top.  When each motor was turned, a different sound effect was played.  The third component of the box was a pair of drums that were attached on either side of the box.  The drum was a cardboard disc that was attached by a square piece and axel to a touch sensor.  There were three EV3’s that were involved in our project.  One was attached to 4 of the piano touch sensors and 3 of the sound effect motors, another was attached to the other 4 piano touch sensors and 2 of the sound effect motors, and the last EV3 was attached to the 2 drum touch sensors.
Our code worked by using the “System Execution” command which can control the terminal of the computer.  We typed the command “afplay” then the path to a particular sound file we had saved on the computer.  There was a sound file for each note of the scale, the 5 sound effects, and the 2 drum sounds.  For the piano and drums we also added “-t 0.1” which played the sound file for only 0.1 seconds since the notes had to be quicker than the sound effects so consecutive notes could easily be played.  For the piano, “System Execution” and the corresponding terminal command to play a specific sound file were placed inside of the true part of a case structure, causing a sound to play when a touch sensor (pressed) returned true.  For the sound effects, the “System Execution” and the corresponding terminal command to play a specific file were also inside the true part of a case structure.  The motor would first reset rotation to 0, then a read rotation was called.  If the motor read an angle of rotation value that did not equal 0, then true was returned to the case structure, causing the sound to be played.  The 3 EV3s, which we previously had daisy-chained, were each attached to their own USB ports in order to decrease delay.  We had multiple EV3s in our program using the “Specify NXT/EV3” command, wiring the names of each EV3 into their respective blocks, then wiring those blocks to the sensor each EV3 controlled. 2 of the EV3s and the code for the piano and sound effects were attached/played from one computer, then another computer was used to attach/play the drums from the third EV3.  The whole program was inside an infinite while loop (false wired into stop).
One challenge we faced was finding a way to attach all 3 EV3 to its own port to reduce delay since one computer only has 2 USB ports and the code did not respond well with a USB expander.  We solved this problem by running the drum program on a separate computer and attaching the third EV3 to the second computer as well.


Improvements from Prototype

 We made several improvements to our original prototype design to improve the Composer music box.  One improvement we made was making the box more aesthetically pleasing.  We did this by using a different box, wrapping it with wrapping paper, and placing the three components of our box in more sensible and symmetrical places, and containing the EV3s and wires inside the box so they could not be seen from the outside.  We also made the design more intuitive by moving three of the sound effects to the front of the box (which was especially more accessible for children), and adding more, colorful pictures and note names to each of the components so it was easier to understand which control did what.  We also greatly improved the drums.  Before, the drums were ultrasonic sensors which were inconsistent and difficult for the younger children to understand and use.  Instead, we decided to use a touch sensor attached to a cardboard disk with an axel which greatly increased consistency and usability.  We also drew a drum on the cardboard disk so the children would understand that it was a drum.  We also made an improvement that greatly reduced the delay of the controls and also allowed multiple people to easily play at the same time.  We reduced delay by, instead of daisy-chaining 3 EV3s (which took a long time for all of them to communicate), attaching each EV3 to its own USB port.  Lastly, we added two more sound effects (duck and horse) as well as sheet music so people could play songs to add even more to the fun.

0 bytes
0 bytes
drumtest_584f53c1ab080Drum Test.vi13.65 KB
untitled3_584f53c20b0f9Untitled 3.vi32.34 KB

Leave a Reply

Your email address will not be published. Required fields are marked *