Detecting vibrations using Adafruit Feather Huzzah esp8266.

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
kostas684
 
Posts: 1
Joined: Fri Jan 27, 2017 5:39 pm

Detecting vibrations using Adafruit Feather Huzzah esp8266.

Post by kostas684 »

Hi,
I’ve recently started using the Adafruit Feather Huzzah esp8266 Kit, and I’ve successfully connected from the temperature sensor all the way to Azure IoT
My goal is to detect vibrations coming from a machine. These vibrations are not stronger than what you get from a mobile phone.
My plan was to use the fast vibration switch but I have not been successful so far.

To start with. If I connect serially the vibration switch and a LED, from the Battery pin to the Ground pin, then I can see the sensor working, lighting up the LED. But when the sensor is attached to the machine, the vibrations are not strong enough to make the LED work. I am not sure if the switch doesn’t turn on at all, or if it turns on for milliseconds but the power is not enough to light up the LED. Should I use a different sensor for this type of work?

I am trying to read the sensor’s input from esp8266, but I couldn’t make that work either. My topology goes from port 13 of the esp8266 to the vibration sensor, to the ground.
I initialize with: pinMode(13, INPUT_PULLUP);
I read like this: if (digitalRead(13) == LOW){*Vibration = 1;} else{*Vibration = 0;}
Does this approach look right?

Looking forward to your input… should I go for a different sensor or should I wire it up / read in a different way?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Detecting vibrations using Adafruit Feather Huzzah esp82

Post by adafruit_support_mike »

There are a couple of things you can do to improve detection.

First, put a 1uF capacitor in parallel with the vibration sensor. The cap will charge slowly (relatively speaking) through the pull-up resistor, but will discharge quickly if the vibration sensor closes. The fast-drop/slow-rise voltage gives the input pin time to see whether the sensor has made contact. Without the cap, the pin has to catch the sensor while it's actually closed.

Second, add some delay after checking the pin for a signal. The capacitor will give you at least a couple of milliseconds, and that way you'll have time to see whether a status LED is lighting.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”