Project #25 – Movement – ADXL345 – Mk07
——
#DonLucElectronics #DonLuc #ADXL345 #Accelerometer #Movement #ESP32 #Bluetooth #Elecrow #DFRobot #Arduino #Project #Patreon #Electronics #Microcontrollers #IoT #Fritzing #Programming #Consultant
——
——
——
——
Crowtail – 3-Axis Digital Accelerometer
Crowtail – 3-Axis Digital Accelerometer with specific Crowtail interface, It’s base on an advanced 3-axis IC ADXL345. This is a high resolution digital accelerometer providing you at max 3.9mg/LSB resolution and large ±16g measurement range. Have no worry to implement it into your free-fall detection project, cause it’s robust enough to survive up to 10,000g shock. Meanwhile, it’s agile enough to detect single and double taps. It’s ideal for motion detection, gesture detection as well as robotics. This digital 3-axis accelerometer has excellent EMI protection.
Its variable output makes it suitable for a wide range of applications:
- 1. HDD shock protection
- 2. Vibration sensor
- 3. Game controller input
- 4. Robotics
- 5. Smart vehicles
- 6. Anywhere you need to obtain motion-sensing and orientation information.
- 7. The excellent sensitivity provide high-precision output up to ±16g.
DL2501Mk03
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: 2.0″ 320×240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Crowtail – I2C Hub 2.0
1 x Crowtail – 3-Axis Digital Accelerometer
1 x Lithium Ion Battery – 1000mAh
1 x Switch
1 x Bluetooth Serial Terminal
1 x USB 3.1 Cable A to C
FireBeetle 2 ESP32-E
SCL – 22
SDA – 21
DC – D2
CS – D6
RST – D3
RX2 – Bluetooth
TX2 – Bluetooth
VIN – +3.3V
GND – GND
DL2501Mk03p
DL2501Mk03p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #25 - Movement - ADXL345 - Mk07 25-07 DL2501Mk03p.ino DL2501Mk03 1 x DFRobot FireBeetle 2 ESP32-E 1 x Fermion: 2.0" 320x240 IPS TFT LCD 1 x GDL Line 10 CM 1 x Crowtail - I2C Hub 2.0 1 x Crowtail - 3-Axis Digital Accelerometer 1 x Lithium Ion Battery - 1000mAh 1 x Switch 1 x Bluetooth Serial Terminal 1 x USB 3.1 Cable A to C */ // Include the Library Code // Arduino #include <Arduino.h> // Wire #include <Wire.h> // DFRobot Display GDL API #include <DFRobot_GDL.h> // Bluetooth Serial #include "BluetoothSerial.h" #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it #endif // Accelemeter ADXL345 #include <ADXL345.h> // Variable ADXL345 library ADXL345 adxl; // Accelerometer ADXL345 // x, y, z int x; int y; int z; // Standard Gravity // xyz double xyz[3]; double ax; double ay; double az; // FullString String FullString = ""; // Bluetooth Serial BluetoothSerial SerialBT; // Defined ESP32 #define TFT_DC D2 #define TFT_CS D6 #define TFT_RST D3 /*dc=*/ /*cs=*/ /*rst=*/ // DFRobot Display 240x320 DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST); // Software Version Information String sver = "25-07"; void loop() { // Accelemeter ADXL345 isADXL345(); // Delay 0.5 Second delay( 500 ); }
getAccelemeterADXL345.ino
// Accelemeter ADXL345 // Setup Accelemeter ADXL345 void isSetupADXL345(){ // Power On adxl.powerOn(); // Set activity inactivity thresholds (0-255) // 62.5mg per increment adxl.setActivityThreshold(75); // 62.5mg per increment adxl.setInactivityThreshold(75); // How many seconds of no activity is inactive? adxl.setTimeInactivity(10); //look of activity movement on this axes - 1 == on; 0 == off adxl.setActivityX(1); adxl.setActivityY(1); adxl.setActivityZ(1); //look of inactivity movement on this axes - 1 == on; 0 == off adxl.setInactivityX(1); adxl.setInactivityY(1); adxl.setInactivityZ(1); // Look of tap movement on this axes - 1 == on; 0 == off adxl.setTapDetectionOnX(0); adxl.setTapDetectionOnY(0); adxl.setTapDetectionOnZ(1); // Set values for what is a tap, and what is a double tap (0-255) // 62.5mg per increment adxl.setTapThreshold(50); // 625us per increment adxl.setTapDuration(15); // 1.25ms per increment adxl.setDoubleTapLatency(80); // 1.25ms per increment adxl.setDoubleTapWindow(200); // set values for what is considered freefall (0-255) // (5 - 9) recommended - 62.5mg per increment adxl.setFreeFallThreshold(7); // (20 - 70) recommended - 5ms per increment adxl.setFreeFallDuration(45); // Setting all interrupts to take place on int pin 1 // I had issues with int pin 2, was unable to reset it adxl.setInterruptMapping( ADXL345_INT_SINGLE_TAP_BIT, ADXL345_INT1_PIN ); adxl.setInterruptMapping( ADXL345_INT_DOUBLE_TAP_BIT, ADXL345_INT1_PIN ); adxl.setInterruptMapping( ADXL345_INT_FREE_FALL_BIT, ADXL345_INT1_PIN ); adxl.setInterruptMapping( ADXL345_INT_ACTIVITY_BIT, ADXL345_INT1_PIN ); adxl.setInterruptMapping( ADXL345_INT_INACTIVITY_BIT, ADXL345_INT1_PIN ); // Register interrupt actions - 1 == on; 0 == off adxl.setInterrupt( ADXL345_INT_SINGLE_TAP_BIT, 1); adxl.setInterrupt( ADXL345_INT_DOUBLE_TAP_BIT, 1); adxl.setInterrupt( ADXL345_INT_FREE_FALL_BIT, 1); adxl.setInterrupt( ADXL345_INT_ACTIVITY_BIT, 1); adxl.setInterrupt( ADXL345_INT_INACTIVITY_BIT, 1); } // Accelemeter ADXL345 void isADXL345(){ // Read the accelerometer values and store them in variables x,y,z adxl.readXYZ(&x, &y, &z); // Output x,y,z values Serial.print("Values of X , Y , Z: "); Serial.print(x); Serial.print(" , "); Serial.print(y); Serial.print(" , "); Serial.println(z); // FullString FullString = "Values of X , Y , Z: " + String(x) + " , " + String(y) + " , " + String(z) + + "\r\n"; // Accelemeter ADXL345 isDisplayADXL345(); // FullString Bluetooth Serial + Serial for(int i = 0; i < FullString.length(); i++) { // Bluetooth Serial SerialBT.write(FullString.c_str()[i]); // Serial Serial.write(FullString.c_str()[i]); } // Standard Gravity // Acceleration adxl.getAcceleration(xyz); ax = xyz[0]; ay = xyz[1]; az = xyz[2]; Serial.print("X="); Serial.print(ax); Serial.println(" g"); Serial.print("Y="); Serial.print(ay); Serial.println(" g"); Serial.print("Z="); Serial.println(az); Serial.println(" g"); Serial.println("**********************"); // FullString // xg FullString = "X = " + String(ax) + " g" + "\r\n"; // FullString Bluetooth Serial + Serial for(int i = 0; i < FullString.length(); i++) { // Bluetooth Serial SerialBT.write(FullString.c_str()[i]); // Serial Serial.write(FullString.c_str()[i]); } // yg FullString = "y = " + String(ay) + " g" + "\r\n"; // FullString Bluetooth Serial + Serial for(int i = 0; i < FullString.length(); i++) { // Bluetooth Serial SerialBT.write(FullString.c_str()[i]); // Serial Serial.write(FullString.c_str()[i]); } // zg FullString = "z = " + String(az) + " g" + "\r\n"; // FullString Bluetooth Serial + Serial for(int i = 0; i < FullString.length(); i++) { // Bluetooth Serial SerialBT.write(FullString.c_str()[i]); // Serial Serial.write(FullString.c_str()[i]); } }
getDisplay.ino
// DFRobot Display 240x320 // DFRobot Display 240x320 - 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 Mono 9pt screen.setFont(&FreeMono9pt7b); // TextSize => 1.5 screen.setTextSize(1.5); // Don Luc Electronics screen.setCursor(0, 30); screen.println("Don Luc Electronics"); // Accelemeter ADXL345 screen.setCursor(0, 60); screen.println("Accelemeter ADXL345"); // Version screen.setCursor(0, 90); screen.println("Version"); screen.setCursor(0, 120); screen.println( sver ); } // Accelemeter ADXL345 void isDisplayADXL345(){ // 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 Mono 9pt screen.setFont(&FreeMono9pt7b); // TextSize => 1.5 screen.setTextSize(1.5); // Accelemeter ADXL345 screen.setCursor(0, 30); screen.println("Accelemeter ADXL345"); // Accelemeter ADXL345 X screen.setCursor(0, 60); screen.println("X: "); screen.setCursor(30, 60); screen.println( x ); // Accelemeter ADXL345 Y screen.setCursor(0, 90); screen.println( "Y: " ); screen.setCursor(30, 90); screen.println( y ); // Accelemeter ADXL345 Z screen.setCursor(0, 120); screen.println( "Z: " ); screen.setCursor(30, 120); screen.println( z ); // Standard Gravity // Accelemeter ADXL345 Xg screen.setCursor(0, 150); screen.println( "Xg: " ); screen.setCursor(40, 150); screen.println( ax ); // Accelemeter ADXL345 Yg screen.setCursor(0, 180); screen.println( "Yg: " ); screen.setCursor(40, 180); screen.println( ay ); // Accelemeter ADXL345 Zg screen.setCursor(0, 210); screen.println( "Zg: " ); screen.setCursor(40, 210); screen.println( az ); }
setup.ino
// Setup void setup() { // Serial Begin Serial.begin(115200); Serial.println("Starting BLE work!"); // Bluetooth Serial SerialBT.begin("DL2501Mk03"); Serial.println("Bluetooth Started! Ready to pair..."); // Delay delay(100); // DFRobot Display 240x320 screen.begin(); // Delay delay(100); // Setup Accelemeter ADXL345 isSetupADXL345(); // DFRobot Display 240x320 - UID // Don Luc Electronics // Version isDisplayUID(); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Electronics, IoT, Teacher, Instructor, R&D and Consultant
- Programming Language
- Single-Board 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 and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- Artificial Intelligence (AI)
- RTOS
- Sensors, eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
Follow Us
Luc Paquin – Curriculum Vitae – 2025
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Patreon: https://patreon.com/DonLucElectronics59
DFRobot: https://learn.dfrobot.com/user-10186.html
Hackster.io: https://www.hackster.io/neosteam-labs
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Twitch: https://www.twitch.tv/lucpaquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/
Don Luc
Leave a Reply