Skip to content

A code to calculate distance from an obstacle using HC-SR04 sensor.

Notifications You must be signed in to change notification settings

ChandraKiranSaladi/MSP432-Ultrasonic-UART

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

MSP432P401R Integration with UltraSonic Sensor and UART

A program which calculates distance from an obstacle using HC-SR04 and displays the distance serially with UART


Technical Specs

* Embedded-C
* Code Composer Studio
* MSP432P401R
* UART
* Putty
* Ultrasonic Sensor ( HC - SR04 )
* Timers
* Interrupts
* Register Level Code

Prerequisites


Description:

  • Ultrasonic Sensor has 4 pins. Vcc, GND, Trigger and Echo pins. The sensor gets triggered by supplying 10 microsecond wide pulse. The sensor generates a pulse from the echo pin with a period proportional to the distance of the obstacle from sensor.
  • Echo pin from the sensor is connected to a voltage divider which reduces it to 3.3V, tolerable by the MSP, to Port 2 Pin 7.
  • Trigger pin of sensor is connected to Port2 Pin 6.
  • MSP432 board is connected to a computer via USB

Important Note

  1. Remember to supply 5V for HC-SR04

  2. MSP432 is not tolerant to 5V input. Use voltage divider ( max voltage => 3.7V )

  3. Range of HC-SR04 is 4cm to 200cm

  4. Check Device Manager in Windows to find the COM port of MSP432. You'll need to use this information while connecting to a serial console like Putty


Execution

  1. Read description and important note before reading these instructions
  2. Create new project inside Code Composer Studio
  3. Copy the file contents of MSP432-Ultrasonic.c into your editor
  4. Open putty and select serial with COM port ( check device manager ) and baud rate: 9600
  5. Execute the code and see values rush to putty

Feedback

Leave any suggestions or issues in the code by opening an issue page


About

A code to calculate distance from an obstacle using HC-SR04 sensor.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages