DFRobot Digital Vibration Sensor V2

A project log for The Smart Letterbox

Attach a device to an existing letterbox that will send a push notification when a letter or package is inserted

Tony KambourakisTony Kambourakis 02/07/2016 at 14:261 Comment

The DFRobot Vibration Sensor uses the same type of coil mechanism inside to detect vibration. This sensor has a normally-high digital output which goes low during a vibration. I took the MCU with the sensor out for a field test with my letterbox. An LED was wired to switch on when a vibration was detected. Whilst knocks and taps were detected, inserting letters and pamphlets into the top tray did not cause a strong enough vibration to be detected by the sensor. Power was supplied by 2xAA batteries.

The following scope shot shows the signal on D6 when the vibration sensor is triggered. There was approximately 250ms of bounce.

The initial transition low was distinct with a drop of 2.88V down to 0V and adequate to trigger the FALLING interrupt on the MCU input pin.

The sensor was attached to D6 with an interrupt used to detect the falling edge. See the dfrobotvibrationsensor branch for the code changes.

void init_letter_sensor() {
  pinMode(D6, INPUT);
  pinMode(D7, OUTPUT);
  attachInterrupt(D6, letterSensorActivated, FALLING);

With the DFRobot Digital Vibration Sensor setting its output normally high, it is a slight waste of power.

For the Adafruit vibration sensor tests I tied it low and saw the spikes going high when vibration was detected. Whilst it certainly wasn't a clean transition it was sufficient to be detected by the MCU input pin as a change in state with the interrupt.

I suspect a more sensitive vibration sensor may be prone to false positives due to strong wind. That would be unacceptable. There is one final test to perform with an alternative vibration sensor that I have on order. It is a piezo based sensor and should be a little more sensitive. However, it may result in false positives.

The final solution that I believe will have close to 100% accuracy is an IR break beam sensor, also on order. This can be mounted across the openings of the letterbox (centre) to detect anything coming through that cuts the beam.


c835722 wrote 02/07/2016 at 21:39 point

Thanks for the analysis. Like the code snippet and branch. IR sensor style looks interesting.

  Are you sure? yes | no