Edit: My son is very happy with this project, priceless to see his excitement and satisfaction to make something, win win situation :)
Hello everyone. I am a graphic designer with a restless soul (my site http://www.inoace.com ). I loved doing electronics years ago and than got busy with life and job. I am now blessed with some time ( rare now a days :P). This is my third arduino based project, I think i dived quite deep with first one, so many thing look easier now.
This is a jumping board I made for my son, when he jumps on it , vibration sensor will activate several different tones randomly. As first step I tested the home made vibration sensor and than proceeded with this project.
The Project is simple.
- An ATMega328 arduino running on internal 8MHz clock (for lower battery consumption)
check last part "Minimal Circuit (Eliminating the External Clock)" https://www.arduino.cc/en/Tutorial/ArduinoToBread...
- A spring sensor ( https://www.instructables.com/id/Vibration-Sensor-...
- an amplification transistor (i used 2N5551, this seems to have higher gain than BC547)
- A color changing led (this is a 2 pin led, with integrated chip and changes RGB colors in animation style)
- An Orange led for warnings and ON / OFF indicator
- a tact switch / button
Lets see How it works.
- The sensor (spring contacts on vibration) this allows to pass current for s small instance
- which is immediately amplified by the transistor
- The amplified voltage than passes beside a capacitor, which stores spikes and provides a stable voltage to arduino.
- Capacitor also eliminates any noise picked up by the spring sensor.
- Arduino input detects the signal and plays one of several tones randomly (code also makes sure no sound is repeated twice in row)
- If the circuit is idle for some time (adjustable) the Arduino goes to power down sleep mode (with the help of lowpower library) (IMPORTANT TO INSTALL below library)
- or direct download link: https://github.com/rocketscream/Low-Power/archive...
- To wake up the device push interrupt switch attached to pin 2 of arduino
Lets go into code in next step.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Code
I used simple tones I made myself and a Starwars tone from here:
The chirping bird sound uses, the for loop and gives it a dynamic swing instead of plain tone. Other sounds include, ambulance sound and robot sound.
The random function decides which sound to play , while next line of code makes sure that no same tone repeats twice in a row)
Code arduino sketch attached (can also be opened in notepad)