Electret microphone and a DC motor

Hi,

I've recently begun working with Arduino and I have no idea about electronic components but I'd like to learn.

I want to create an interactive fan which is activated by sound or human voice. According to my research I need an electret microphone and a DC motor. The electret microphone detects the sound and activates the fan. I'm unsure if they are the right components to start with.

My question is how are the components connected with the Arduino? I know I need a transistor, a capacitor and some resistors but I don't know how connect them.

I'd be very grateful if you can help me.

Thanks in advance.

For the microphone, try to read this thread:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1208575180

And for the motor just google Arduino DC motor it should give you all you need.

Hi

I am in a similar position, wanting to use a microphone to capture a baby crying and trigger a motor.

I have very little experience with programing arduinos but have a tutor who has a reasonable knowledge, but isn't always very helpful.

I would really appreciate any help, such as what parts I will require and a point towards any existing programing scripts that could be adapted.

Many thanks in advance

Aldo

Well something like this can be used as a sound sensor:

http://www.seeedstudio.com/depot/electronic-brick-microphone-with-amplifier-analog-p-481.html?cPath=48_54&zenid=9f6118c193cee9f8b7337d4df91a2eca

As far as motor components, it depends on the size (voltage & current) requirement and if bi-directional rotation is required or not.

Lefty

Thanks Retrolefty

It doesn't need to rotate bi directionally, it needs to power the arm of a music box : 20 Note Music Box Set - Create Your Own Tunes - Grand Illusions

Can you guess at what voltage/current I will need?

Many thanks for any help

Aldo

To drive that you will need some kind of gearhead DC motor.

Most ordinary DC motors will run way too fast (more than 1000 RPM)

So first figur out the RPM you ned then find a suitable gearhead motor, and see what voltge / current id needs.

The motor driver circuit is not difficult to make when you know this.

It can be as simple as a transistor, a diode and a couple of resistors.

Thanks MikMo

I think it will about 120 RPM approx, how accurate does it preferably need to be?

Can you tell me exactly what I will need to get?

Many thanks

Aldo

Hi guys,

First of all, thank you very much for your soon reply and help.

As Richard asked, I've got a little experience in programming, I am able to understand the code and change it but I can't start writing from zero.

The DC motor is done, thanks again. However, I found difficulty reading the thread you recommended me so I came across other good link and I'd like to get your opinion about it:
http://www.iua.upf.es/~jlozano/interfaces/microphone.html

Apparently, the documentation works with an electret microphone. I don't know how to read circuit sketch but I'm going to try... Could you possibly tell me if I'm right?

A piezo buzzer is used in this case but it can be replaced it for a microphone as the video shows . The microphone has to be connected to the transistor Base, a 100K resistor has to be between both and the other resistor side has to go to +5V as well. Similarly, the transistor Collector goes to 22K resistor that goes to +5V too. I don't get the rest of the circuit (Emitter of the transistor). I know there is a 10uF capacitor and it could be a potentiometer but I'm unsure

I think I'm wrong...

Sorry to be a hassle... :frowning:

That 100K connected to the base is actually a pot. These have three wires and the central one, the wiper, is connected to the base.
The emitter (the one with the arrow) is connected to a 3K3 resistor to ground. It is also connected to a 1K pot, this time the wiper is connected to on end to make a two terminal device. The other end is connected to the positive end of a 10uF capacitor with the other end to ground.
Vout is connected to the arduino analogue input.
RM controls the gain of the amplifier and the other pot controls the bias which should be adjusted so that any clipping applies symmetrically to the waveform. Just set the to the middle.

Thks!

I connected a transistor among the ground, 5v, 9V battery and the DC motor to amplify the electrical signal. On the other hand, I connected the microphone. This includes a small green board that shows GND, 5V and AN. It has more holes like TX, RX and BW but I didn't use them. Consequently, I wrote the following lines in Arduino:

//it reads the microphone input
int mic = 5;

//it stores the microphone input
float val = 0;

//declares the variable that stores the transistor output
//the transistor is amplifies the electronic signal to the DC motor
const int transistorPin = 9;

float speedTransistor;

void setup() {
pinMode(transistorPin, OUTPUT);
Serial.begin(9600);
}

void loop()
{
val = analogRead(mic);
Serial.println(val);
speedTransistor = map(val, 10, 40, 0, 255);
analogWrite(transistorPin, speedTransistor);
}

I'm struggling with the calibration because the DC motor sometimes doesn't work when you talk through the microphone or keep spinning even if there is silence... it looks to me the microphone is broken or connected wrongly...
The serial print gives me 300 - 350 when is quiet and 10-30 when you talk through it. It works inversely....

I don't know what to do...

Could you possibly help me?

For the moment forget about the motor control and just print out the value you are getting from the microphone. You will probably find that is all over the place.

You need a diode on the analogue input and a capacitor across the input. This will allow you to only measure the peaks of the sound waveform and also keep out the negative part of the audio waveform which is making the motor stop.
Add a delay(300); so that you are not sampling things so often. then add the motor control back again.
You can also average say 10 readings before you attempt to do the control.