A parking sensor built using NodeMcu and HC-SR04 Ultrasonic Distance Sensor
The project calculates the distance by measuring the echo duration from the HC-SR04 sensor. Based on the calculated distance, the following actions are triggered:
Distance < 10 cm:
The red LED lights up. The buzzer sounds. Distance 10-30 cm:
The yellow LED lights up. The buzzer remains off. Distance > 30 cm:
The green LED lights up. The buzzer remains off. The code also displays the distance on the Serial Monitor once every second.
Also you can see the distance in website.
Components Used
- ESP8266 or any compatible microcontroller with WIFI modüle
- HC-SR04 Ultrasonic Sensor
- LEDs (Red, Yellow, Green)
- Buzzer
- Resistors
- Jumper wires
- Breadboard
How to Use
- Set up the hardware according to the circuit diagram above.
- Open the code file in Arduino IDE and select the correct board (e.g., NodeMCU 1.0) and port.
- Upload the code. Once done, observe the distance readings on the Serial Monitor and test the LEDs/buzzer based on different distances. Contribution
If you'd like to improve this project or add new features, feel free to submit a pull request or open an issue to share your suggestions.
License
This project is licensed under the MIT License. See the LICENSE file for more details.