Skip to content

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

Notifications You must be signed in to change notification settings

abtom87/Distance_and_TimeDisplay_FreeRTOS_STM32F411

Repository files navigation

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

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published