Project #28 – Sensors – Shake Sensor – Mk31

Project #28 – Sensors – Shake Sensor – Mk31

 

Web

 

https://www.donluc.com/?p=5003

 

Facebook

 

https://www.facebook.com/share/v/1FKJsG2Jfz/

 

YouTube

 

https://youtu.be/OZmnjlx0SMQ

 

#DonLucElectronics #DonLuc # #Sensors #FireBeetle2ESP32E #ESP32 #Display #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

Gravity: Digital Shake Sensor

 

The digital shake sensor detects unidirectional hand movements, preventing false triggers with strong anti-shock capability. It's compatible with 3.3V/5V controllers.

 

The digital shake sensor is to detect hand shaking which is only sensitive to unidirectional hand movements. The spring-type vibration switch is used to output a low-level pulse when the user shakes once in the specified direction and the on-board indicator flashes at the same time. Thanks to the unidirectional sensitivity of the vibration switch and the corresponding filter circuit, it has strong anti-shock interference capability to prevent false triggering. Simple and easy, switch controls are all in just a single shake.

 

DL2610Mk01

 

1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: 3.5” 480x320 TFT LCD Capacitive
1 x GDL Line 10 CM
1 x Gravity: Digital Shake Sensor
1 x Gravity: Digital Green LED Light Module
1 x Gravity: Digital RED LED Light Module
1 x Gravity: IO Shield for FireBeetle 2
1 x Terminal Block Board for FireBeetle 2 ESP32-E IoT
1 x Lithium Ion Battery - 1000mAh
1 x USB 3.0 to Type-C Cable

 

DL2610Mk01p

 

DL2610Mk01p.ino

CODE
/****** Don Luc Electronics © ******
Software Version Information
Project #28 – Sensors – Shake Sensor – Mk31
28-31
DL2610Mk01p.ino
DL2610Mk01
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: 3.5” 480x320 TFT LCD Capacitive
1 x GDL Line 10 CM
1 x Gravity: Digital Shake Sensor
1 x Gravity: Digital Green LED Light Module
1 x Gravity: Digital RED LED Light Module
1 x Gravity: IO Shield for FireBeetle 2
1 x Terminal Block Board for FireBeetle 2 ESP32-E IoT
1 x Lithium Ion Battery - 1000mAh
1 x USB 3.0 to Type-C Cable
*/

// Include the Library Code
// DFRobot Display GDL API
#include <DFRobot_GDL.h>

// D10 Shake Interrupt
const int iShakeInterrupt = D10;

// Shake Flag
volatile bool iShakeFlag = false;
// Flag
String sFlag = "False";

// Last Shake Time
unsigned long lLastShakeTime = 0;

// Interrupt Anti-Shake delay time
const unsigned long lDebounceDelay = 1000; 

// D11 LED Green
const int iLedGreen = D11;
// LED Green
String sLEDGreen = "HIGH";

// D12 LED Red
const int iLedRed = D12;
// LED Red
String sLEDRed = "LOW";

// Defined ESP32
#define TFT_DC  D2
#define TFT_CS  D6
#define TFT_RST D3

/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 320x480
DFRobot_ILI9488_320x480_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);

// Software Version Information
String sver = "28-31";

void loop() {
  
  // Shake Interrupt
  isShake();

  // isDisplay Shake
  isDisplayShake();

  // Delay 1 Second
  delay( 1000 );
  
}

getDisplay.ino

