Making Things Interactive

February 26, 2008

Solenoid working! Yay!

Filed under: 6: More Motion,Assignments,Lingshui Wang — lingshui @ 12:34 am

Finally got a solenoid working, used a TIP 3055 transistor. linked it up with a 3V buzzer to be both activated by a rangefinder on a 2 second loop script. Here’s a schematic, a script, and a video:

int buzzer = 13;                    //buzzer set to digital 13
int rangeFinder = 0;                //rangefinder set to analog 0
int solenoid = 8;                   //solenoid set to digital 8
int val;

void setup ()
  Serial.begin (9600);              //serial library set up for troubleshooting
  pinMode (buzzer, OUTPUT);         //buzzer set to output
  pinMode (rangeFinder, INPUT);     //rangefinder set to input
  pinMode (solenoid, OUTPUT);       //solenoid set to output

void loop ()
  val = analogRead (rangeFinder);   //set definition for "val"
  Serial.print("switch input: ");
    if (val  50)                    //if object is far...
	digitalWrite(buzzer, LOW);   //do nothing
    	digitalWrite(solenoid, LOW);


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your 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

Blog at

%d bloggers like this: