This time, the assignment is to make a device that controls the playback of some pre-recorded music on a web page. The required functions are play, pause, stop, fast forward, skip ahead, skip back and random.
Idea
When I saw the requirement, I took play, pause, stop and fast forward as states of the music; skip and random song as actions towards the music. Thus, I came up with the idea of a little device that can sit on the desk in four different ways (has four faces) that map to four states and has three corners that triggers the three actions when facing down. It was hard to came up with a 3D shape satisfying all the requirements but I finally decided on a cube with sharp side faces. Shaking the device “violently” in y axis will random the song.
In terms of the hardware, I used accelerometer to track the state. Since the cable from Arduino to computer is troublesome when you move the device
Video
Code
I used a lot of time tracking and state checking in the code. Wondering a better way to code a program like this.
Circuit Diagram
Enclosure
Since the device was designed for users to roll it back and forth, I tried to reduce the hard edge of the cube on the side by adding some diamond shaped structure between surfaces to create a smoother transition. The center was cut out to indicate which state the device is in, depends on which surface is facing up.
The left and right faces should have been more curved so that the device couldn’t stay still on those surfaces because the left and right are not designed as a stable state but an action. In order to do so, I also tried converting a 3D model into a laser cut file using 123D Design but it is so limited to a few of ways and it is hard to customize, so I just used multiple lays and glue them together.
Before assembling:
Further Development
Left and right faces: a sphere-like end so that users know the left and right are just actions and that the device shouldn’t been put on the table with either left or right side facing down.
Credit
The bluetooth was set up with help from adafruit learning system
Accelerometer was set up with help from adafruit learning system
web page p5 sketch is credit to Tom
Last but not the least, great thanks to Stephanie Koltun