Head Swinging Dragonfly

by HomeMadeGarbage in Circuits > Robots

1545 Views, 3 Favorites, 0 Comments

Head Swinging Dragonfly

twitter.png

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

Constitution

Untitled Sketch_ブレッドボード.png

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

Create Dragonfly - Head 1 -

IMG_20181002_001530.jpg

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.

Create Dragonfly - Head 2 -

IMG_20181002_011914.jpg

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

Create Dragonfly - Head 3 -

図1.png

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.

Create Dragonfly - Body 1 -

IMG_20181001_223445.jpg

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

Create Dragonfly - Body 2 -

IMG_20181002_021245.jpg

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

Create Dragonfly - Body 3 -

IMG_20181002_015136.jpg

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).

Create Dragonfly - Body 4 -

IMG_20181002_015122.jpg

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

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.

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; } } } }

Operation

IMG_20181002_022911.jpg
Head Swinging Dragonfly

I got a pretty head swing dragonfly!