I’m a student working on a Rube Goldberg machine and I desperately need help. I have never used any Arduino products before and do not know any code. I want to detect a certain frequency from a tuning fork or hand chime and have the Arduino then start a motor. What our my first steps and general guidance you have for this project? My class has an Arduino kit including an Arduino uno 3.
That would be awesome! I don’t have the microphone yet although. I also have been looking and it seems like it would be important to mention there will be a lot of other noise around as well. Would that be an issue?
Just meaning that I’m very unfamiliar with how all of this works. From some research it seems that the frequency range I have available to me is common in human speech. So, would the microphone and program be able to discern and only work when the tuning fork resonates or will it not be able to or be set off by people talking. I’m not sure.
I tell you what, since this is your project, put together a plan what you wanna achieve, break it down into smaller blocks. Work the theory, don't start hacking together code and hardware and later find out you're in a dead end, do research instead. Come back here and present the goal and what you have found so far. Ditto for code and hardware. Not many are willing to do others school assignments when no effort is done. If you however show that you wanna work on it, people here can support you, give critic and input.
I've used this microphone board. It should work as long as the tuning fork is loud enough and close enough to the mic. (That one doesn't have a gain adjustment.)
The room noise will likely contain some of the same frequencies. Most natural sound (especially noise) contains many simultaneous frequencies and it might trigger your sensor. A tuning fork is more-pure, and it might be a perfect sine wave, but I don't know. As a general rule, the signal should be louder than the noise.
Now things get complicated... Sounds are normally analyzed, and frequencies separated, using FFT which is advanced math.
There are Arduino Libraries to do the hard work, but it's still probably not easy for a beginner. (I've never used FFT.)
There is also FHT which is supposed to be simpler but I've never use it either.
There are lots of Arduinos, so make sure the library is compatible with what you have.
Another option would be to build a (narrow) bandpass filter with an op-amp. If you are better at electronics than programming it would probably be easier.
Maybe a 'digital missing pulse detector' could be used to show the presence of the correct tone frequency? Or, look at a phase lock loop for detecting the signal.
Replacing the Uno with an LM567C would be much simpler. And accomplish the same thing as far as I can tell. And Mouser still has them in stock. Thank you Forrest M. Mims III for the example circuit below:
To detect a tone with an Arduino, the basic process would be something like:
Use some sort of hardware microphone module, possibly with an amplifier, to produce an analog voltage compatible with the Arduino Analog to Digital Converter (ADC) (research topic 0)
Read samples from the ADC (in software) at a rate "significantly exceeding" the frequency you are interested in. At 400Hz or below, this shouldn't be too hard, although I'm not entirely sure that analogRead() is fast enough (that'd be "research topic 1.") This produces a series of digital values in memory.
Run some sort of DSP algorithm on that data. Fourier Transforms (FFT) is an algorithm that will fully break apart a signal into all of its component frequencies, but that's much more complex than you need to detect a single tone. One that I've seen mentioned is the Goertzel Algorithm (There is even an Arduino Library thats implement it.) There might be others (Research topic 2.) (@DVDdoug mentioned FHT?)
Figure out how to drive the motor (Research topic 3.) An Arduino can not directly drive motors; you'll need some sort of "motor driver" that matches the spec of your particular motor. Maybe you can use a servo motor, which is ... different.