Measuring distance using an ultrasonic sensor and displaying it on an LCD, via the Raspberry Pi

Built using a Raspberry Pi 3B+ running Raspbian.

Parts:

1 x Breadboard 

1 x Raspberry Pi

1 x 1602 LCD Display

1 x HC-SR04 Ultrasonic sensor 

2 x Potentiometers (for controlling brightness)

 

Keyboard/mouse/etc. for coding. 

 

Connect parts as in diagram. Run code on Raspberry Pi

 

Code built by adapting multiple different sites. The code uses the RPLCD Library. However, it does need one correction to be made.