ProjectJADE

by ProjectJADE in Craft > Printmaking

114 Views, 0 Favorites, 0 Comments

ProjectJADE

IMG_0574.JPG
Period 3: EDD-Halloween

Project JADE, Junior Allergy Defense Enterprise, is a simple 3D-printed machine that consists of a box with electric components and circuits to sort candy based on the allergens the candy contains.

Based on preliminary research, 20% of the population suffers from a food allergy. We found that food allergies often deter people from trick or treating due to deadly allergens that cause severe allergic reactions. 

To solve this problem, we developed Project JADE to make candy distributed on Halloween more accessible and safe for all trick or treaters. The project uses machine learning to determine whether or not candies have peanuts or not; then, a side swiper will direct the candy into the appropriate designated peanut/non-peanut chamber. The trick or treater will then use an interface to indicate whether or not they are allergic to peanuts. Based on the user input, the respective trap door in the storage chamber will open, dispensing candy that is safe for them to consume. 

Supplies

20241105_112412.jpg

Required Supplies(number in parenthesis indicate number components required):

Number of Components not accounted for in the Image

*Not Shown in Image

  1. 3D filament (Polylactic Acid)
  2. Lead-Free solder
  3. Webcam with USB (1)
  4. Arduino Uno (3)
  5. 22-gauge wires (red, black, white)
  6. USB-B (2)
  7. AA batteries (10)
  8. Black Round Rocker On/OFF Switches (2)
  9. VEX Servo Module (2)
  10. VEX Drive Shafts (2 12” shafts)
  11. 12V LED light*
  12. 3-pin 1-meter long RGB LED strip
  13. Assorted VEX screws
  14. Vex Keps Nuts
  15. Wire Nuts*
  16. Hershey's Miniature Assorted Chocolate Candy
  17. Painters Tape
  18. Duct Tape
  19. Hot glue Sticks
  20. Four AA battery casing (2)
  21. Three AA battery casing(1)
  22. Two AA battery casing(1)

Required Tools:

  1. Soldering Iron
  2. Power Drill
  3. 0.152 inch Drill bit 
  4. 0.5 inch Drill bit
  5. Optional 0.7 inch Drill Bit
  6. Screw Driver
  7. Hot Glue Gun
  8. Sandpaper or Filer
  9. 3D printer 
  10. Hammers
  11. 25 mm Star Screwdriver Bit

3D Printing Components

IMG_0493.JPG

To start, 3D print all the linked files. Load the 3D Printer filament (PLA) into the 3D printer and start printing one component at one time. We recommend printing with 15% infill.

The following components require several of them:

Support Structure - 4x

Servo Holder - 3x

Connectors - 6x

**The Image above is just a snapshot of what some of the 3D components will look like**

Assembling the Base Structure and Two Chamber Box

IMG_0510.JPG

A total of four holes will be drilled using the 0.152 inch drill bit in order to connect the Storage Candy Holder and Support Structure. 

  1. Orient the Support Structure in the vertical position.
  2. Drill two holes on the upper half.
  3. Drill another two holes on the lower half.
  4. Align the support structure, Storage Candy Holder, and Candy Dispenser vertically as seen in the picture above.
  5. Then drill holes into both the Storage Candy Holder and Candy Dispenser that closely align with the holes previously drilled on the support structure.
  6. After all holes have been drilled, place screws in all the holes and place keps nut on the other end and tighten.  

*The exact location of screws do not have to match the image due to the DIY aspect of this project.*

Attaching the Building Sorting Mechanism and Detection System

IMG_0495 (1).JPG

This mechanism is for detecting what type of candy is present and directing the candy in the proper box. 

  1. Fit the Candy Sorter Lever Chamber below the final version detection box.
  2. There should be a space between the candy Sorter Lever Chamber and the final version detection box for the candy sorter rotator to fit.
  3. On the arms of the Candy Sorter Lever Chamber sticking up the sides of the detection box, drill two holes through each arm and through the detection box.
  4. Insert screws through the four holes (two on each arm) such that it goes through the arm and into the detection box.
  5. Secure screws inside the detection box with screw nuts.
  6. In the rear of the machine, hot glue connectors to a servo holder (with a VEX servo inside) onto the back of the storage candy holder, with the shaft hole facing upward.
  7. Attach the candy sorter rotator to a VEX drive shaft, and fit the drive shaft securely into the VEX servo.
  8. Align candy sorter rotator such that it fits into the space between the detection box and the lever chamber.

Installing the Trap Doors

0527V2.PNG

The trap doors will keep the candy into the two distinct chambers before dispensing to the Trick or Treater.

  1. Orient the Storage Candy Holder with the Detection Box with the trick or treat tray pointing to the left.
  2. In the upper left hand corner, use the 0.5 inch drill bit to drill a hole through both the outer wall along with the inner wall.
  3. Re-orient the Storage Candy Holder with the Detection Box with the trick or treat tray pointing to the right.
  4. About 0.25 inches below the center of the last hole drill, use the 0.5 inch drill bit to drill through both the outer wall and inner wall. 
  5. Insert the Axle through the trap door and connect the axle to the servo output.
  6. Repeat for both sides.
  7. Refer to the image.

Bringing All Mechanical Components Together

Finish up combining the mechanical components of Project JADE.

  1. Vertically align the Detection box with the protruding support structure of the candy storage container.
  2. Orient two Support Structures vertically and insert in between the detection box and protruding support structure.
  3. Using the 0.152 inch drill bit, drill two holes on the upper portion of the support structure.
  4. Place two screws in each hole and use a keps nut for each screw to hold the structures in place.
  5. Once again use the 0.152 inch drill bit to drill a hole in approximately the center of the protruding structure that results in a long hole through the protruding Support Structure and halfway through the detection box. 
  6. Screw in a screw to secure the components together. (A keps nut is not required due to the friction and tightness of the 3D components.)
  7. Repeat these steps for the other side of the detection box.
  8. Using either the 0.5 or 0.75 inch drill bit, drill approximately four holes around the detection box that will later be used for wire management.. 
  9. Place Servo in Servo Holders.
  10. Using hot glue to attach the connectors to the sides of the servo and then hot glue them onto the box in the proper position as shown in the picture.

Establishing Electrical Connections

For the electrical connections, please note that there are multiple ways to connect the components together including soldering, wire nuts, or jumper wires. The project shown combines both wire nuts and soldering for electrical connections. 

12V light

  1. Connect the two Four AA battery casings in series by attaching the red wire of one casing to the black wire of another casing.
  2. Attach the unconnected red wire to one prong of the Black Round Rocker On/OFF Switch.
  3. Using 22 gauge wire, attach one end to the other prong of the switch and the other end to the positive terminal of the 12V light. Best to use red wire in this scenario to illustrate positivity of the wire. 
  4. Connect the black wire of the battery casing to the negative terminal of the 12V battery.

LED String Light

  1. Connect the three AA battery casings with the two AA battery casing to create a series circuit by attaching the red wire of one casing to the black wire of another casing.
  2. Attach the unconnected red wire to one prong of the Black Round Rocker On/OFF Switch.
  3. Using 22 gauge wire, attach one end to the other prong of the switch and the other end can be inserted into the Arduino VIn. Once again, it’s best to use red wire in this scenario to illustrate positivity of the wire. 
  4. The black wire of the battery casing can be connected to any of the Ardunio’s ground ports.
  5. Connect three different 22 gauge wires to the three inputs of the LED string light.
  6. The wire connected to the 5V input will be plugged into the Arduino’s 5V port.
  7. The ground wire will be connected to a Ardunio ground port.
  8. Lastly the signal/comm wire will be connected to Arduino Port 6.

Servo Motor Connections- Trap Doors

  1. Place a new Arduino into the electronic storage container.
  2. Connect the white wire of the Vex Servo Motor through the pre-drilled holes (for wire management) to connect to digital pin 9 (peanut chamber).
  3. Connect the Orange prong of the Servo Motor through the pre-drilled hole to digital pin 9. 
  4. Lastly connect the black prong to the Arduino Ground port.
  5. Repeat these steps but instead connect the orange to digital pin 10 (non-peanut chamber).

Side Swiper Connection

  1. Place a new Arduino into the electronic storage container.
  2. Connect the white wire of the Vex Servo Motor through the pre-drilled holes (for wire management) to connect to the Arduino port 9.
  3. Connect the Orange prong of the Servo Motor through the pre-drill hole to the 5V pin.
  4. Lastly connect the black prong to the Arduino Ground pin.

Place All Electrical Components Within Storage Box

If there are any other electrical components left outside of the designated electrical component section of the detection box, please ensure that all the electrical components are located in the box.

  1. Use the previously drilled holes as ports for wires that extend and connect to components outside of the box. 
  2. Ensure to allot two holes for the Black Round Rocker On/Off switches, so they are easily accessible for turning on and off. 
  3. If the hole is too large around the Black Round Rocker On/Off switch, use hot glue to secure the switch.
  4. Install the Box Cover by using any form of tape to secure it to the detection box.
  5. Use a hot glue gun to glue down the Screw Ramp as shown in the picture on top of the detection box.
  6. Use hot glue again to glue down the screw ramp cover as seen in the picture.

Adding Computer Science Functionality

TeachableMachineArduinoPythonCodeImage.png

If there are any other electrical components left outside of the designated electrical component section of the detection box, please ensure that all the electrical components are located in the box.

  1. Use the previously drilled holes as ports for wires that extend and connect to components outside of the box. 
  2. Ensure to allot two holes for the Black Round Rocker On/Off switches, so they are easily accessible for turning on and off. 
  3. If the hole is too large around the Black Round Rocker On/Off switch, use hot glue to secure the switch.
  4. Install the Box Cover by using any form of tape to secure it to the detection box.
  5. Use a hot glue gun to glue down the Screw Ramp as shown in the picture on top of the detection box.
  6. Use hot glue again to glue down the screw ramp cover as seen in the picture. 


Step 6: Adding Computer Science Functionality

