How To Make (almost) Anything

Daphne Basangwa




Week 8: Output Devices

To get started, I made the hello world unipolar stepper board using Neil Gershenfeld's template available here at MIT Fab Labs. I used these already-existing designs to modeal my board in Eagle and later to stuff it.

Board Components
-ATtiny 44 (1)
-10 microFarad Capacitor (1)
-10 kiloOhm Resistor (1)
-1.7 Amp Mosfet Transistor (4, one for each output wire of the motor)
-5V Regulator (1, This looks suspiciously like the transistors)
-2 x 3 Header (2, One to power the motor and the other to connect to a programmer)
-2 x 2 Header (1, to power the board)

Here are images of my milled and stuffed board.

Powering the board:
I used a varying voltage source to provide the board with 5V of power. I made a connector by crimping four adjuscent wires of a ribbon cable with a 2x2 crimp to connect to the board header. On the other end, I soldered two adjascent wires for the positive connection and the other two for ground.


Burning Bootloader
I did this in Arduino through my FabISP (I’m surprised that it works still). Here are the settings I used:
Under the "Tools" tab in the Arduino IDE:
-Board: “aTtiny”
-Processor: “ATtiny 44” Clock: “8 MHz (internal)”

Tools > Burn Bootloader

Program:
For starters, I used code written by Neil Gershenfeld also posted here. As I became more familiar with the workings of the unipolar motor, I re-wrote code to modify the motor's movement.

My own board design

To personalize and remix the board, I added a few elements:
-A button switch to control when the motor is powered (in liew of having the motor run as soon as the board powered)
-A capacitor to stabilize current (the motor destabilizes it a lot)
-An LED that indicates when the motor is powered by lighting
-A modified program to control the running of the board

Here is a list of all elements I added on the board.
-A White LED with a 499 Ohm Resistor on Pin 7
-A Button Switch with a 10 kiloOhm pull down resistor on Pin 8
-A 1 microFarad Capacitor

Unipolar Motor Mechanics
This video helped me visualize the inner workings of the unipolar motor. Here are quick images extracted from the video.


I also used the motor's datasheet to understand the color coding between wires and coils within the motor, and which cycles to reiterate through for clockwise vs counterclockwise rotation. For this assignment, I used the Jameco ReliaPro Unipolar Stepper Motor Step 7 Volt DC-350 mA 7.5 Step Angle 680 G-CM. Jameco Part no: 2138812

Here is a copy of my modified code


const int buttonPin = 8;
const int LEDPin = 7;
const int yellow = 3;
const int red = 1;
const int black = 2;
const int blue =  0;
int buttonState = 0;

void setup() {
  pinMode(buttonPin, INPUT);
  pinMode(LEDPin, OUTPUT);
  pinMode(yellow, OUTPUT);
  pinMode(red, OUTPUT);
  pinMode(black, OUTPUT);
  pinMode(blue, OUTPUT);
}

void cw() {
  digitalWrite(yellow, HIGH);
  digitalWrite(red, LOW);
  digitalWrite(black, LOW);
  digitalWrite(blue, HIGH);
  delay(100);
  digitalWrite(yellow, HIGH);
  digitalWrite(red, LOW);
  digitalWrite(black, HIGH);
  digitalWrite(blue, LOW);
  delay(100);
  digitalWrite(yellow, LOW);
  digitalWrite(red, HIGH);
  digitalWrite(black, HIGH);
  digitalWrite(blue, LOW);
  delay(100);
  digitalWrite(yellow, LOW);
  digitalWrite(red, HIGH);
  digitalWrite(black, LOW);
  digitalWrite(blue, HIGH);
  delay(100);
}

void ccw() {
  digitalWrite(yellow, LOW);
  digitalWrite(red, HIGH);
  digitalWrite(black, HIGH);
  digitalWrite(blue, LOW);
  delay(100);
  digitalWrite(yellow, HIGH);
  digitalWrite(red, LOW);
  digitalWrite(black, HIGH);
  digitalWrite(blue, LOW);
  delay(100);
  digitalWrite(yellow, HIGH);
  digitalWrite(red, LOW);
  digitalWrite(black, LOW);
  digitalWrite(blue, HIGH);
  delay(100);
  digitalWrite(yellow, LOW);
  digitalWrite(red, HIGH);
  digitalWrite(black, LOW);
  digitalWrite(blue, HIGH);
  delay(100);

}

void loop() {
  buttonState = digitalRead(buttonPin);
  if (buttonState == LOW) {
    digitalWrite(LEDPin, HIGH);
    cw();
    ccw();
  }

  else {
    digitalWrite(LEDPin, LOW);
    digitalWrite(yellow, LOW);
    digitalWrite(red, LOW);
    digitalWrite(black, LOW);
    digitalWrite(blue, LOW);
  }
}