Distance meter using PIC12F1822 and HC-SR04 sensor – CCS C

Distance meter using PIC12F1822 microcontroller and HC-SR04 ultrasonic sensor

This topic shows how to make a simple distance meter using PIC12F1822 microcontroller and HC-SR04 ultrasonic sensor.

I’m not going to write any information about the HC-SR04 ultrasonic sensor because it’s well described in its datasheet as well as the following three topics:
PIC16F84A with HC-SR04 ultrasonic sensor example
Interfacing PIC16F877A with HC-SR04 ultrasonic sensor
Interfacing PIC18F4550 Microcontroller with HC-SR04 Ultrasonic Sensor

Components List:

  • PIC12F1822 Microcontroller
  • HC-SR04 Ultrasonic sensor
  • 1602 LCD display
  • 74HC595 Shift Register
  • 10K Variable Resistor
  • +5V Power Source
  • Breadboard
  • Jumper Wires

Interfacing PIC12F1822 with HC-SR04 ultrasonic sensor circuit:
This is our example circuit schematic where internal oscillator of PIC12F1822 is used.
The LCD display is used to display the distance result.
To interface 1602 LCD with PIC12F1822 microcontroller we need 74HC595 shift register as what was done in this post:
Interfacing PIC12F1822 microcontroller with LCD display

Distance meter with PIC12F1822 and HC-SR04 circuit

Interfacing PIC12F1822 with HC-SR04 ultrasonic sensor CCS C code:


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top