This project demonstrates the interfacing of US-100 Ultrasonic sensor interface with PSOC4 BLE to get the distance measured in centimeters
OverviewThis 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.
Requirements- 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
- Remove the Jumper on US-100 Ultrasonic Sensor "UART Select" to have module in Pulse width mode
- Connect the Trig signal on US-100 to Port pin P on CY8CKIT-042 BLE via jumper wires
- Connect the Echo signal on US-100 to Port pin P on CY8CKIT-042 BLE via jumper wires
- Connect the VCC on US-100 to 5V pin on CY8CKIT-042 BLE via jumper wires
- 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.
Testing- Program the CY8CKIT-042 BLE with the project on PSoC Creator.
- Open any serial terminal software (Cool Term software is used here)
- 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.
- 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.
Comments