# Project: Create sounds with piezzo and self-made pressure sensors

Hello everybody,

I am fairly new to Arduino and Coding (started learning it just this semester in university a few months ago), I know how to build certain circuits and I understand most of the code, but I still make some beginners-mistakes.

Right now I am starting my first project: My goal is to produce sounds via piezzo's, after pushing two self.-made pressure sensors.

I want to build those sensors:

http://www.kobakant.at/DIY/?p=65

I got all materials, but before I start and mess up all my stuff head first, I wanted to ask, if there is anything I have to be careful of/with, regarding building those sensors?

I also know that I will have to include two voltage-dividers, one for each pressure sensor.

Like those:

http://www.kobakant.at/DIY/?p=6102

My question regarding those voltage dividers is, how do I know, which resistor I should use? Because my pressure sensors are not producing any voltage that is too hight for my Arduino to detect. Do I really need those voltage-dividers? Or am I totally wrong...

I hope the links and my description make my project idea obvious.. If not feel free to ask!

Thank you all in advance and have a good one!

Best, Simon

The pressure sensor doesn't produce a voltage, it only changes its resistance. You have to add another resistor, to form an voltage divider (half bridge). Connect the sensor end to Gnd, the resistor end to Vcc, and the junction to the analog input.

You'll have to experiment a bit, which resistor to use for each sensor. When you use a resistor equal to the pressed sensor resistance, the measured voltage will be 2.5V (Vcc/2), i.e. analogRead() will return about 512 when the sensor is pressed.

Thanks for your quick reply DrDiettrich! Now I understand the voltage dividers.

Hello again, I got another question right now:

I want the arduino to read out the measured pressure (in this case the change of resistance) and "translate" it into sounds, I want to produce with a piezzo-sensor. Now I am a little bit confused, as of how to read out the signals from the pressure sensor and how to connect them to the sounds via code...

It would be nice to just get some think points, as of how to start with this code...

Thanks in advance!

Another question I have is, how to include the Pressure sensors (I just realized, that "force sensitive" would be a better term, but I relied on the name I've read on kobakant) into my circuit. I know, thanks to DrDiettrich, that I need voltage dividers for each sensor, I want to use. To make sounds with the piezo I experimented with a "pull-down-resistor", now I am wondering, if there is a way of producing sounds with the piezo, without using a pull-down-resistor...

To make clear what I want to do:

After more thoughts, i decided to include at least 2 force-sensitive sensors into my circuit, together with a piezo.

I thought of 3 "States":

1. without any force-sensitive sensor being pushed, the piezo just produces one repeating tone, with a few seconds delay.

2. The more sensor1 is pushed, the faster the tone occurs - so the delay gets shorter

3. If sensor2 is pushed, an arpeggio (a scale of tones which goes up and down) starts playing.

4. so if sensor1 and 2 are pushed - depending on how much I push sensor1 - an arpeggio occurs, which gets faster or slower

right now this is the core idea, for what I want to build and what I want to code, but I am still missing some crucial points of how to start..

1. How do I include the force-sensitive sensors into the circuit? Are pulldown-resistors needed?

2. Is there a way of creating a repeating sound with the piezzo, without using those pulldown-resistors?

3. The Code... I got the feeling that I know exactly what I want my project to do, so I got a plan of how to start with the code, but to be honest I am not quite sure, if the stuff I want to do is possible with the assets I have...

So again, some starting points would be so cool!

If you have any further questions, just ask. If you got any tutorial's for me, any code snippets, just any help would be really appreciated.

Cheers have a nice one!

Simon

I still don't understand the use of the piezo. Is it for input our output?

The exact wiring of the force sensors depends on the type of the sensors.

For a test of the program logic you also can use ordinary buttons and a pot for analogous values. Or an analog joystick for both inputs...

If I am not completely wrong, the piezo is my output. Since I want to produce sound with it, depending on the input values, I get from the sensors.

What do you mean with type of the sensors? I am currently working on building those sensors:

http://www.kobakant.at/DIY/?p=65

Testing the program with buttons is a good idea, I will do that, thanks!

SimzZafari:

1. How do I include the force-sensitive sensors into the circuit? Are pulldown-resistors needed?

2. Is there a way of creating a repeating sound with the piezzo, without using those pulldown-resistors?

3. The Code... I got the feeling that I know exactly what I want my project to do, so I got a plan of how to start with the code, but to be honest I am not quite sure, if the stuff I want to do is possible with the assets I have...

Usually pullup resistors are used, just to keep on pin of the sensor on Gnd.

1. See my reply #1
2. No pulldown is required for the piezo. See tone() and noTone() in Reference for generating sound.
3. See the button examples in the IDE.