Hi. I just got my Arduino in the mail today, but I have little ideas on how to program it nor do I have much interest in programming languages I made the thing blink a LED at various speeds, but thats just about it.
I have made a clap on-clap on device using an op-amp, a 555 timer and a flip-flop. I want to change out the 555 and the flip flop with the atmega chip instead, making the clapper a little more advanced. This is what I want it to do:
It will recieve a +5V (if that is preferable) when someone claps. After this it will remember the clap and wait for around 500ms before it will be ready to register another clap, after two claps an output will be set to a steady HIGH.
If the arduino registers another clap before the 500ms have passed, it will forget the first clap. If there is no second clap after around 700ms, it will forget the first clap. The same will go to make it turn off, just in reverse.
Could anyone help me out with this? I know it's a little cowardly to just ask for the whole programming code without figuring it out myself, but I am really more into the electronics that are outside the MCU
Me giving this a try would be to draw random letters and number from a bag and typing it in. You have to atleast point the way to something, a guide or a book I can buy perhaps.
Asking somebody to do this for you is beyond asking for help.
Normally, when somebody wants some kind of work to be done for them,
it customary for money to be exchanged for the time and materials cost of the work.
Hi. I just got my Arduino in the mail today, but I have little ideas on how to program it nor do I have much interest in programming languages
Then perhaps buying the Arduino was a mistake? It being a programmable device, if you don't have an interest in learning to program it for your projects, then there is not much sense in using it, is there?
I too come from more of a hardware background, so I can relate to liking to work with electronic components more then writing software programs. However the vast possibilities your projects can take on when coupled with a nice general purpose and inexpensive programmable controller should not be overlooked. I suggest you just bit the bullet and learn how to program, the knowledge gained will pay dividends in the future.
I know that you feel overwhelming by programing the Arduino. It is very versatile little chip. A "Swiss Army" type of chip.
Your project need : one input --> a mike, amplify signal so the Analog pin will received. One output : A relay control by a transistor. The program will make the unit work. You already know output... digitalWrite ( anydigitalpin2-12, HIGH or LOW ), that is a start. The input is : analogRead (anyanalogpin), compare the value, ( on or off ) A if () {} else {} .
Anyway that is a start. It fun to program the Arduino. You need some books to understanding and learn to program the Arduino. I have "Arduino Cookbook" and "Get Stared with Arduino". That is my side...
As far as some useful help goes.
The task as currently defined is fairly simple especially if you can deliver a 5v signal
when there is sound that meets your threshold and less then about .8 volts
when below your threshold.
All you would need to do is spin on the digital input pin waiting for it to go high,
Then spin on it to go low,
Then use the pulsein() function with a 700ms (700000 us) timeout to time until the next high pulse
starts.
Based on the return value from pulsein() you can decide what to do.
If the returned time is in your desired range then you turn the output on if it was off and off it
was on.
If you want to stick in the analog domain to simplify the external circuitry then as mentioned
earlier you will need to use analogRead() to fetch the analog value and determine what your
threshold of "noise" is.
For timing you will use the millis() function to get the system time which is a free running
1ms counter.
You can then subtract the time when you saw the threshold occur until you see it again
to find the time between the two.