Pages: [1]   Go Down
Author Topic: Advice needed: Controlling a Servo from audio input  (Read 972 times)
0 Members and 1 Guest are viewing this topic.
Reading, Berkshire
Offline Offline
Full Member
***
Karma: 2
Posts: 132
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
I've done some processing in the past but I'm new to Arduinos. I've got Programming interactivity and the Arduino cookbook.

I want to write a sketch that will make a servo turn clockwise at a speed defined by the velocity of sound picked up by a microphone. So the louder the noise, the faster it spins. Do you have any advice on where to look for sketch research? Is this even possible?

Secondly, Is this possible with a toy motor If I were to use the sound to effect the current?

Thank you.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25768
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Barring major changes in air pressure, the velocity of sound will be pretty constant, and you couldn't measure it easily with a single microphone
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Reading, Berkshire
Offline Offline
Full Member
***
Karma: 2
Posts: 132
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The idea is, it responds to music, clapping, things like that... using the BOB-09964
Logged

UK
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12549
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The idea is, it responds to music, clapping, things like that... using the BOB-09964

I can't imagine what you mean. You just going to control it based on the presence/absence of a loud sound, or are you intending to control it based on the characteristics of the sound? I don't think you'll be able to do any meaningful analysis of the sound itself on the Arduino, but I imagine it would be possible to produce a circuit that provided a 'loudness' signal that the Arduino could use as an input.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Reading, Berkshire
Offline Offline
Full Member
***
Karma: 2
Posts: 132
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, a loudness sensor is basically what I want to use.

I've used
  sketch '6.7 Detecting sound' which lights up an LED when a Microphone Breakout Board detects sound.
as a guideline but turning a servo is the bit I'm not sure how to work out at the moment.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25768
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you tried the Servo library?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Sr. Member
****
Karma: 1
Posts: 486
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i have done similar(use a electret mic with arduino). it used a LM386 to boost the signal to a alanlog in useful voltage. then you could make some code that would smooth out the sound spikes(so that the servos slowly speed when loud, then slowly go back down when no noise, or the servos keep their speed if sound is constant)

scheme:
Logged

http://dduino.blogspot.com all my Arduino/electronic projects!!!

{NEW} Getting Started, Learning, Reference + FAQ PDF!!:
[url]http://ar

Offline Offline
Edison Member
*
Karma: 32
Posts: 1286
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
sketch '6.7 Detecting sound' which lights up an LED when a Microphone Breakout Board detects sound.
A DC motor is simpler than a servo.   A DC motor only requires 2-wires and should behave a lot like LED-brightness, except it  requires more current.   You should be able to use a transistor or MOSFET to amplify the PWM output and control the speed. 

You might have to experiment to find the relationship of voltage-to-speed, and you might have to give it a voltage "kick" if you want to start it at slow speed.

DC motors run pretty fast if they are not geared-down.  If you want a very-slow speed without a gear, or a very-wide speed range, a servo or stepper motor might be the way to go.
« Last Edit: January 10, 2012, 06:41:51 pm by DVDdoug » Logged

Pages: [1]   Go Up
Jump to: