Hello All,
Relatively new to arduino. Done a few school projects, but not too much on my own that I couldn't hunt down code on the internet for until now.
Here is the basic idea:
I am a private pilot and I use a device called a stratus that pulls in various information such as air traffic, weather, etc. Mine suction cups on to the rear window of the aircraft. Anyway, they are notorious for being left behind in the aircraft, never to be seen again which is quite a shame given the rather hefty price tag. I bought an arduino nano and an SW-420 vibration detector and some piezo buzzers. The idea was to activate the device, then have it wait until the vibration of the engine stopped (ie, you arrived and shut down the aircraft) at which point it would beep at you. I have managed to get it to beep when vibration is detected no problem, but for what I believe is a data-smoothing issue, I can't get it to work the other way around and be quiet when there is no vibration and to beep when there is. Basically, I can't get it to shut up when there is vibration. I have played with the potentiometer a good bit and nothing I do seems to work. It must be somewhere in my code. Any ideas?
(here is a link to a page that shows how to set up the device as well as some basic code for it)
https://create.arduino.cc/projecthub/albertoz/vibration-sensor-module-c88067
Thank you for any help you may be able to provide!
Edit: I believe the issue lies in the fact that vibration is a wave, and thus the sensor gets some false negatives when there is vibration when the wave is at its peaks and troughs. This would be reinforced by the flickering of the light on the sensor. If I could take a sample of say 10 vibrations, then average them together. If the average is less than a certain value, then beep. If it is above a certain value, say 0.5, then don't beep. I just am not familiar with the code as I once was and can't really seem to get this to work.