CODE
// DFRobot Display 320x480
// DFRobot Display 320x480 - UID
void isDisplayUID(){

  // DFRobot Display 240x320
  // Text Display
  // Text Wrap
  screen.setTextWrap(false);
  // Rotation
  screen.setRotation(3);
  // Fill Screen => black
  screen.fillScreen(0x0000);
  // Text Color => white
  screen.setTextColor(0xffff);
    // Font => Free Sans Bold 12pt
  screen.setFont(&FreeSansBold12pt7b);
  // TextSize => 1.5
  screen.setTextSize(1.5);
  // Don Luc Electronics
  screen.setCursor(0, 30);
  screen.println("Don Luc Electronics");
  // BME280 Environmental
  screen.setCursor(0, 60);
  screen.println("Shake Interrupt");
  // Version
  screen.setCursor(0, 90);
  screen.println("Version");
  screen.setCursor(0, 120);
  screen.println( sver );

}
// isDisplay Shake
void isDisplayShake(){

  // DFRobot Display 320x480
  // Text Display
  // Text Wrap
  screen.setTextWrap(false);
  // Rotation
  screen.setRotation(3);
  // Fill Screen => white
  screen.fillScreen(0xffff);
  // Text Color => blue
  screen.setTextColor(0x001F);
    // Font => Free Sans Bold 12pt
  screen.setFont(&FreeSansBold12pt7b);
  // TextSize => 1.5
  screen.setTextSize(1.5);
  // Shake Interrupt
  screen.setCursor(0, 30);
  screen.println("Shake Interrupt");
  // Status
  screen.setCursor(0, 60);
  screen.print("Shake Flag");
  screen.setCursor(0, 90);
  screen.print( sFlag );
  // LED Green
  screen.setCursor(0, 120);
  screen.print("LED Green");
  screen.setCursor(0, 150);
  screen.println( sLEDGreen );
  // LED Red
  screen.setCursor(0, 180);
  screen.print("LED Red");
  screen.setCursor(0, 210);
  screen.println( sLEDRed );

}

getShake.ino

CODE
// Shake Interrupt
// is Shake
void isShake(){

// Led Red
digitalWrite(iLedRed, LOW);
sLEDRed = "LOW";

// Led Green
digitalWrite(iLedGreen, HIGH);
sLEDGreen = "HIGH";

// Shake Flag
if (iShakeFlag) {

    // Shake Flag
    iShakeFlag = false; 
    // Flag
    sFlag = "False";

    if (millis() - lLastShakeTime >= lDebounceDelay) {

      // Led Red
      digitalWrite(iLedRed, HIGH);
      sLEDRed = "HIGH";

      // Led Green
      digitalWrite(iLedGreen, LOW);
      sLEDGreen = "LOW";

      // Flag
      sFlag = "True";

      // millis
      lLastShakeTime = millis();

    } 

  } else {

    // Flag
    sFlag = "False";

  }

}
// Handle Interrupt
void handleInterrupt() {

  iShakeFlag = true; 

}

setup.ino

CODE
// Setup
void setup()
{

    // Delay
  delay( 100 );

  // LED Green
  pinMode(iLedGreen, OUTPUT);

  // LED Red
  pinMode(iLedRed, OUTPUT);
  
  // Shake Interrupt
  pinMode(iShakeInterrupt, INPUT_PULLUP); 

  // Attach Interrupt
  attachInterrupt(digitalPinToInterrupt(iShakeInterrupt), handleInterrupt, RISING);

  // Delay
  delay(100);

  // DFRobot Display 320x480
  screen.begin();

  // Delay
  delay( 100 );

  // DFRobot Display 320x480 - UID
  // Don Luc Electronics
  // Versioc
  isDisplayUID();
  
  // Delay
  delay( 5000 );

}

People can contact us: http://www.donluc.com/?page_id=1927

 

Consultant, R&D, Electronics, IoT, Teacher and Instructor

 

-Programming Language
-Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc...)
-IoT
-Wireless (Radio Frequency, Bluetooth, WiFi, Etc...)
-Robotics
-Automation
-Camera and Video Capture Receiver Stationary, Wheel/Tank , Underwater and UAV Vehicle
-Unmanned Vehicles Terrestrial, Marine and UAV
-Machine Learning
-Artificial Intelligence (AI)
-RTOS
-Sensors, eHealth Sensors, Biosensor, and Biometric
-Research & Development (R & D)
-Consulting
-Etc...

 

Follow Us

 

Luc Paquin – Curriculum Vitae - 2026
https://www.donluc.com/luc/LucPaquinCVEng2026Mk01.pdf
https://www.donluc.com/luc/

 

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
DFRobot: https://learn.dfrobot.com/user-10186.html
TikTok: https://www.tiktok.com/@luc.paquin
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

 

Don Luc

icon DL2610Mk01.zip 222KB Download(0)
License
All Rights
Reserved
licensBg
0