Code Monkey home page Code Monkey logo

distance_and_timedisplay_freertos_stm32f411's Introduction

Distance_and_TimeDisplay_FreeRTOS_STM32F411

This is a project where multitaksing is demonstrated with FreeRTOS and STM32F411 Evalboard

Summary

In this project, Time in HHMMSS format is displayed on LCD Display and the Distance of an object from an Ultrasonic sensor HC-SR04 is displayed in cm. LCD Display is controlled via I2C bus. In this project i have used GPS module to extract time. Ultrasound module HC-04 to measure distance in cm between the module and the object. Time and Distance are displayed on the LCD display. The uC sends commands to LCD via I2C bus. I have used FreeRTOS to manage my 4 Tasks. Task1 is a dummy task that blinks LEDs. Task 2 parses time from a buffer that is filled when a DMA Transfer complete is done. Task 3 calculates the distance depending on the pulsewidth of the echo signal recieved from HC-04 module. Task 4 is for displaying the parsed time and distance to the LCD.

img

img

img

HW used

  • STM32F411VE Discovery board
  • Ultrasonic sensor HC-SR04 Sensor module
  • 1604 LCD Display via I2C Bus
  • Waveshare Wireless UART GPS Module NEO-7M-C
  • USART to USB module (for Debugging)
  • Logicanalyzer

SW Toolchain

  • SW4STM32 built by Ac6 based on Eclipse IDE,
    • ARM-GCC Compiler
    • ST-Link Support
  • Salae Logicanalyzer GUI.
  • Operating System- Ubuntu Linux

Source code features

  • FreeRTOS port for CortexM4
  • Standard Peripheral Libraries (StdPeriph_Driver)

Working principle - Distance

The HC-04 module has Trigger and Echo pin.

Timer 2 (TIM2-CH3) is configured to send the trigger signal with a specific dutycycle.

img

Depending on the distance of the object from the Ultrasound module, a pulse is generated by echo Pin.The Echo pin is connected to input capture Pin (Timer1-CH1). The Pulsewidth of the received pulse in milliseconds is used to determine the distance.

For more details refer this PDF. https://www.mouser.com/ds/2/813/HCSR04-1022824.pdf

Sound travels at approx. 343 meters/second. Distance in centimeters is hence, (pulsewidth(ms)*34300(cm/s))/2;

Distance in cm = (PW/1000)seconds * (17150)(cm/seconds)

img

img

img

distance_and_timedisplay_freertos_stm32f411's People

Contributors

abtom87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.