For a school project I made this Arduino Alien Theremin. It's a simple theremin with a photocell inside of an alien head. The idea behind it is that it looks like you are communicating with this alien by moving around but actually it's just reacting on the amount of light the photocell is getting. More light means higher pitch and less light means lower pitch. When the power is on, the arduino will calibrate for the first 5 seconds to determine the light conditions.
Things you'll need:
- Arduino UNO
- 6 wires
- Piezo buzzer
- 220 R resistor
Materials for the head(are optional, depending on what you want to make)
- Pepper foam
- Tape or something to mount the arduino
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Circuit Setup
you mount the piezo buzzer on to the breadboard and add to wires. The one goes to the negative rail on the breadboard and the other one goes to digital PIN 8. Then mount the photocell to the breadboard with a resistor to negative rail. You add a wire from the resistor and photocell to the ground on the arduino. You add another wire from the other end of the photocell to analog in A0. At last you mount two other wires from the breadboard to the power of the arduino.
Step 2: The Code
The code is actually quite simple.
At first you will have to assign 3 int(integer) variables. The first being the sensor value(the amount of light converted to an integer) and the second and third being the minimum (assign to 1023) and the maximum (assign to 0) values. Then in the setup you'll use a while function to calibrate the minimum and maximum values in a period of 5 seconds. For the calibration period, I used while (millis() < 5000), so my calibration period will last for 5 seconds. In the while loop you assign the sensor value to the A0(analogRead). If the sensor value is higher than the sensor maximum(at that moment assigned to 0 so hopefully it is always higher!), the sensor value becomes the new maximum. If the sensor value is less than the minimum, the sensor value becomes the new minimum.
Then in the void loop() you set the sensor value again tot the analogRead(A0). you make a new int variable called pitch(or something similar) and assign to the map function which takes 5 parameters. the first is the sensor value, the second the minimum value variable, the third the maximum value variable, the fourth to 50 and the fifth to 4000. the fourth and fifth arguments are in this case the minimum and maximum audio frequencies we want the piezo buzzer to return(output range).
Then you'll use the tone function where the first parameter is the pin number you connected the piezo buzzer to. The second argument is the variable pitch(where you used the map) and the last parameter is the duration of this pitch.
And at last you can use a delay that delays the pitch for an amount of milliseconds before it continues.
Step 3: Making the Alien
For the head I used pepper foam, clay and paint which I got from the craftshop(pipoos). I was lucky that I found hollow pepper foam in the shape of an egg. This way I could protect the arduino and sculpture around the foam. I did have to cut a piece of the pepper foam away in order to let the photocell stick out. The important thing is thus to make a hole on the spot where you want the photocell. Then you can start to sculpture. I used a pinterest board full of alien heads as a reference for the sculpture. Of course you can make a different kind of head. Or totally something different, like a theremin animal or in a shape of a real instrument. Or you may use different materials. The light weight clay I bought started to burst the day after I sculpted the head. I tried to cover it up with glue and paint but it did not look so smooth afterwards. I did not know if it was the clay or that I did something wrong. Anyways, I didn't feel like buying new clay and sculpture the whole thing again.
Step 4: Mounting the Arduino on the Head
This part went totally wrong. I had not thought about how I would mount the arduino into a pepper foam head! I glued the backs of the arduino en the breadboard together but this wasn't a smart move, now I had no space to mount it on the pepper foam. I had to improvise with tape and toothpicks, and unfortunately it is not stable!
Ideally I would mount the arduino better and use better speakers and put led lights in the eyes. Also I would spend more time painting the head and sculpture a better alien.
Here is a link to a video of the end result