Project

# How to Interface an Ultrasonic Sensor with an LCD Using a Microcontroller Dev Kit

November 02, 2017 by Nick Davis

## Let's interface an ultrasonic sensor and a lighting system! In this project, we'll design a sensor subsystem and then use it in a parking sensor application.

Let's interface an ultrasonic sensor and a lighting system! In this project, we're going to design a system that uses an ultrasonic sensor to trigger a lighting system and an LCD as an information screen.

To show the system in action, we're making a non-contact garage parking sensor system using a C8051 microcontroller development kit and the Simplicity Studio IDE. The measured distance will be displayed on the LCD screen, and two LED floodlights will activate as a function of the distance between the vehicle and the sensor.

### System Requirements and Applications

The system we're building here has the following features and requirements:

• Proximity/detection sensor: The ultrasonic distance sensor serves as a proximity/detection sensor. When an object is detected, it must constantly, in real time and with minimal time lag, measure the distance to a moving object.
• Small in size: The system should not occupy too much space in the garage or wherever else it is used, and it should fit within a reasonably sized enclosure.
• Bells and whistles, and/or lights: The system must have a noticeable alarm for announcing when an object has reached its ideal/targeted location.
• No AC voltage: It must be free of AC voltage (for safety and mobility reasons). Using 12 V as the supply voltage allows the system to run from an off-the-shelf AC-to-DC converter or from a 12 V battery.

Based on these parameters, you should be able to incorporate this system into a number of different applications:

• Swimming pool or home garden detection system for sending an alert when the curiosity of children and/or pets gets the better of them…like that never happens.
• To help prevent your friends and neighbors (or family members!) from stealing the leftover pizza and beer from your fridge—they are free to roam your kitchen, but if they get too close to the fridge…SOUND THE ALARM!
• Do you like to camp and enjoy the great outdoors? A battery-powered system could be used to help prevent your young children from getting too close to a stream when you’re reading your book or casting that fishing line.

At the end of this project, I'll show you a sensing system for a garage in action.

Let's get started by going through our bill of materials.

### BOM

Item # Description / Source Cost (each) Other Information
1   C2400DK development kit   $148.75 User guide (PDF) Quick-start guide (PDF) C8051F930 datasheet (PDF) Note: schematics are on pages 25-31 of the User Guide. 2 Breadboard$8.98   or equivalent
3   Jumper wire kit   $6.20 or equivalent 4 Ultrasonic sensor$29.99   Datasheet (PDF)
5   N-Channel MOSFET   $1.17 Datasheet (PDF) 6 5V voltage regulator$2.66   Datasheet (PDF)
7   LED floodlight (qty 2)   $10.50 10W (12V DC or AC) 8 10μF capacitor$0.22   or equivalent

Like.