Giter Club home page Giter Club logo

code-for-epiano's Introduction

Code-for-Epiano

Kezhen Yan/ Haoliang You University of Pennsylvania | TEAM DINGZHEN | Electronic Piano

PROJECT INSTRUCTIONS a As can be seen, the final project is a simple electronic piano, which is composed with some tone keys, a speaker, two sensors, and an embedded system board. How to play it? Similar to the normal pianos, you can play different tones while kicking different keys. Of course, you can also hold any key to play a continuous sound. What is more, holding two or more keys at the same time is allowed, which is called cord in music. When some keys are touched, the corresponding color will show through the LED on the board. Equally, mixed color will show when the cord happens. Now, let’s see the first two keys from the right side, which can be used to adjust the volume of the piano. When you hold plus, there will be red light. When you hold minus, the blue light will be on. On top of that, the light levels indicate different volume levels. For example, if you keep holding the minus, the blue light will show and gradually become dark. Finally, as you can see, there is a gesture sensor beside the board. This sensor is used to play some loaded music. There are four controlling methods: up, down, right, left. For example, if you slide the hand to right, it will play a music that I saved before. On the other side, another music will be played. Of course, there is also some other functions that you can choose, such as playing the same music in different tones or speed, which you can change easily in the code part.

PROJECT DEVELOPMENT At the first stage, we just wanted to apply the gesture and proximity to real life. Put another way, maybe a parking alarm will be a good choice. However, a single parking alarm might be a little simple and I want to learn more functions about this QT PY 2040 board. Thus, I tried to apply PWM part of the board to our project. Outputting different voltages through adjusting the frequencies is seemed to be an interesting part for me. Therefore, I studied and reached the output of different voltages and frequencies. At the middle check stage, the project could be used to play different frequencies and volumes through the speaker. Then, in order to apply the PWM part more, I found the MPR121 sensor. Different from APDS9960, which we used to detect proximity, light, and gesture, the MPR121 could be used to detect touching. So, it’s not hard to come up with an electronic piano with touching, volume, frequency, and speaker. At last, this project was made.

SIGNIFICANT ISSUES AND SOMETHING SATISFYING First, enabling APDS9960 and MPR121 with one I2C port. At first, I did not clearly figure out the relationship between these two sensors. However, after consulting Prof. Banks, I had more profound thought about this. These two sensors have different address, thus using the same clock and being initialized at the same time are allowed. Broadly speaking, we can connect more sensors with different address in series with one I2C. Second, the achievement of cord is also a very tricky issue. As I thought before, the clock will be occupied when certain key was held, thus another playing will be not allowed because the judgments could not happen together. Nevertheless, holding two or more keys to produce the cord is allowed, which was not imaged by myself. After serious consideration, I think that it should be the function of the PWM output. That is to say, it is not achieved due to any other libraries or codes. Third, the application of the MPR121 is a great construction for me because I learned more types of the sensors. In the future, I would like to try to use more other types of sensors. The color-tone shining LED is really a good-looking design, which makes me feel very comfortable when playing the piano, albeit it is very simple. The achievement of cord is very tricky and intelligent but I still have not enough evidences to speculate its reason. Finally, the initialization of these two sensors made me learn much.

REFLECTIONS This project is a very typical design and application of PWM part. If someone wants to have a deep understanding about this part, I strongly recommend to learn about this project. With the outputting of different frequencies, we can achieve much more than this simple piano. For example, in some certain controlling circuits which require different voltages, we can easily output the required voltages without using of some other circuits. What’s more, the fast switching of the outputting voltage can also be simply achieved, which dominates the physical circuits. About the selection of the components, the MPR121 is really a preferrable choice because its sensitivity and durability are very excellent. In the future, I would like to add a microphone to this project, which can be used to input our own voice and change its volume and frequency. Also, I hope some teams can try to achieve this imagination later. Last but not the least, a screen which can show the tones should be considered, about the selection, I strongly recommend the I2C 1602 LCD screen because it is very basic and compatible for our new designer as I learn.

PIO EXPLANATION a When any key is held, the sensor will detect that and order to enable PWM’s output. PWM output the corresponding voltage through changing the duty cycle. The output voltage equals the virtual value of the sine voltage signal. Therefore, we can output different voltages through different duty cycles. On the other hand, the data of our project is all alive data, which means it does not rely on the external input. Put another way, there is no saving function in this project, which relies on the input of PIO. Of course, if we want to add a microphone to this piano, we need to use the input and saving of the PIO. This will be done in the future.

BLOCK DIAGRAM a

TEAM REVIEW Team member: Kezhen Yan Contribution: designing project, purposal writing, code writing, code debugging, compoents selection, writeup Haoliang You Contribution: designing project, purposal writing, code writing, welding, compoents selection, writeup

code-for-epiano's People

Contributors

akiyamask avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.