element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Experimenting with Vibration Sensors
  • Challenges & Projects
  • Design Challenges
  • Experimenting with Vibration Sensors
  • More
  • Cancel
Experimenting with Vibration Sensors
Blog Noise and Vibration Impact on Aquarium Sea-life - Blog Post #2
  • Blog
  • Forum
  • Documents
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: guillengap
  • Date Created: 1 Jan 2021 8:30 AM Date Created
  • Views 215 views
  • Likes 3 likes
  • Comments 2 comments
  • kemet vibration sensor
  • aquarium
  • experimenting with vibration sensors
  • nucleo-h743zi
Related
Recommended

Noise and Vibration Impact on Aquarium Sea-life - Blog Post #2

guillengap
guillengap
1 Jan 2021

1. INTRODUCTION

 

Below I will expose my project that I proposed to do according to my first post:  Noise and Vibration Impact on Aquarium Sea-life - Blog Post #1

As you can see, my ideas were changed due to hardware and software issues that I will detail in the following sections.

I'm the author, creator and owner of this end Project: idea, electrical diagram, and code.

 

2. HARDWARE

 

In the electronic diagram below I show the connections of the electronic components that I use:

List of parts:

  • NUCLEO-H743ZI
  • Vibration Sensor (KEMET)
  • 12C LCD 20x4
  • LED diode
  • Battery 5V
  • Micro USB to USB cable
  • Air pump

Tools:

  • Soldering iron
  • Double-sided adhesive tape

 

3. ASSEMBLING THE DEVICE

 

Step 1.- Unpack the NUCLEO-H743ZI2 board.

Features:

  • STM32 microcontroller in LQFP144 package
  • 3 user LEDs
  • 2 user and reset push-buttons
  • 32.768 kHz crystal oscillator
  • Board connectors:SWDST Zio expansion connector including ARDUINORegistered Uno V3ST morpho expansion connector
  • Flexible power-supply options: ST-LINK, USB VBUS or external sources
  • On-board ST-LINK debugger/programmer with USB re-enumeration capability: mass storage, Virtual COM port, and debug port

 

Step 2.- Identify the pins that we are going to use on the board and that we identify according to the figure below. In my case I'm going to use the included mapping for Arduino UNO V3.

Step 3.- Inserting the LED diode between pins D13 and ground.

Step 4.- Wiring 12C LCD display: SDA pin is connected to D14 and SCL pin to D15.of the NUCLEO board respectively. VCC is 5V.

Step 5.- Cut the vibration sensor connector, and solder the straight pins as shown in the figure below:

Specifications:

  • Temperature Range: -25/+75°C
  • Power Supply Voltage: 3 - 5.5 VDC
  • Sensitivity: 20 mV/m/s²
  • Frequency Range: 10 - 15,000 Hz
  • Measuring Range: +/-50 m/s

 

Step 6.- Connect the KEMET vibration sensor. The white wire (Vout pin) connects to pin D2 on the NUCLEO board. VCC is 5V.

Step 7.- Stick double-sided tape on the bottom of the air pump.

Step 8.- The vibration sensor thinly spread on the adhesive surface.

Step 9.- Check if everything is OK. Now our device is ready to upload the code to the NUCLEO board and do tests. Now our device is ready to upload the code to the NUCLEO board and do tests.

 

4. SOFTWARE

 

Step 1.- I'm going to use the Arduino IDE to make the code, so we have to download the most recent version from the official site: https://www.arduino.cc/en/software

 

Step 2.- Launch Arduino IDE.

Click on File menu and then Preferences

The Preferences dialog will open, then add the following link to the Additional Boards Managers URLs field:

https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json

Step3.- Click OK,. Now, click on Tools menu and then “Boards > Boards Manager”

Next in the box type: stm32

and install the boards: STM32 Cores

Step 4.- There're different types and versions of libraries to work with the LCD to I2C Adapter module, more complete information can be found at: http://playground.arduino.cc/Code/LCDi2c, we will use the LiquidCrystal_I2C library: https://github.com/johnrickman/LiquidCrystal_I2C 

 

Step 5.- Select the NUCLEO board:

clicking on Tools> Board: "Nucleo-144"

Click on Tools> Board part number: "Nucleo H743ZI2"

and Click on Tools > Port

Step 6.- Upload the aquarium_vibration_sensor.ino code (comments guide us).

 

// AUTHOR: GUILLERMO PEREZ GUILLEN

 

#include <Wire.h> // Library for I2C communication

#include <LiquidCrystal_I2C.h> // Library for LCD

 

// Wiring 12C LCD: SDA pin is connected to D14 and SCL pin to D15.

// Connect to LCD via I2C, default address 0x27 (A0-A2 not jumpered)

 

LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 20, 4); // Change to (0x27,16,2) for 16x2 LCD.

 

int LED_Pin = D13; // LED diode

int vibr_Pin =D2; // Vout of the vibration sensor

int vibr_max = -100;

 

void setup() {

  // Initiate the LCD:

  lcd.init();

  lcd.backlight();

  pinMode(LED_Pin, OUTPUT);

  pinMode(vibr_Pin, INPUT); //set vibr_Pin input for measurment

  Serial.begin(9600); //init serial 9600 

}

 

void loop() {

  long measurement =TP_init();

  delay(50);

  Serial.println(measurement);

 

  // DETECTING VIBRATION MAXIMUM

  if (measurement > vibr_max){

    vibr_max = measurement;

  }

 

  // DETECTING VIBRATIONS ABOVE 1000 MICROSECONDS  

  if (measurement > 1000){ //

    digitalWrite(LED_Pin, HIGH);

  }

  else{

    digitalWrite(LED_Pin, LOW);

  }

 

  // PRINTING VALUES

  lcd.setCursor(0, 0); // Set the cursor on the 1st column and 1st row.

  lcd.print("  VIBRATION SENSOR"); // Print the string "VIBRATION SENSOR"

  lcd.setCursor(0, 2); //Set the cursor on the 1st column and the 3rd row.

  lcd.print("Measurment = ");

  lcd.setCursor(13, 2); //Set the cursor on the 13th column and the 3rd row.

  lcd.print(measurement); 

  lcd.print("      ");

  lcd.setCursor(0, 3); //Set the cursor on the 1st column and the 4th row.

  lcd.print("Maximum = "); 

  lcd.setCursor(10, 3); //Set the cursor on the 10th column and the 4th row.

  lcd.print(vibr_max);   

  lcd.print("      "); 

}

 

// DETECTING MESUREMENTS

long TP_init(){

  delay(20);

  long measurement=pulseIn (vibr_Pin, HIGH);  //wait for the pin to get HIGH and returns measurement

  return measurement;

}

 

NOTE: You can download it on github:  https://github.com/guillengap/aquarium-vibration-sensor

 

Step 7.- How does it work?

 

  • I use the pulseIn function to measure the time of each pulse;

 

          // DETECTING MESUREMENTS

          long TP_init(){

            delay(20);

            long measurement=pulseIn (vibr_Pin, HIGH);  //wait for the pin to get HIGH and returns measurement

            return measurement;

          }

 

  • Now we can calculate the vibration frequency using the formula f = 1 / t;
  • I have created a routine to calculate the maximum vibration;

 

            // DETECTING VIBRATION MAXIMUM

            if (measurement > vibr_max){

              vibr_max = measurement;

            }

 

  • If the vibrations are above 1000 microseconds then the LED diode lights up; and

 

            // DETECTING VIBRATIONS ABOVE 1000 MICROSECONDS 

            if (measurement > 1000){ //

              digitalWrite(LED_Pin, HIGH);

            }

 

  • We print the pulse time values and the maximum value on the display;

 

            // PRINTING VALUES

            lcd.setCursor(0, 0); // Set the cursor on the 1st column and 1st row.

            lcd.print("  VIBRATION SENSOR"); // Print the string "VIBRATION SENSOR"

            lcd.setCursor(0, 2); //Set the cursor on the 1st column and the 3rd row.

            lcd.print("Measurment = ");

            lcd.setCursor(13, 2); //Set the cursor on the 13th column and the 3rd row.

            lcd.print(measurement);

            lcd.print("      ");

            lcd.setCursor(0, 3); //Set the cursor on the 1st column and the 4th row.

            lcd.print("Maximum = ");

            lcd.setCursor(10, 3); //Set the cursor on the 10th column and the 4th row.

            lcd.print(vibr_max);  

            lcd.print("      ");

          }

 

5. TEST

Due to the pandemic situation around the world, at the moment I did the tests in my private turtle aquarium.

Now I did a first initial test with the air pump to see the maximum readings of time in microseconds, the LED diode turned on/off, check the vibration frequency in Hertz and use the reset button. You can see all this in the video below.

You don't have permission to edit metadata of this video.
Edit media
x
Upload Preview

Everything is fine, now we do the final test with the aquarium as shown below.

You don't have permission to edit metadata of this video.
Edit media
x
Upload Preview

Observtions:

  • In this video we can see a journey through this project;
  • Then we start with the lowest power level of the air pump;
  • The first reading is 9124 microseconds per cycle, that is 109 Hertz;
  • The LED diode is on since the reading is above 1000 microseconds;
  • The aquarium is fine, and it seems that the noise of the air pump doesn't cause annoyance to the turtles that enjoy their sunbath;
  • The time is now 10146 microseconds, that is 98 Hertz;
  • But when we increase the power of the air pump, then the pump is more unstable, as we can see below;
  • The time starts with 9256 microseconds, or 108 Hertz;
  • In a few seconds the time shoots up to 456488 microseconds, that is 2 Hertz;
  • The air pump is moving from its initial position and I have to hold it.

 

6. CONCLUSION

 

This first approach has allowed me to conclude that:

  1. The vibration sensor can be useful to measure and control annoying vibrations in aquariums, especially in aquatic species that are sensitive such as turtles;
  2. My test let me know that when I use full power from the air pump, its produces undesirable noises and more force is needed to keep it fixed in its original position;
  3. In the case of the air pump, I need to fix it in a safe place and use a low power; and
  4. There is no point in listing the hardware and software difficulties that I've encountered. so I will update this tutorial until the deadline.
Anonymous

Top Comments

  • mcfryday
    mcfryday over 1 year ago +1

    Hi Guillermo, it is very interesting to identify vibrations that could harm or change the behaviour / wellbeing of animals, never thought about it. KEMET caries also a waterproof version which may be i…

Parents
  • mcfryday
    mcfryday over 1 year ago

    Hi Guillermo, it is very interesting to identify vibrations that could harm or change the behaviour / wellbeing of animals, never thought about it. KEMET caries also a waterproof version which may be i.e. in the water around where fishes or Dolphins are... perhaps a thought for further investigations. Cheers, Michael

    • Cancel
    • Up +1 Down
    • Reply
    • More
    • Cancel
  • guillengap
    guillengap over 1 year ago in reply to mcfryday

    Thanks for the feedback on my contribution ... I already knew KEMET in the hackster.io contests

    Kind regards... Guillermo

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
Comment
  • guillengap
    guillengap over 1 year ago in reply to mcfryday

    Thanks for the feedback on my contribution ... I already knew KEMET in the hackster.io contests

    Kind regards... Guillermo

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
Children
No Data
Element14

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2022 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube