element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
  • Settings
Experimenting with Vibration Sensors
  • Challenges & Projects
  • Design Challenges
  • Experimenting with Vibration Sensors
  • More
  • Cancel
Experimenting with Vibration Sensors
Blog Vibration Sensor and Exercising - High Vibration Detection on Nucleo Board Alone (No Jetson Nano) and Telegram Bot - Blog #5
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: yosoufe
  • Date Created: 22 Jan 2021 3:58 AM Date Created
  • Views 1450 views
  • Likes 4 likes
  • Comments 2 comments
Related
Recommended

Vibration Sensor and Exercising - High Vibration Detection on Nucleo Board Alone (No Jetson Nano) and Telegram Bot - Blog #5

yosoufe
yosoufe
22 Jan 2021

  • Introduction
  • REMOTELY Programming and Debugging the Nucleo Board (via WiFi)
  • Detecting Vibration on Nucleo Board alone (No Jetson Nano Anymore)
  • Bluetooth Working
  • End to End Prototype Working
  • Related Links

 

Introduction

In the previous blog, I have used Nucleo board to measure the signal and just pass the measurement to Jetson nano. We did some processing on Jetson and developed a logic to detect high and annoying vibrations that We could create. This logic was running on Jetson nano. In this blog we are trying to remove the Jetson Nano as the signal processor and do the FFT calculation and Signal Processing on the Nucleo Board.  I would still use Jetson Nano as a remote programmer and debugger for my Nucleo board. In this blog I am also demoing the end to end prototype from measurement on Nucleo board, send a notification via Bluetooth to send notification via a telegram bot.

 

REMOTELY Programming and Debugging the Nucleo Board (via WiFi)

I recently learned from this guy https://youtu.be/p1-S9G3pl4I  that I can remotely program and debug my code on Nucleo board without disconnecting it from Jetson board and connecting it to my workstation. This is really amazing. I have a short video demoing it. It may be useful to others as well. If you do not know why this is very useful to me, please have a look at my previous blog (#4) to read about my measurement setup.

 

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

 

 

Detecting Vibration on Nucleo Board alone (No Jetson Nano Anymore)

Here I managed to implement the same detection that we had in python in previous blog now in C and all in Nucleo board. I had to fine tune it a bit more. Because FFT library in CMSIS only accepts the signals of length with power of 2. So now I am using 512 samples and also I would check the frequencies between 75 Hz and 85 Hz only. Checking for higher frequency like until 150 Hz made the detection too sensitive in a way that when I was dropping something on the table 2 meters away, it was detecting it. We do not want that much sensitivity. Here is a short demo of working example. The notification system is a green LED, so make sure you watch the video with enough high quality that the LED would be visible. The LED stays on for one second when it detects vibration.

 

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

 

You may find the code on my GitHub. The link is at the exact commit that I used here. On Blog #3 we have discussed briefly on how to calculate FFT on Nucleo board and how to use the CMSIS library for that, I am using mostly the same code with a bit of refactoring and small added logic.

 

Bluetooth Working

This is the first time I am using Bluetooth as a developer and not a user. I spent a lot of time at the end of 2020 on learning the BLE and Bluetooth and how it works. It seems very complicated but fortunately there are a lot of good examples for it on the STM32CubeIDE to get started.

 

The BLE expansion board needs a small modification to make it work with the NUCLEO-H7 board. On the expansion board the R6 is not soldered by default. And it is needed to be filled with a zero ohm resistor. Then all of the SPI and other pins would be compatible with this specific board.

 

I have added a lot of resources to learn about BLE at the end of this blog in "Related Links" section. You can check them out if you are interested. Two of them is about how to setup the STM development environment to work with BLE. They are using old development platforms but it should be easy to transfer that knowledge to the new STM32CubeIDE.

 

I developed most of the BLE code before knowing what I am going to do with it exactly so I have defined too many services. I am just using one of them for now to notify the BLE client. Here is a short video of getting notification on "ST BLE Sensor" application on my android phone. This is only for testing if the BLE application on the Nulceo board works. So it is not clean or user friendly. Here is a short video of it. I am using scrcpy to control and capture the screen of my android phone on Ubuntu.

 

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

 

End to End Prototype Working

So I got the end to end prototype working. By end to end I mean:

  • Nucleo board measures the output of the Kemet Sensor at frequency of 1 kHz using a timer and ADC
  • A DMA is triggered at end of each conversions to a buffer with length of 512 values.
  • When the buffer is full, the FFT calculation is done on the buffer.
  • The value of FFT is checked for frequencies between 75 Hz and 85 Hz and if they are higher than 15, A notification is triggered.
  • There is a small difference here from when we were calculating the FFT on Jetson Nano. On Jetson Nano we were calculating FFT every few samples like having a circular buffer. But on Nucleo board, each calculation of FFT is being done on a bunch of completely new data. So if the vibration is too short and it exactly happens at close to the end of the buffer, it may not trigger the notification threshold.
  • The notification is being  sent via BLE to a BLE client.
  • In the demo below I have a python script as the BLE client which uses the workstation's Bluetooth to connect to the Nucleo board. This can run on any PC. Even a raspberry pi or the Jetson nano with BLE module as a hub.
  • The BLE client sends a message to a telegram bot to notify me on my smart phone.

 

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

 

 

Related Links

  • My Progress and other blogs
  • All files in GitHub
  • Resources about Bluetooth:
    • X CUBE BLE1 for STM32CubeMX: https://youtu.be/eiknW5Ml9dA
    • STM32CubeMX- easy integration - 01 Introduction and agenda: https://youtu.be/YtII8hNxgfk
    • STM32CubeMX- easy integration - 02 Creating STM32 BLE - STM32CubeMX: https://youtu.be/jGSdMAFVI_U
    • STM32CubeMX- easy integration - 03 Creating STM32 BLE - TrueStudio: https://youtu.be/fS_ZQqa7rXI
    • MOOC - STM32WB workshop: https://youtube.com/playlist?list=PLnMKNibPkDnGRfqUO1Q_-1nW-tOKfDQbc
    • Bluetooth Low Energy Series: https://www.youtube.com/playlist?list=PLSdxNjcHc0u9PdQSd3l3-gDJGzJ_eB50f
    • Introduction to BLE by Adafruit: https://learn.adafruit.com/introduction-to-bluetooth-low-energy/introduction
    • About GATT and BLE https://www.bluetooth.com/specifications/gatt/
    • Python Library for BLE: gattlib
  • Telegram Bot
  • Python Telegram Bot Library
  • Sign in to reply

Top Comments

  • navadeepganeshu
    navadeepganeshu over 4 years ago +2
    Nice upgrade! Just realized that python is so powerful with its APIs and libraries.
  • yosoufe
    yosoufe over 4 years ago in reply to navadeepganeshu +2
    Thanks navadeepganeshu , Yeah. It is fast for prototyping and getting something done.
  • yosoufe
    yosoufe over 4 years ago in reply to navadeepganeshu

    Thanks navadeepganeshu,  Yeah. It is fast for prototyping and getting something done.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • navadeepganeshu
    navadeepganeshu over 4 years ago

    Nice upgrade! Just realized that python is so powerful with its APIs and libraries.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

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 © 2025 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

  • X
  • Facebook
  • linkedin
  • YouTube