As a university student who will be living on grounds for the first time next semester, I'm not too worried about theft. However, I did just watch Home Alone which inspired me to revisit an old project and start over using the lessons I learned from my previous iteration to build a better designed and functioning sentry turret from the ground up. If that project also happens to be a dorm crime deterrent, that's just an extra benefit.

What it does

When the ultrasonic sensor detects something within range it triggers a laser pointer, a relay that turns on the gun's flywheels, and a 3D printed linear actuator that pulls the gun's trigger.

How I built it

I designed and 3D printed some brackets and mounted the gun to a piece of plywood. I also 3D printed a linear actuator then assembled, wired, and programmed everything.

Challenges I ran into

I learned some valuable lessons related to electrical engineering when I fried my Arduino Uno after connecting external power to the Arduinos power and ground by accident. I had to start over and redo parts of the wiring and code to work with a spare esp32 board I had. This delay meant I didn't have a chance to test the linear actuator as well as I would have liked. While all the components worked as I programmed them to, the servo inside the linear actuator ended up not having enough power to pull the trigger.

What I'm proud of

The aesthetics of this project turned out better than I hoped. The 3D printed components made everything look neat as opposed to using various bits of scrap wood, hot glue, and zip ties that I used for mounting in my previous iteration because it was a last-minute build for an event. My code performed exactly as intended. At the end of the day, I did this project to learn. My design, wiring, and code was functional and performed as I expected them to. If I had a stronger servo I'm confident the trigger pulling mechanism would have worked perfectly and I could have declared this project an outstanding success. For now though, until I either replace the servo or redesign the trigger pulling mechanism I'll settle for reflecting on what I have learned and just chalking this one up as a success with room for improvement. After all, waving my hand in front of the ultrasonic sensor and seeing a laser turn on, a relay switch on, and a servo pulsate was cool, even if that servo wasn't able to pull a trigger.

What I learned

I discovered and learned how to use relays! This is something I am very excited about because I didn't even know they existed until I began this project. I also learned how to program ultrasonic sensors, relays, lasers, and servos.

What's next for Sentry Gun

Redesign of trigger pulling mechanism & internet connectivity/control via a mobile app.

Built With

  • c++
  • esp32
  • laser
  • relay
  • ultrasonic-sensor
Share this project: