Introduction: Mechanical Flower (using Arduino)

Hi,

for a school project we (a team of 3 Interaction Design students) created a mechanical flower that opens up when someone comes close to a motion sensor. When the sensor doesn't detect any motion, it closes.

What do you need:

  • arduino (funduino) uno and breadboard + cables
  • motion sensor
  • servo
  • 3D printed spool
  • lasercut parts for the flower
  • 3mm multiplex woord
  • paper
  • glue
  • fishing wire
  • a strong wire/cord
  • a rock or any other weight
  • a tree

Created by Aagje Reynders, Arthur Coppens and Cathy Borgions

Step 1: Lasercut the Leaves and Wooden Construction

We used a lasercutting machine to cut out the leaves in paper, for this flower 5 leaves are necessary. For the rest of the construction we used 3mm multiplex wood. We added the pdf file with the vector models.

Step 2: Wire the Wood Construction

Use a thick wire for the middle part. This hangs from the tree. For the leaves we use fishing wire (about 1,5 meters x 5). Put the fishing wire trough the small holes and bring them together in the small round above.

Step 3: Attach the Leaves and Tie Them Up

Attach the leaves to the middle part and tie the fishing wire to each leaf. The knob should be on the upper side of the leaf so it can be easily pulled up.

Step 4: 3D Print the Middle Part of the Spool

We 3D printed the middle part of the spool, which holds the fishing wire so it can wrap around. Glue the lasercut rounds onto the 3D spool. Attach the fishing wire and tie the wires together.

Step 5: Write Code for Arduino and Attach the Sensors

Attach your servo and motion sensor to your breadboard and connect in to the arduino (or funduino) board. This is the code:

#include

#include Servo myservo;

#define PING_PIN 12 # define PING_PIN2 11 // Arduino pin tied to both trigger and echo pins on the ultrasonic sensor. #define MAX_DISTANCE 250 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar(PING_PIN, PING_PIN2, MAX_DISTANCE); // NewPing setup of pin and maximum distance.

int pos = 0; // variable to store the servo position boolean check = 0; unsigned int uS = 10; void setup() { myservo.attach(9); Serial.begin(9600); // attaches the servo on pin 9 to the servo object }

void loop() { int itemp = uS / US_ROUNDTRIP_CM; if(check == 1){ for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees // in steps of 1 degree myservo.write(pos); // tell servo to go to position in variable 'pos' delay(20); // waits 15ms for the servo to reach the position }

delay(2000); for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees myservo.write(pos); // tell servo to go to position in variable 'pos' delay(20); // waits 15ms for the servo to reach the position } check = 0; } delay(250); uS = sonar.ping(); Serial.print("Ping: "); Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance and print result (0 = outside set distance range, no ping echo) Serial.println("cm"); Serial.print(check); int i = uS / US_ROUNDTRIP_CM; Serial.print("test movement"); Serial.println(i); Serial.print(itemp); if(i < 125 && i > 70 && i != 0){ check = 1; } }

Step 6: Attach the Spool Onto a Branch

The spool is attached onto the servo (with small screws) and to a firm branch of a tree. This needs to be hung higher and perfectly vertical to the flower construction. Attach a wire at the bottom of the flower construction and bring that to the ground and tie it to a rock. This is necessary so the flower can't be pulled up in its total. It needs a heavy weight at the bottom.

Step 7: Attach the Motion Sensor to Another Branch

Attach the motion sensor to another branch. You need to test out for yourself how close it needs the be to the person standing next to it.