GithubHelp home page GithubHelp logo

matteoorlandini / sensortile-firmware-bachelor-thesis Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 56.29 MB

Bachelor thesis - SensorTile STLCS02V1 firmware developed for my bachelor thesis

C 21.68% C++ 70.21% HTML 2.63% Rich Text Format 0.22% Assembly 3.60% Batchfile 0.05% Shell 0.02% Makefile 1.59%
sensortile stm32 stm32l4 stmicroelectronics firmware thesis stm32l476 ble bluetooth bluetooth-low-energy

sensortile-firmware-bachelor-thesis's Introduction

SensorTile-Firmware-Thesis

Introduction

This project is part of my bachelor thesis and was born with the aim of developing a firmware in C language to acquire data from motion sensors present on the SensorTile STLCS02V1 platform. The MEMS sensors LSM6DSM (accelerometer + gyroscope) and LSM303AGR (accelerometer + magnetic sensor) allow non-invasive use and extremely low energy consumption. The aim of the project is the transmission of Bluetooth packets containing data from inertial sensors. Measurements obtained from the various components were merged to optimize energy consumption and performance.

To receive the Bluetooth packets, some Python scripts have been written using the bluepy library that allows the user to save the detected values. In particular, the pitch and roll angles obtained by the gyroscope and by the accelerometer are calculated by doing data processing on the board using a sensor fusion algorithm and a complementary filter.

During the project, the open source firmware FP-SNS-ALLMEMS1 made available by STMicroelectronics and compatible with the SensorTile was studied, modified and expanded.

Prereqs

System Workbench for STM32 configuration

How to build

This package contains projects for 3 IDEs viz. IAR, µVision and System Workbench. In order to make the program work, you must do the following:

  • WARNING: before opening the project with any toolchain be sure your folder installation path is not too in-depth since the toolchain may report errors after building.

For System Workbench:

  • Open System Workbench for STM32 (this firmware has been successfully tested with System Workbench for STM32 Version 2.4.0.201801120948)

  • Set the default workspace proposed by the IDE (please be sure that there are not spaces in the workspace path).

  • Press "File" -> "Import" -> "Existing Projects into Workspace"; press "Browse" in the "Select root directory" and choose the path where the System Workbench project is located (SW4STM32\STM32L476RG-SensorTile).

  • Rebuild all files and and run these script that you find on the same directory:

    • if you are on windows and you had installed the STM32 ST-Link utility:
      • For STEVAL-STLKT01V1: CleanALLMEMS1_SW4STM32_ST.bat
    • Otherwise (Linux/iOS or Windows without the STM32 ST-Link Utility):
      • For STEVAL-STLKT01V1: CleanALLMEMS1_SW4STM32_ST.sh

    cd ./STM32CubeFunctionPack_ALLMEMS1_V3.4.0/Projects/Multi/Applications/ALLMEMS1/SW4STM32/STM32L476RG-SensorTile

    chmod +x CleanALLMEMS1_SW4STM32_ST.sh

    ./CleanALLMEMS1_SW4STM32_ST.sh

Bluepy Python

This firmware was used with some Python scripts that used the Bluepy library to scan and connect to the SensorTile device and enable BLE notification on Linux.

Performance analysis

Complementary filter

The figure below shows a comparison between the filtered (with a complementary filter) pitch data, in blue, and the data simply obtained from the formulas in which are used the accelerometer axis values, in red.

The figure below shows a comparison between the filtered (with a complementary filter) roll data, in blue, and the data simply obtained from the formulas in which are used the accelerometer axis values, in red.

Power consumption

The INA226 board was used to measure the current consumption, which allows to measure the current through a shunt resistance of 0.1 mΩ.

  • When the microcontroller is in sleep the average current is 370.1 µA. To make this measurement, the state of the micro controller was forced in sleep using the MCU_PowerSave() function.

  • The average current during advertising is 12.2 mA. In the first 5 seconds the device is connected to the server, in the following ones the advertising data are sent.

You may notice current peaks every 50 ms, in fact the advertising data are transmitted at a frequency of 20 Hz.

  • The average current while the device is connected and is streaming data is 15.1 mA.

You may notice current peaks every 10 ms, this is due to the transmission of data via Bluetooth at the frequency of 100 Hz.

sensortile-firmware-bachelor-thesis's People

Contributors

matteoorlandini avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.