Project: Theremin
Projects are intended to consolidate the knowledge you have absorbed in previous lessons. This one will help you apply what you've learned about LDRs and buzzers.
In this project, you will create your very own theremin. A theremin is a musical instrument which can be controlled without any physical contact. We will create our own theremin using LDRs and buzzers.
Requirements:
- Build a circuit with an LDR and a buzzer.
- Use the
tone()
function to control the pitch of the buzzer. - As your hand moves closer to the LDR, this will change the light level, and therefore it should adjust the pitch.
Assignment
Project
Step 1: Planning
- Think about the components you will need for this project and start planning how these components will fit together in a circuit.
- Draw up a schematic using a tool like
Fritzing
or by hand, if you prefer.
Step 2: Building your circuit
- Gather all the components you will need for this project.
- Build the circuit using your breadboard, jumper wires and the components you would have prepared earlier.
Step 3: Programming
- Declare all the variables you will need to use in this program. Try to use variables whenever it's possible.
- Write your program using the requirements above.
- Upload your code, debug, and repeat until you have a working program!
Challenge
- Add an LED that changes brightness with the pitch. This can be a cool visual effect to go with your auditory output.
Stuck?
If you get stuck, don't worry! There are a few helpful ways to troubleshoot and understand the problem.
- Use your serial monitor to debug - it's a very helpful tool!
- Refer to official documentation or guides such as the Arduino Docs.
- Search the problem online. If your console reports an error, simply copy paste it online. It's likely someone else had the same issue as you.
- Ask in forums and online communities. Good places to ask for help are: