Posted on

Interfacing Ultrasonic Sensor HY-SRF05 with PIC Microcontroller

Interfacing Ultrasonic Sensor HY-SRF05 with PIC Microcontroller is the fourth tutorial in a series of tutorials on Design Embedded System with PIC Microcontroller. In this tutorial we will measure the distance of an object using ultrasonic sensor and transmit it using Bluetooth.

In case you are new to PIC Microcontroller and MPLAB X IDE I strongly suggest to visit the tutorial – Getting started with MPLAB X IDE.

For interfacing Bluetooth with PIC Microcontroller we will require the following components which can be purchased in OpzLab web store. Links to the individual components are also provided.

  1. PICKIT3 Debugger / Programmer
  2. PIC16F15325
  3. Mini Breadboard
  4. Power Supply
  5. HC-05 Bluetooth Modules
  6. HY-SRF05 Ultrasonic Sensor
  7. Buzzer
  8. Jumper Wires

Follow the below tutorial to measure the distance of an object using ultrasonic sensor and transmit it using Bluetooth.

Start MPLAB X IDE, create a new project with the device settings as mentioned in the tutorial Interfacing LED with PIC Microcontroller.

After the project is created open MPLAB Code Configurator and proceed with the below settings.

Follow the tutorial Interfacing Bluetooth Module HC05 with PIC Microcontroller to setup UART module.

Circuit