Biting Box

by TheFourthSword in Circuits > Arduino

143 Views, 0 Favorites, 0 Comments

Biting Box

WhatsApp Image 2020-01-13 at 09.43.17.jpeg

Requirements:

1. 11 wires ( 4 red, 4 orange/yellow, 3 black)

2. 1 button

3. 10 ohm resistor

4. 2 servo motors

5. Container with movable lid

6. Container with secure lid (to tuck away your arduino and wires)

7. Any fabric

8. Attachment supplies

Step 1: Breadboard

breadboard knopje.png
breadboard servo.png

Button:

1. Connect the yellow wire to pin 8

2. Connect the red wire to 3.3V

3. Connect the black wire to GND

Servos:

1. Connect the black servo wires to -

2. Connect the red servo wires to +

3.Have the red + row wire connect to Vin

4. Have the orange - row wire connect to GND

Code

code arduino.png

Base code taken from: https://www.instructables.com/id/Servo-Motor-Ardui...

Code edited to get a biting effect and to support two servo motors

#include ;

const int buttonPin = 8;

const int servoPin = 9; Servo servo1;

const int servoPin2 = 11; Servo servo2;

const int delayBite = 300;

void setup() { servo1.attach (servoPin); servo2.attach (servoPin2);

pinMode(buttonPin, INPUT); }

void loop() {

int buttonState;

buttonState = digitalRead(buttonPin);

if (buttonState == LOW) { servo1.write(150); servo2.write (90); delay(delayBite); servo1.write (90); servo2.write (150); delay(delayBite); servo1.write(150); servo2.write (90); delay(delayBite); servo1.write (90); servo2.write (150); delay(delayBite); servo1.write(150); servo2.write (90); delay(delayBite); servo1.write (90); servo2.write (150); } }

Hiding Your Wires

WhatsApp Image 2020-01-13 at 09.43.18 (1).jpeg

To safely hide the inner workings of your creation, you can grab any kind of container, as long as you can make holes in it. I went with an old Hummus container, making it so the lid was easy to remove and I could cut through the plastic. I attached my little chest to the lid of the container with some nails, while covering the entirety of the container up with fabric, giving it better vibes.
I attached the fabric with a bunch of needles and tape, but it was not the most efficient method, so I'd recommend using an alternative if you know one.

The servo motors go out through a hole in the back of the container, while the power source comes in from the side.

Of course, if you want to take in less space and keep your creation in one piece, be sure to solder your wires instead of using a breadboard!

Final Attachments

WhatsApp Image 2020-01-13 at 09.43.18.jpeg
WhatsApp Image 2020-01-13 at 09.43.19.jpeg

After ensuring the inner workings of your project are correct, it's time to piece it all together!

Make sure to securely glue your servo motors to the back of your treasure chest.
For the movements of the chest I attached some solder board to the servo motors and the chest, as my motors weren't long enough to touch the chest lid.
If that doesn't work for you though, you can always try a different material, just make sure the movements stay the same before attaching it.