Making Things Interactive

February 12, 2008

Fan, knife

Filed under: 5: Making Motion,Lea — tovelet @ 2:17 pm

For this exercise, I got to box of motors too late to borrow one, and decided that I would instead use whatever spare motors I could find in my house. I had a few stepper motors and a DC fan which drives air into four tubes. We worked with the steppers in a class I took last semester. One of them already had a convenient laser cut mount, and I still had the integrated circuit that we used, so I just wanted to make the same setup work again (and hopefully actually understand it this time).

Although I could not find any specifications online for the motors I had, Tom Igoe’s page about stepper motor control was very helpful, and I figured that I had a unipolar stepper, and that the two matching leads were probably the center connections to the coils. I adapted his code, which uses the Arduino Stepper library.

The DC fan was simply the circuit and code presented in class last Thursday (see page 2 of the notes). I found the diagrams here and here to be useful in translating the circuit diagram into a breadboard layout. I didn’t have any diodes of the non-light-emitting variety, so I just used what I had, and they served as nice indicators as well.

A 9V battery seems to be sufficient to power the stepper motor; the fan was more powerful with the 12V wall adapter.

The plan, once I had the stepper and fan working, was to create a device that inflated a plastic bag and, on button press, attacked it with a knife. After taping a blade to the swinging arm of the stepper, I found that the bag was fairly resilient to slicing attacks. Since the device was approximately as comically futile with and without the knife, I removed the blade to minimize robot-related injuries in the near future.

 Stress device

 This program swings a knife on a stepper motor to strike a bag being filled by a DC fan, 
 based on stepper motor code by Tom Igoe ( 
 and DC motor code and wiring diagram from ITP ( 
 It uses the built-in Stepper library.

#include <Stepper.h>

#define motorSteps 200     // I don't actually know how many steps my motor has,
                           // but this seems to give good results.
#define motorPin1 8
#define motorPin2 9
#define motorPin3 10
#define motorPin4 11
#define ledPin 13

int fanPin=4;
int switchPin=12;
int buttonPress=1;

// initialize the Stepper library:
Stepper myStepper(motorSteps, motorPin1,motorPin2,motorPin3,motorPin4); 

void setup() {
  // set the motor speed at 60 RPMS:

  // set up the pins:
  pinMode(ledPin, OUTPUT);
  pinMode(fanPin, OUTPUT);
  pinMode(switchPin, INPUT);

void loop() {
  digitalWrite(fanPin, HIGH);
  if (digitalRead(switchPin) == HIGH)
    digitalWrite(fanPin, LOW);



1 Comment »

  1. Schematic diagram of your (own) project?

    Comment by mdgross — February 13, 2008 @ 7:11 am | Reply

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Blog at

%d bloggers like this: