Difference between revisions of "ECE434 Project - Water Gun Sentry Turret"

From eLinux.org
Jump to: navigation, search
(Executive Summary)
m
 
(14 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Category:ECE497 |PI]]
 
 
[[Category:ECE434Fall2022 |PI]]
 
[[Category:ECE434Fall2022 |PI]]
 
{{YoderHead}}
 
{{YoderHead}}
Line 30: Line 29:
  
 
== Executive Summary ==
 
== Executive Summary ==
PICTURE HERE
 
  
 +
[[File:Project Picture2.jpeg|thumb|Water Gun Sentry Turret]]
 
Introduction:
 
Introduction:
 
<br>
 
<br>
Line 53: Line 52:
  
 
== Packaging ==
 
== Packaging ==
If you have hardware, consider [http://cpprojects.blogspot.com/2013/07/small-build-big-execuition.html Small Build, Big Execuition] for ideas on the final packaging.
+
 
 +
For our packaging we needed to use something that would protect the circuitry from water, since the components needed to work close to a water pump and nozzle. We chose a plastic container that could fit all of the peripherals and the BeagleBone inside it and also protect from possible water exposure. To allow for the power cords to be plugged into a wall, we drilled a small hole into the container towards the bottom on its side. Additionally, we had a square structure mounted on top of the plastic enclosure that held the servo motor, water nozzle end, and the camera on top of it secured with duct tape.
 +
<br>
 +
 
 +
Here you can see images of the container and its contents:
 +
<br>
 +
 
 +
[[File:circuit1.jpg|300px|Inside our project]]    [[File:lid.jpg|200px|Stepper motor and servo motor connection]]    [[File:topview.jpg|300px|Project Top View]]
  
 
== Installation Instructions ==
 
== Installation Instructions ==
  
Give step by step instructions on how to install your project.
+
For further instructions on how the code works and how to setup your environment, visit our [https://github.com/DavidPurdy1/BeagleBoneWaterTurret github] <br>
  
* Include your [https://github.com/ github] path as a link like this to the read-only git site: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn].
+
Here are some instructions for how we set up the BeagleBone AI-64:
* Be sure your README.md is includes an up-to-date and clear description of your project so that someone who comes across you git repository can quickly learn what you did and how they can reproduce it.
+
<br>
* Include a Makefile for your code if using C.
+
* Install a graphical OS (makes it easier to debug later, We installed the Bullseye XFCE (with graphical desktop) for BeagleBone AI-64)
* Include any additional packages installed via '''apt'''.  Include '''install.sh''' and '''setup.sh''' files.
+
* Once flashed on, to get the display port working you are going to want an ACTIVE micro display port adapter. Trust me there is a difference, the active ones have a thick block
* Include kernel mods.
+
* Once you get this and boot you should see a desktop boot up on the display.
* If there is extra hardware needed, include links to where it can be obtained.
+
* To get internet we setup the WIFI dongle and used this for downloading everything. We used instructions for setting up the WIFI drivers on the bone from the eLinux wiki page.
 +
 
 +
After setting up our BeagleBone AI64, we set up our various peripherals using the code found in the peripherals_test directory in our repository. Using those as a guide, you can set up the hardware and then run the main script and then the project should work!
 +
<br>
 +
 
 +
Additional Hardware Needed:
 +
* [https://www.azurefilm.com/en/creality-42-34-stepper-motor-for-cr-series/ender-series Stepper Motor] <br>
 +
* [https://www.hobbypartz.com/33p-solarservo-a102.html Servo]
  
 
== User Instructions ==
 
== User Instructions ==
  
Once everything is installed, how do you use the program?  Give details here, so if you have a long user manual, link to it here.
+
Once everything is installed, to use the project all you have to do is ssh into the bone and run detect_open_mouth.py, the main python script. To stop the script you press q on your keyboard and that's it! These two steps allow you to start and run the project. See our [https://github.com/DavidPurdy1/BeagleBoneWaterTurret gitrepo] for the code and additional help.
 
 
Consider making it autostart for full credit.
 
  
 
== Highlights ==
 
== Highlights ==
  
Here is where you brag about what your project can do.
+
To see our project in action, check out our [https://youtu.be/36nt8Skgai4 demo] on YouTube!
 
 
Include a [http://www.youtube.com/ YouTube] demo the audio description.
 
  
 
== Theory of Operation ==
 
== Theory of Operation ==
  
Give a high level overview of the structure of your software. Are you using GStreamer?  Show a diagram of the pipeline.  Are you running multiple tasks?  Show what they do and how they interact.
+
Our software is modular and there are contains several functions which handle different aspects of the project.
 +
* We first initialize the web cam and start reading the video stream
 +
* We use our machine learning script to detect when the camera sees an open mouth
 +
* We set up the PWM for the servo
 +
* We move the platform using the stepper motor a small increment every iteration of the loop, scanning for an open mouth
 +
* When an open mouth is detected we calculate the mouth's center and send the data to the servo angle calculation function
 +
* The angle needed to shoot the water into the mouth is calculated and sent to the servo
 +
* There are conditionals which decide if the mouth is within range and if the water gun should shoot
 +
* If the conditionals result in true, indicating the mouth is within range, the relay is sent a signal to fire up the water pump
 +
* The system waits 5 seconds for the water pump to finish shooting the water and then it goes back to the beginning of the loop, looking for an open mouth again
  
 
== Work Breakdown ==
 
== Work Breakdown ==
  
List the major tasks in your project and who did what.
+
Here are the major tasks we completed for our project. We both sat down and worked on these together. <br>
 +
* Setup BeagleBone AI-64
 +
* Get webcam to work and read its videostream using python
 +
* Get stepper motor to work with the BeagleBone and write python code to interface with it
 +
* Get servo to work, write python code to interface with it
 +
* Implement the relay, test with led first before adding water
 +
* Create housing for the project, drill holes into the enclosure
 +
* Setup remote ssh into bone so the script can be run remotely
 +
* Test system with water and tweak as needed
  
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.
+
We were able to successfully complete all of these tasks.
  
 
== Future Work ==
 
== Future Work ==
  
Suggest addition things that could be done with this project.
+
Some things we could do in the future with this project include making the main python script for the water gun run on the bone's startup, so that you do not have to ssh into it to get it started, making the project easier to use. Additionally, we would improve the wiring and circuitry for our stepper motor so that the platform can turn a wider range of angles so the field of view is not as limited.
  
 
== Conclusions ==
 
== Conclusions ==
  
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.
+
In conclusion, our project is able to function correctly in aiming at a person's mouth and shooting water. As mentioned above, some improvements we could make involve using systemd to make the script start automatically as well as improving stepper motor performance. Futhermore, we accomplished all the tasks that we set for ourselves and our project successfully demonstrated what we wanted it to.
  
 
{{YoderFoot}}
 
{{YoderFoot}}

Latest revision as of 14:18, 27 November 2023

thumb‎ Embedded Linux Class by Mark A. Yoder


Team members: Sophia Harrison and David Purdy

Grading Template

I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!

Add Extras

09 Executive Summary
09 Packaging
09 Installation Instructions 
09 User Instructions
09 Highlights
09 Theory of Operation
09 Work Breakdown
09 Future Work/Conclusions
09 Hackster.io
09 Demo/Poster
00 Not Late

Score:  100/100

Executive Summary

Water Gun Sentry Turret

Introduction:
For our project, we created a water gun sentry turret. This project consists of several components including the BeagleBone AI-64 (BBAI64), a stepper motor and driver, a servo motor, a water pump, and a relay to fire the water pump. In addition, this project runs a Machine Learning program on the BeagleBone AI-64 to detect if a face is in view of the connected webcam and if the face's mouth is open. When the camera detects an open mouth, the centroid of the mouth is calculated and the servo adjusts the water gun's angle in order to shoot water into the mouth. The water shot is pumped from a water reservoir using the water pump which activates soon after the mouth is detected to be open.

What Worked:
What we got to work for our project was majority of the components we set out to implement. We successfully connected and video streamed a webcam with the BBAi64 and we were able to implement the servo motor, relay, water pump, and wifi to connect wirelessly. Our stepper motor was implemented but the rotations it produced were very small.

What Didn't Work:
We ran into some difficulty when trying to use the BBAI64 as it worked much differently compared to the BeagleBone Black used throughout the class. We were not able to use a lot of python packages and using gpios was different and it took us a minute to figure out how to do so. Additionally, for our project the stepper motor would only rotate very slightly and thus wasn't able to rotate the platform as much as we would like. One possible source to this issue we suspected was insufficient power to our stepper motor and driver.

Conclusion:
In conclusion, we were able to create a water gun sentry turret which can detect when a person's mouth is open, aim the water nozzle, and gently shoot water into a persons mouth. While our stepper motor underperformed somewhat, the project still proved to be functional.

Packaging

For our packaging we needed to use something that would protect the circuitry from water, since the components needed to work close to a water pump and nozzle. We chose a plastic container that could fit all of the peripherals and the BeagleBone inside it and also protect from possible water exposure. To allow for the power cords to be plugged into a wall, we drilled a small hole into the container towards the bottom on its side. Additionally, we had a square structure mounted on top of the plastic enclosure that held the servo motor, water nozzle end, and the camera on top of it secured with duct tape.

Here you can see images of the container and its contents:

Inside our project Stepper motor and servo motor connection Project Top View

Installation Instructions

For further instructions on how the code works and how to setup your environment, visit our github

Here are some instructions for how we set up the BeagleBone AI-64:

  • Install a graphical OS (makes it easier to debug later, We installed the Bullseye XFCE (with graphical desktop) for BeagleBone AI-64)
  • Once flashed on, to get the display port working you are going to want an ACTIVE micro display port adapter. Trust me there is a difference, the active ones have a thick block
  • Once you get this and boot you should see a desktop boot up on the display.
  • To get internet we setup the WIFI dongle and used this for downloading everything. We used instructions for setting up the WIFI drivers on the bone from the eLinux wiki page.

After setting up our BeagleBone AI64, we set up our various peripherals using the code found in the peripherals_test directory in our repository. Using those as a guide, you can set up the hardware and then run the main script and then the project should work!

Additional Hardware Needed:

User Instructions

Once everything is installed, to use the project all you have to do is ssh into the bone and run detect_open_mouth.py, the main python script. To stop the script you press q on your keyboard and that's it! These two steps allow you to start and run the project. See our gitrepo for the code and additional help.

Highlights

To see our project in action, check out our demo on YouTube!

Theory of Operation

Our software is modular and there are contains several functions which handle different aspects of the project.

  • We first initialize the web cam and start reading the video stream
  • We use our machine learning script to detect when the camera sees an open mouth
  • We set up the PWM for the servo
  • We move the platform using the stepper motor a small increment every iteration of the loop, scanning for an open mouth
  • When an open mouth is detected we calculate the mouth's center and send the data to the servo angle calculation function
  • The angle needed to shoot the water into the mouth is calculated and sent to the servo
  • There are conditionals which decide if the mouth is within range and if the water gun should shoot
  • If the conditionals result in true, indicating the mouth is within range, the relay is sent a signal to fire up the water pump
  • The system waits 5 seconds for the water pump to finish shooting the water and then it goes back to the beginning of the loop, looking for an open mouth again

Work Breakdown

Here are the major tasks we completed for our project. We both sat down and worked on these together.

  • Setup BeagleBone AI-64
  • Get webcam to work and read its videostream using python
  • Get stepper motor to work with the BeagleBone and write python code to interface with it
  • Get servo to work, write python code to interface with it
  • Implement the relay, test with led first before adding water
  • Create housing for the project, drill holes into the enclosure
  • Setup remote ssh into bone so the script can be run remotely
  • Test system with water and tweak as needed

We were able to successfully complete all of these tasks.

Future Work

Some things we could do in the future with this project include making the main python script for the water gun run on the bone's startup, so that you do not have to ssh into it to get it started, making the project easier to use. Additionally, we would improve the wiring and circuitry for our stepper motor so that the platform can turn a wider range of angles so the field of view is not as limited.

Conclusions

In conclusion, our project is able to function correctly in aiming at a person's mouth and shooting water. As mentioned above, some improvements we could make involve using systemd to make the script start automatically as well as improving stepper motor performance. Futhermore, we accomplished all the tasks that we set for ourselves and our project successfully demonstrated what we wanted it to.




thumb‎ Embedded Linux Class by Mark A. Yoder