This project demonstrates the interfacing of US-100 Ultrasonic sensor interface with PSOC4 BLE to get the distance measured in centimeters
This project demonstrates the interfacing of US-100 Ultrasonic sensor with PSOC4 BLE to get the distance measured in centimeters using UART interface.
PSoC4 BLE sends trigger pulses via US-100 to send ultrasonic waves which get reflected back and received by PSoC4 BLE as Echo pulses. The time in between these pulses Echo and trigger pulse is measured by PSOC4 BLE and then distance is calculated by the time interval measured.
- Design Tool: PSoC Creator™ 4.0 Update 1
- Programming Language: C
- Associated Devices: CY8C4247LQI-BL483
- Required Hardware: CY8CKIT-042 BLE kit,US-100 Ultrasonic Sensor Module
1. Remove the Jumper on US-100 Ultrasonic Sensor "UART Select" to have module in Pulse width mode
2. Connect the Trig signal on US-100 to Port pin P on CY8CKIT-042 BLE via jumper wires
3. Connect the Echo signal on US-100 to Port pin P on CY8CKIT-042 BLE via jumper wires
4. Connect the VCC on US-100 to 5V pin on CY8CKIT-042 BLE via jumper wires
5. Connect the GND on US-100 to GND pin on CY8CKIT-042 BLE via jumper wires
The PSOC4 BLE initiates a measurement by driving the US-100 trigger input to logic HIGH for 10us using SignalTrig port as digital output.
The US-100 in response, will send a short bursts of ultrasonic sound wave, and then outputs a pulse as soon as a returning echo is detected.
The PSoc4BLE uses the Timer component to measure the pulse width of the Echo input pulse from US-100 module.
Then the Pulse width (which is in microsecond )measured is converted to distance using
Distance in Centimeters = (PulseWidth * 34 / 1000) / 2
Then,this value is send via UART.
Distances up to 3.5 meters from the sensor can be measured.
1. Program the CY8CKIT-042 BLE with the project on PSoC Creator.
2. Open any serial terminal software (Cool Term software is used here)
3. After selecting appropriate COM port (For example COM8 in Figure 1), set the Baud rate to 9600, Parity = none, Stop bit = 1, as shown in Figure 1.
4. Upon receiving the Echo signal from the US-100 Sensor, PSOC4200 BLE writes the Distance measured by measuring the pulse width This data is available as Hex value represents the distance in centimeters.
You can observe the data on the UART serial terminal software like Coolterm, as shown in Figure 2.
US-100 Ultrasonic Sensor Interface with PSOC4BLE PSoC Creator projectC/C++
No preview (download only).
Did you replicate this project? Share it!I made one
Love this project? Think it could be improved? Tell us what you think!