In this project, we made a simple citcuit consisting of a phototransistor and a device that makes a high pitched sound called a Piezo to make a Theremin, an instrument that would make different pitches dependent on movement. With the phototransistor, we nasically make it so depending on how much light is hitting it, will determine what pitch the piezo will make. The circuit was simple enough; After grounding and powering the Arduino, we connected the piezo to the breadboard, one pin we connected to one of the digital pins on the Arduino, and grounded the other pin. The phototransistor is then placed in the breadnboard, grounded and connected to one of the Analog pins on the arduino, since it will be an Analog factor that will change the pitch of the piezo. From there we move onto the Code: We set some variables to calibrate the sensor, and a constant for the calibration indicator. We then set the direction of the digital pin to high, so the pitch goes high when more light hits it. We then set the calibration in a while loop to be 5 seconds, so there is 5 seconds once the arduino powers on, to calibrate the light hitting the phototransistor. In the loop, we have the code read and store the value of the sensor, and then map the sensor to a certain frequency, which will then make the pitch change once it is on.
Published February 27, 2023
Comments
Please log in or sign up to comment.