1 of 8

Unit 1 - Training

Lab 1D : Bluetooth ESP32 with Ultrasound Sensor

UCLA Physics Department

1

University of California, Los Angeles

Department of Physics and Astronomy

Physics 4AL

2 of 8

Outline of Lab 1D

  • 1D In-Lab
    • Connect to the ESP 32 Module via wifi
    • Wirelessly obtain ultrasonic sensor data

UCLA Physics Department

3 of 8

Setup

  • Goal: use the TCP/IP protocols to get
    • TCP = Transmission Control Protocol over a network (ex. wifi)
    • Client requests data (laptop) & Server provides data (ESP32)
    • Data is transferred through the wifi Router

UCLA Physics Department

3

24 Summer Training

4 of 8

Wiring Diagram

4

Trig 2

Echo 4

5 of 8

Running Window

5

  • The code is provided in .txt format. Please copy it to the Arduino IDE and save it to your computer.
  • Change “Your_name” to either your name or table number

6 of 8

Check the Port Number

This PC > Manage

> Device Manager

You can find the port #

For USB connection

And Bluetooth Connection

For mac the port name is

the bluetooth connection

name

6

7 of 8

Bluetooth Port Number

7

8 of 8

TA Checkpoint 2 - Getting data from Bluetooth

  • In your Arduino IDE select any COM port and open the Serial Monitor. You should be able to see your ultrasonic sensor values. If this does not work, select a different COM port and repeat (see slide 17 for finding the right COM port on PC).
  • When the Bluetooth is successfully communicating with your computer, the red LED will stay red constantly without blinking. If the red LED continues to blink then they are not yet connected.
  • Your TA can verify if you are receiving the ultrasonic sensor values on Serial Monitor.
  • Please take a screenshot of your readings on the Serial Monitor and a picture of your setup.

UCLA Physics Department