Introduction: Spooky Googly Eyed Spider

What does this project consist on?

Our project consists of a spooky halloween spider with googly eyes that move from side to side whenever someone comes close to it.

Supplies

Components needed for the creation of our project

1.Electronic Parts

-2 micro servos (for 2 eyes in our case, use as many micro servos as eyes)

-Arduino Uno

-Solderless Breadbord

-Ultrasonic Ranging Module HC - SR04

2.Materials

-Hose or PVC Coupling

-Soldering Wire

-Spooky Eye Balls

-20 cm diameter polystyrene hollow ball

-25 cm diameter polystyrene hollow ball

-Wooded Dowels

-Black Spray Paint

-Fuzzy Wire

3.Tools

-Dremel Tool

-Drill

-Sharp Knife or Scissors

Step 1: Tinkercad

Making a prototype of our system using Tinkercad we can see how all the electrical components are connected in order to run our code and achieve the results we want.

Step 2: Flow Diagram and Code

#include

Servo servo1; //Description of two servo motors which move the eyes Servo servo2; int trigPin = 9; //Location of the pins in which the servos are connected to the arduino int echoPin = 8; long distance; long duration;

void setup() { servo1.attach(4); //First servo runs when: pinMode(trigPin, OUTPUT); // Ultrasonic Ranging Module HC - SR04 identifies movements pinMode(echoPin, INPUT);//Then the input is the servo movement

servo2.attach(7); //Same situation with this second servo pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); }

void loop() { ultra(); servo1.write(0); // if the ultra reads movement at a maximum distance of 15cm from the sensor if(distance <= 15){ servo1.write(90); //Servo moves 90º in a random direction } servo2.write(0);//Same for the other servo if(distance <= 15){ servo2.write(90); } }

void ultra(){ digitalWrite(trigPin, LOW);// When the ultrasonic ranging module doesn’t detect a body at the determined distance then trigPin does not send the information to move the servo. delayMicroseconds(2); //It waits 2 microseconds to write again digitalWrite(trigPin, HIGH); //When movement is detected the trigPin is in HIGH, so the circuit is connected and it moves the servo 90º delayMicroseconds(10); //It waits 10 microseconds digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); //pulseIn reads trigPin state (LOW/HIGH) When it's HIGH echoPin works. distance = duration*0.034/2; }

Step 3: How to Build the Project?

Step 1:

The first thing you want to do is take the 20 cm polystyrene hollow ball. This component will be used to create the head of the spider, so it’s where the eyes will be placed. In order to do that you will need to drill two holes that go thru the ball. The diameter of these holes will have to be a little bit bigger than the diameter of the hose or the PVC Coupling used to create the eye sockets, since the eye sockets will later be placed inside these holes.

Step 2:

The second step you’ll need to take is drill two parallel holes on each side of the eye socket. These holes will have to be big enough for the soldering wire to go thru them, but not so big that the wire will move excessively.

Step 3:

Now drill a whole as big as the ones drilled in the eye socket, but in the googly eyes. In these holes you’ll have to place the soldering wire, or any kind of wire you’d like, in order to create the axis in which the eyes will rotate. In our case we decided to have the eyes move from side to side, so the axis is placed in a vertical position. The wire should go thru one side of the eye socket, then the eye and finally, the other side of the socket. You’ll need to fold the wire so it’s sitting flat on top of the eye socket, you need to do this so it won’t stick out and prevent you from placing the eye socket inside the holes of the polystyrene ball.

Step 4:

Once the eye is inside the socket, we need to create a connection between the eye ball and the servo motor. In order to achieve this we will take the wooded dowels and glue them on to the side of the googly eyes that is facing the inside of the eye socket, meaning that the dowel will be sticking out onto the inside of the spiders head. Next we will take about 6 cm of thin wire and wrap one end of the wire around the end of the dowel and the other end to the small plastic arm that is attached to the servo motor. We will do this so that when the servo motor arm moves from side to side, it moves the wooded dowel in the same way, making the eye spin around it’s axis.

Step 5:

Before placing the eyes inside the head, we need to paint the styrofoam balls black and unite them together with glue or using wires, this step is up to your liking, the important things is to create the body of the spider so that the 25 cm ball is the torso in which you’ll take the fuzzy wires and attach 6 legs to it, and the 20 cm ball is the head.

Step 6:

Once the body of the spider is done, you’ll need place the eye sockets in the head holes and attach the wooded dowels to the servomotors. The servomotors will be connected to the Ardino Uno, and you’ll need to run the code so that the servo changes angle when the Ultrasonic Ranging Module HC - SR04 detects someone is at a certain distance from it.

Step 4: Conclusion

During this task we’ve had the opportunity to take all the theoretical concepts that have been presented to us in class in order to make our own project, applying these concepts to a practical situation and learning through real life experience.

The first thing we did was carry out an investigation of different projects that can be made using an Arduino. Since our task was to make something related to halloween, we thought that a spooky spider would be a good concept to work around. We decided to have it move it’s eyes if someone comes close to it. In order to do this we though of all the Arduino components we could use to make this happen, and we concluded on using an Ultrasonic Ranging Module and servomotors to move the eyes. The Ultrasonic Ranging Module has been used in order to send waves and detect the distance of the bodies that come close to the spider, while the servomotors have been used to move 90º when the waves sent out by the module crash against a body that is 15 cm or closer to the spider.

We’ve encountered a few inconveniences during the making of this project. One of the problems was that it was a little more complicated than we thought to create a well connected invention for the servomotors to move the eyes around the wire axises. The eyes would get stuck to the axis and they wouldn’t rotate properly once the servomotor was movement. In the end we’ve been able to solve this problem and the projects works just as it should.