Flytrap Robot
This device is a flytrap, which shuts when an object comes between the two clamshell halves of the trap. The ultrasonic sensor, which is located directly below the trap, will detect when an object comes within 10 cm away from it, and will send this information to the Arduino via the trigger and echo pins, and some code that converts the time delay into distance. When something comes within that set threshold distance, the servo motors will change angle from 0 degrees, which they were initialized to, to 180 degrees. They are mechanically set up across from each other so that they will rotate 180 degrees in opposite directions and the two halves will come together to close the trap. Whenever the flytrap is shutting, the light will also switch from green to red, indicating that something has been detected and that the trap is closing, ideally so that a person could get their finger out of the way or so that they can see the color red in their peripheral vision and know that something is being trapped. The device will then wait for 10 seconds and then open back up again, and the light turns back to green. The cycle begins again.
The SolidWorks file attached is what needs to be 3d printed.
Downloads
Supplies
Arduino Uno, Breadboard, Mini breadboard, Assorted wires, Micro servo positional, Ultrasonic sensor, 3D printed flytrap shells, Cardboard, Popsicle sticks, 220 Ω Resistor, Red LED, Green LED, Power supply, 3-wire connector
Circuitry
Build the circuit following the circuit diagram and/or the tinkercad linked here.
The Arduino code is also attached, or can be found from the code section of the tinkercad link.
Downloads
Mechanical Structure
Once the circuit is set up, assemble a cardboard box-like structure to house the circuit components, referring to the CAD screenshots. Feed the wall power supply cable through the cut-outs in the box. Place the circuit components inside the box, then go about assembling the top.
The top components should be assembled with reference to the sketched diagrams. The middle piece, with slits in it, is also where the ultrasonic sensor rests. Make sure this piece lays flat along the top of the box you have constructed.
For the popsicle stick, motor and clamshell assembly, make sure you run the code on the circuit a few times so that you know which direction your motor spins, and which positions are 0 and 180 degrees (open and closed positions, respectively). Press the flytrap onto the gear of the motor so that it will rotate either clockwise or counter-clockwise. Make sure the two trap halves rotate in opposite directions, and that they face each other when in the closed position. Tape the motors to the tops of the popsicle sticks.
The overall setup should look like the CAD. Glue/tape pieces in place as needed. For the top right piece, tape it to the top of the box to close it off, but make sure you feed the motor wires and sensor wires in through the notches, so that they end up inside the box with the rest of the wires and circuit components. The top left piece should be “hinged,” so only tape its right edge to the left edge of the slitted piece. This will allow for easy access to the circuit components if they need to be fixed or if wires get loose. Make sure the cutout on that piece aligns with the LEDs below it, so that the color is visible to observers.