Venus Flytrap - ITM Fall 2019

Introduction: Venus Flytrap - ITM Fall 2019

What's missing from everyone's desk? A mechanical Venus Flytrap that holds pencils, pens, and other objects.

Step 1: Parts

You will need:

* 3D Printer (see .stl file) for the pot

* Wooden sticks and drill

* Soldering tools

* Arduino Uno & IDE

* Breadboard

* Photoresistor

* Switch

* MicroServo Sg90

* Foamcore

* Electric & Silicone tape

* Wires

* Hinges

* Hot glue

Step 2: Make the Circuit & Write Arduino Code

The circuit connects the photoresistor, switch, Servo, and power mechanism via the Arduino. We connect the Servo to its pwm duty cycle on pin on of the Arduino, read the photoresistor from analog pin A0, and read the button from digital pin 2.

The simple breadboard in the photo works, though we ultimately soldered the wires to a permanent breadboard for stability.

The Arduino code is meant to do primarily three things:

1. Read a photoresistor and compare the reading to a pre-set threshold. When the photoresistor reads low (dark), the reading will be below the threshold, and when the reading is high (light) it will be above the threshold.

2. Based on the photoresistor reading, tell the Servo to move to one of two positions (an "open" and "closed" position, noted as val and val2 in code). When there is nothing obscuring the photoresistor, the reading will be high, and the Servo is in the open position. When there is an object obscuring the photoresisitor, the reading will be low, and the Servo moves to the closed position.

3. Program a switch to automatically move the Servo to the open position. This is essentially a failsafe.

See code below:

#include <Servo.h>
Servo myservo; int val=20; //initialize closed position value int val2=70; //initialize open position value void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); //initialize servo and attach its pwm duty cycle to pin 9 myservo.attach(9); pinMode(2, INPUT); //initialize switch as an input } const int threshold = 20; //initialize photoresistor threshold for closing int buttonState = 0; //initialize variable to read switch state int sensorValue = 100; //initialize variable for photoresistor value int stayclosed=0; //initialize variable to maintain a position once activated //// the loop routine runs over and over again forever: void loop() { // read the input from the switch: buttonState = digitalRead(2); //read the input from the photoresistor sensorValue = analogRead(A0); // print out the photoresistor reading to the serial monitor: Serial.println(sensorValue); if (buttonState == LOW) { //switch is off if (stayclosed==1){//if position stability variable is on, ; //stay in current position } else if (sensorValue < threshold) { //if sensorvalue falls below the threshold, myservo.write(val); //change trap to the closed position, stayclosed=1; //and change stability variable to remain closed } } else { //switch is on if (stayclosed==0){ //if position stability variable is off, ; //stay in current position } else{ //first time sensing the switch is on delay(500); //Delay 500 ms and check to make sure switch is still on buttonState=digitalRead(2); //read the input from the swithch if (buttonState==HIGH){ //if switch is on, myservo.write(val2); //change trap to the open position stayclosed=0; //and change stability variable to remain open } } } }

Step 3: Print the Pot & Cut the Trunk and Branches

CAD: Printing Flower Pot

* Use the STL file included above to 3D print the flower pot, which serves as the base for the venus fly trap device

* Ensure the flower pot dimensions are sufficiently large to ensure the base can house the Arduino and breadboard

Wood work: Trunk and Branches

* Use band saw to cut a 1 by 24 inch wooden dowel to length of 12 inches for the trunk

* Use hand drill to make three ½ inch holes at various heights on the trunk, where the branches are to be inserted. The holes should be drilled at approximately a 45° angle, so that branches can be inserted at angle.

* Use band saw to cut ½ by 12 inch wooden dowels into three branches of varying lengths, as desired. Using the band saw cut one end of each branch at a 45° to create a flat surface upon which the traps can be set.

* Insert branches in the holes of the trunk (with angled ends exposed) and secure with gorilla glue or hot glue

Step 4: Create the Traps

Steps for trap creation:

* Take the foam core and cut out two pieces to act as the top and bottom clamps of the trap (shape may be whatever you wish, as long as the base of the clamp is rectangular in order to attach the motor)

* Hollow out the two foam core clamps at the base. Only hollow out enough of the clamps so that the hinges can fit snuggly inside.

* Insert the two faces of the hinges into their respective clamps.

* Wrap clamps in colorful tape for aesthetics.

* Punch a small hole in the bottom clamp and insert the photoresistor (it should fit snuggly)

* Lay two small pieces of silicon tape on the inside of each clamp to ensure items being trapped can’t escape easily

* Attach motor to the side of the rectangular base of the top clamp with superglue and tape (Trap Mechanism is completed at this point)

* Attach the trap mechanism to a branch, making sure both the bottom clamp and the body of the servo motor is fixed (leaving the arm of the motor and the top clamp free to move.

Step 5: Putting It All Together

* Place the trunk and branches inside the pot, and glued the Arduino UNO and breadboard also inside the pot

* Stabilize the trunk with rocks, careful not to break any wires

* Use green electric tape to cover the branch, trunk, and all exposed wires

* Use an external battery as a power source

* Happy Venus Flytrapping!

Be the First to Share


    • Rice & Grains Challenge

      Rice & Grains Challenge
    • Lamps Challenge

      Lamps Challenge
    • Puzzles Challenge

      Puzzles Challenge



    2 years ago

    Cool, I love this idea!