Ultrasonic-Triggered Relay Setup

Job ID: 39913918

Budget: $10 – $30 USD

I already have the hardware—an Elegoo UNO R3, an RCWL-1655 weather-proof ultrasonic module (HC-SR041 form factor), and a HiLetgo relay board. I need a lean, no-frills Arduino sketch and wiring guide that will:

• Watch the ultrasonic sensor and, when anything moves to roughly 3-5 feet (≈90-150 cm), flip the relay ON once so it can fire an external device.
• Keep the relay latched only until the object leaves the range, then reset so it’s ready to trigger again on the next approach. No repeated chatter while the object stays in place.
• Let me tweak the distance threshold quickly in code if I ever need to.

Please include:

1. Pin-by-pin wiring diagram or clear photo/mock-up.
2. The .ino file with concise comments.
3. A short note on any libraries you use (stick to standard Arduino libs if possible).
4. Basic troubleshooting tips so I can verify sensor readings and relay state with Serial Monitor or an LED before going live.

The goal is a plug-and-play proof-of-concept I can upload, power up, and see working in minutes.