Please note that depending on the code editor you choose to use, you may have different buttons but these are a general guideline of how to set up our code. Many tutorials exist if you have problems with any step of this process as well! All files and folders that are referenced below can be found here: https://drive.google.com/drive/folders/172VY93GHf3B3EaNAtRmF2v18U7Hs7pxB?usp=sharing

Neural Network Customization

  1. If you are editing the Neural Network, read this. If not, you can skip this portion. Go to https://teachablemachine.withgoogle.com/train/image.
  2. Edit the class names to “Peanut” and “Non-Peanut”. Add another class and name it “Nothing”.
  3. Go to “Peanut” and hit the “Webcam” option and use the dropdown to select the USB-camera.
  4. Begin collecting images when the peanut candy is in frame.
  5. Try to collect at least 300 images with 15 images per candy as you drop them allowing the Neural Network to view the candy from different angles. Repeat this for non-peanut candies in the Non-Peanut class.
  6. For the Nothing class, have the camera record when no candy is in the chamber. Once complete, hit “Train Model” and wait for it to finish.
  7. Finally, click on “Export Model” and select “Tensorflow” and not Tensorflow.js and Tensorflow Lite. Make sure the “Keras” option is selected then select “Download my model”.
  8. Place the “converted_keras” that is generated into a folder called “keras” that should hold all of the scripts that are mentioned below.

Running Computer Vision on Arduino

  1. Plug in the camera USB and Arduino for the candy sorter rotator USB-B into your computer. 
  2. Feed the cable through a hole in the detection box so that the Arduino and camera can be left inside the detection box.
  3. Download the “keras” folder. There should be TeachableMachineArduino.py, labels.txt, and keras_model.h5 inside it. Then, download move_Servo.ino and keep it outside the folder.
  4. Open the Arduino IDE or download it if you don’t have it.
  5. Navigate to the “Tools” tab in the upper left corner. Look for “Port” and make sure that you can see the Arduino Uno you are using and that the COM is correct. The “Board” option above it should have “Arduino/Genuino Uno” to ensure you are using the correct Arduino. Once confirmed, run the code by hitting the “Upload” button.
  6. Open the TeachableMachineArduino.py file. Make sure the “COM” in the file matches the one in the Arduino file. Run this by hitting the “Run” button atop the IDE of your choice.

Creating the Website

  1. Download IntelliJ through this link: https://www.jetbrains.com/idea/.
  2. Next, open the Spring Initializr website: https://start.spring.io/.
  3. Select “Maven” for Project and “Java” for Language. Choose the latest Spring Boot Version for stability. On the Project Metadata, use “candy-dispenser” for Artifact and “CandyDispenser” for Name. Select “Jar” for Packaging and the latest Java Version compatible with your setup. Under Dependencies, add “Spring Web” and “Spring Boot DevTools”. Generate and extract the .zip file to your computer.
  4. On IntelliJ IDEA, open the .zip file and wait for the Spring Boot project to sync dependencies. There will be a total of 3 Java files and a HTML file.
  5. In the Project view, navigate to “src/main/java”, create a new Java class and name it “CandyDispenserController.java”. This file will connect the API request for dispensing candy from the frontend HTML to the backend.
  6. Paste the code for your CandyDispenserController class.
  7. Create another Java class and title it “ArduinoCommunicator.java”. This class will send input to the Arduino for opening the trap doors.
  8. Paste the AdruinoCommunicator code into this class. The “CandyDispenserApplication.java” file will be created automatically when you open a new Spring Boot Project, but if it does not appear, make the new Java file and paste the code.
  9. Create your HTML file in “src/main/resources/static” and name it “index.html”. This file will be the main user interface website. 

Running Trapdoors

  1. Download Arduino IDE using this link: https://www.arduino.cc/en/software/.
  2. Open a new sketch named “Trap Door Motors” and paste the provided code.
  3. Connect your Arduino board to your computer via USB and choose the port to which it is connected.
  4. Click on the upload button on the top left and wait till it is done compiling.
  5. Open the Serial Monitor and set the baud rate to 9600.
  6. Go back to the IntelliJ files and make sure that the name of the port in your serial communication matches the actual port to which your Arduino is connected. 
  7. To test the application, right click on the “CandyDispenserApplication,java” class and choose “Run”.
  8. Go to your local browser (ex. chrome) and paste this url: http://localhost:8080 to showcase your HTML webpage.
  9. Click on the buttons and it should trigger a response to the Arduino to open the designated trapdoors.

Final Assembly and Test

OneCandyDetectionBox.png

Use the Black Round Rocker On/Off Switch to turn on the 12V LED light and the LED string light. Start by placing candy one by one down the ramp to start sorting. Please wait until the candy finishes sorting before placing the next piece of candy.

Decorate As You Desire!

IMG_0552.JPG

Once the project is completed and everything works as you wish, feel free to decorate the project as you wish. Add a Halloween spin with spooky ghosts, flying bats, or jack o’ lanterns. The options for creativity are endless!

If you have any question, please reach out!

(626)-491-8728