Introduction: Head Swinging Dragonfly

About: We are Family. Our hobby is D.I.Y. and to Live.

I made dragonfly. The dragonfly swings head with a gesture sensor and a servo motor.

components

  • Arduino UNO
  • Seeed Grove - Gesture
  • FS90R Micro Continuous Rotation Servo

Step 1: Constitution

Detecting the movement of the finger with the gesture sensor and controlling the rotation direction of the 360 ° continuous rotation servo with Arduino.

Step 2: Create Dragonfly - Head 1 -

The head was made with 12 mm long M8 screw. When rotating the head with the servo cut the stick to stop at a fixed angle cut the wire to the appropriate length and solder it to the screw.

Step 3: Create Dragonfly - Head 2 -

Eyes and mouth were made with glittery jewelry seals. I write the mouth with a pen.

Step 4: Create Dragonfly - Head 3 -

The connection between the head and the chest (servo) is made up of a nut. Attach the feathers and nuts attached to the servo with instant adhesive.

Step 5: Create Dragonfly - Body 1 -

Make the servomotor to the dragonfly's chest. Adhered 60 mm long M6 screw as belly.

Step 6: Create Dragonfly - Body 2 -

Screw the nuts created earlier to the servo and bond the feathers of the plaques with the feet of the wire.

Step 7: Create Dragonfly - Body 3 -

Attach a thick wire to the servo so that it catches on the head replacement bar. I solder the thin wire's feet to this thick wire (for stainless steel).

Step 8: Create Dragonfly - Body 4 -

Screw the head into the nut and the dragonfly is completed. Activate the servo and turn it.

Step 9: 360-Degree Continuous Rotation Servo

This servo operates with the Servo library which was originally included in Arduino IDE, but slightly different from normal servo motor.

  • Servo stop with 90 degree input
  • Rotate clockwise with 0 to 89 degrees input. The rotation speed increases farther from 90 degrees.
  • Rotate counterclockwise with input from 91 to 180 degrees. The rotation speed increases farther from 90 degrees.

Step 10: Arduino Code

Connect servo and gesture sensor to Arduino UNO.

The gesture sensor library uses the following.
https://github.com/Seed-Studio/Gesture_PAJ7620

I looked at the code sample paj7620_9gestures.ino.

The gesture made it recognize the clockwise direction and the counterclockwise direction of the finger.

Arduino's digital 8 pin is connected to GND so that the servo rotates slowly in the counterclockwise direction so that the head screw can be turned into the nut.

Arduino's digital 8 pin open releases the normal operation, and gesture sensor detection starts. Detects the rotation of finger movement and moves according to the servo.

#include
#include "paj7620.h" #include Servo myservo; // create servo object to control a servo

void setup() { uint8_t error = 0; Serial.begin(9600); myservo.attach(A0); // attaches the servo on pin 9 to the servo object pinMode(8, INPUT_PULLUP); error = paj7620Init(); // initialize Paj7620 registers if (error) { Serial.print("INIT ERROR,CODE:"); Serial.println(error); }else { Serial.println("INIT OK"); } Serial.println("Please input your gestures:\n"); }

void loop() { uint8_t data = 0, data1 = 0, error; if(digitalRead(8) == LOW){ myservo.write(90 + 15); }else{ error = paj7620ReadReg(0x43, 1, &data); // Read Bank_0_Reg_0x43/0x44 for gesture result. if (!error) { switch (data) { case GES_CLOCKWISE_FLAG: Serial.println("Clockwise"); myservo.write(90 - 20); delay(800); break; case GES_COUNT_CLOCKWISE_FLAG: Serial.println("anti-clockwise"); myservo.write(90 + 20); delay(800); break; default: myservo.write(90); break; } } } }

Step 11: Operation

I got a pretty head swing dragonfly!

Toys Contest

Participated in the
Toys Contest