Introduction: Interactive Bender
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)
Say hello to Bender, the lovable bending unit from New New York made famous by the TV show Futurama. My take on the interactive Bender project includes a retractable antenna, as well as a mouth that can open and close all from the push of a button.
Supplies
2 12 N*kg Servos
Assorted length jumper wires
Arduino Uno board
Large breadboard
Small breadboard
4 push buttons
4 10k ohm resistors
Step 1: Arduino Code
//first I include libraries and define pins,buttons, and variables
#include <Servo.h>
int buttonpin= 7; int bpin2= 6; int bpin3= 5; int bpin4= 4;
Servo servo1; Servo servo2; int val=0;
int buttonstate=0; int bstate2=0; int bstate3=0; int bstate4=0;
///////////////////////////////////////// //Next I set up my servo pins and buttons
void setup() {
servo1.attach(8); servo2.attach(9);
pinMode(buttonpin,INPUT); digitalWrite(buttonpin,LOW);
pinMode(bpin2,INPUT); digitalWrite(bpin2,LOW);
pinMode(bpin2,INPUT); digitalWrite(bpin2,LOW);
pinMode(bpin2,INPUT); digitalWrite(bpin2,LOW); }
///////////////////////////////////////// //finally I run my main loop to run the servos
void loop() {
buttonstate=digitalRead(buttonpin); bstate2=digitalRead(bpin2);
bstate3=digitalRead(bpin3); bstate4=digitalRead(bpin4);
if(buttonstate==HIGH) {
servo1.write(180);
}
if(bstate2==HIGH){
servo1.write(0);
}
if(bstate3==HIGH){
servo2.write(180);
}
if(bstate4==HIGH){
servo2.write(0); }
}
///////////////////////////////////////// //telling the servos how far to rotate
Step 2: Printed Parts
- First I printed a hollow cylinder with an open top to use as the base of the head and for storage of the servos
- Next I printed separate components for the mouth cover and antenna that would be used as my moving parts
- Then I printed the hollow half sphere to use as the top of the head
- Attached are the files for each part
- The hollow half sphere and mouth cover require supports to be printed properly
Step 3: Wiring Diagram
Here in the circuit diagram, you can see how each push button is assigned to an input pin, and the servos are assigned to output pins. Each button is grounded through a resistor and connected to a 5 volt vcc.
Step 4: Good Luck and Have Fun!
If you have any questions contact me at gaines_r@ gmail.com!