Finger Bug: LilyPad Arduino

I wanted to create something that would be controlled by finger taps; if I could build a robot bug army I would have. I wanted some form of creature to react based on the input it received from me.

I created a small walking creature out of legos and servo motors. The point was to create a strange creature that seems miniscule and could walk oddly and animal like. The most basic way of controlling the creature was to put a pressure sensor in the index and middle fingers of a glove. These pressure sensors would then be connected to a LilyPad Arduino which would provide analog input to control an analog output.

Ideally, I wanted the transmission of finger taps to be wireless, but due to time I was unable to get the XBee to work. I was able to get them to communicate with each other but was still was rather fuzzy on their connection to the LilyPad Arduino. Another issue I ran into was the thread connections in the glove. Connecting conductive thread to wire should have been fairly easy but the connections to the pressure sensor kept giving weird readings and sometimes none at all. The best solution was to connect the wires via jumper cables to the sensor.

If I had to change something about this project, it would have been getting the XBee to work. The XBee would have simplified the process considerably and would have allowed to robot to not require a connection to the glove itself.

Video Link

Arduino Sketch

#include <Servo.h>

Servo leftServo;  
// create servo object to control a servo
// a maximum of eight servo objects can be created
Servo rightServo;

int pos = 0;    // variable to store the servo position
int indexSensor = A1; 
//index finger sensor sending in analog input

void setup()
{
Serial.begin(9600);
leftServo.attach(5);  
// attaches the left servo on pin 5 to the servo object
rightServo.attach(6); 
//attaches the right servo to pint 6
}


void loop()
{
int indexValue = analogRead(indexSensor);

Serial.println(indexValue);

//while the index is moving, we want the servo to move

if(indexValue > 100)
{
for(pos = 0; pos < 45; pos += 1)  
// goes from 0 degrees to 45 degrees
{                                  
// in steps of 1 degree
leftServo.write(pos);       
// tell servo to go to position in variable 'pos'
delay(10);
}
for(pos = 45; pos>=1; pos-=1)     
// goes from 45 degrees to 0 degrees
{
leftServo.write(pos);              
// tell servo to go to position in variable 'pos'
delay(10);
}

for(pos = 0; pos < 45; pos += 1)  
// goes from 0 degrees to 45 degrees
{                                  
// in steps of 1 degree
rightServo.write(pos);              
// tell servo to go to position in variable 'pos'
delay(10);                       
// waits 10ms for the servo to reach the position
}
for(pos = 45; pos>=1; pos-=1)     
// goes from 45 degrees to 0 degrees
{
rightServo.write(pos);              
// tell servo to go to position in variable 'pos'
delay(10);                       
// waits 10ms for the servo to reach the position
}
}

}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s