(attempt at) Oscillating Fan

Description

I wanted to make a fan that fights with its on/off switch (hence oscillating between on and off). I envisioned a balance-based switch (the paper shape) on top of a force meter. To turn on the fan, you balance the switch on the FSR. The fan turns on, but the breeze it produces pushes the switch off balance, turning the fan off. The switch then comes back to balance, turning the fan on again (and so it continues). A pot is used to control the fan speed.

Issues:

  1. I tried a few fan designs (paper pin-wheel, plastic bottle), but couldn’t get it to produce a strong enough breeze to tip the switch off balance, even at the max pot value. I suspect the blades were slipping on the motor shaft, but I wasn’t willing to glue to it directly.
  2. It was challenging to make switch heavy enough to trip the force sensor while still light enough to be tipped off balance. I would try a photosensor next time (mine are currently encased in my last project).

Components

  • Arduino
  • pot, FSR, DC motor, battery pack
  • resistors and hookup wires
  • paper (and plastic bottle).

Code

/*
* one motor (speed controlled by pot) turns on in response to
* force applied by a weighted sail. a fan on the motor blows the
* sail, removing the force. I didn't implement the lights.
*
* modified version of AnalogInput
* by DojoDave <http://www.0j0.org>
* http://www.arduino.cc/en/Tutorial/AnalogInput
* Modified again by dave
*/

int potPin = A0; // pot input pin
int forcePin = A1; // FSR input pin
int motorPin = 9; // motor pin

int redPin = 12;
int bluePin = 11;

int potVal = 0; // store the value coming from the pot
int forceVal = 0; // store the value coming from the FSR

void setup() {
pinMode(redPin, OUTPUT);
pinMode(bluePin, OUTPUT);

Serial.begin(9600);
}
void loop() {
potVal = analogRead(potPin); // read the pot value, between 0 - 1024
forceVal = analogRead(forcePin); // read the FSR value

digitalWrite(redPin, LOW);
digitalWrite(bluePin, LOW);

Serial.print("pot value: ");
Serial.println(potVal);
Serial.print("FSR value: ");
Serial.println(forceVal);

if (forceVal > 200) {
analogWrite(motorPin, potVal/4); // turn on the motor. analogWrite ranges 0-255
digitalWrite(redPin, HIGH);
digitalWrite(bluePin, LOW);
}
else {
analogWrite(motorPin, 0); // turn off the motor
digitalWrite(redPin, LOW);
digitalWrite(bluePin, HIGH);
}

delay(500);
}

Images

fan-pic

fan_video

Touch me not !

Description: 

Well everyone must have seen the touch me not leaves which close when touched. I tried to create something similar but a different reaction to the touch. I created an origami lily and attached the stalk to the dc motor. On the flower is a photo sensor that detects if a hand is close to the petals. When close, the dc motor gets activated and moves the flower in order to depict that the flower is not meant to be plucked.

Components:

  • Arduino Uno
  • 1 DC motor
  • 1 Transistor
  • 1 Diode
  • 2 resistors (one 1KΩ, one 10KΩ)
  • 1 photo sensor
  • 1 piezo sensor
  • 1 origami lily
  • battery pack
  • two AA batteries
  • jumper wires

Code:


// This code is to move the DC motor based on input from a photosensor

const int dcMotorPin = 11;
const int piezoPin = 7;
const int photPin = 1;

int photValue;
int dcMotorValue;
int potValueBeats;

void setup() {
// Still need to set a baud rate, even for USB.
Serial.begin(9600);
// Set DC Motor and Piezo pins to output.
pinMode(dcMotorPin, OUTPUT);
pinMode(piezoPin, OUTPUT);

// photo sensor analogue pin is an input.
pinMode(photPin, INPUT);
}

void loop() {
// The photo sensor values are mapped from 300 to 1024 onto 0 to 150
photValue = analogRead(photPin);

if(photValue <= 300) { dcMotorValue = 150; } else if(photValue > 300 && photValue < 700)
{
dcMotorValue = 70;
}
else
{
dcMotorValue = 0;
}

analogWrite(dcMotorPin,dcMotorValue);
digitalWrite(piezoPin, HIGH);
delayMicroseconds(956);
digitalWrite(piezoPin, LOW);
delayMicroseconds(956);
}
img_20161011_174648
 

[Lab06] This one’s a kicker.

Description

For this lab, I wanted to try to extend the range of motion from the DC motor to a pinwheel, and then to try to move water with that. Thus, I made a dolphin that can splash with a high enough energy rotation from the potentiometer. Otherwise, it will just make a fitting high pitched squeal (due to the motor being restricted in its range of motion). I also created an accompanying sketch in Processing that does waves.

Materials

  • Dental Floss Cap
  • Deconstructed Pinwheel
  • Dolphin with Magnetic Bottom
  • Arduino, Breadboard, Jumper Cables
  • Potentiometer
  • Resistors, Transistors, Diodes

Code

 


/*
* one pot fades one motor
* modified version of AnalogInput
* by DojoDave <http://www.0j0.org>
* http://www.arduino.cc/en/Tutorial/AnalogInput
* Modified again by dave
*/

int potPin = 0; // select the input pin for the potentiometer
int motorPin = 9; // select the pin for the Motor
int val = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(potPin); // read the value from the sensor, between 0 - 1024
Serial.println(val);
analogWrite(motorPin, val/4); // analogWrite can be between 0-255
}</blockquote>

<strong>Processing</strong> (building off of SineWave example code)
<blockquote>String buf="";
int cr = 13;
int lf = 10;
int serialVal = 0;
int shift = 0;
int xspacing = 16; // How far apart should each horizontal location be spaced
int w; // Width of entire wave

float theta = 0.0; // Start angle at 0
float amplitude = 75.0; // Height of wave
float period = 500.0; // How many pixels before the wave repeats
float dx; // Value for incrementing X, a function of period and xspacing
float[] yvalues; // Using an array to store height values for the wave
float alpha=0;
boolean forward;

void setup() {
size(1500, 800);
w = width;
dx = (TWO_PI / period) * xspacing;
yvalues = new float[w/xspacing];

}

void draw() {
background(0, 125,200);
calcWave();
for (int i = 0; i &lt; 360; i+=10) {
rotate(i%36);
renderWave(alpha);

}
}

void calcWave() {
// Increment theta (try different values for 'angular velocity' here
theta += 0.03;

alpha = ((alpha +1) %255);

// For every x value, calculate a y value with sine function
float x = theta;
for (int i = 0; i &lt; yvalues.length; i++) {
yvalues[i] = sin(x)*amplitude;
x+=dx;
}
}

void renderWave(float alpha) {
stroke(50, alpha ,200);
noFill();
// A simple way to draw the wave with an ellipse at each location
for (int x = 0; x &lt; yvalues.length; x++) {
ellipse(x*xspacing, height/2+yvalues[x], 3, 3);
}
}</blockquote>

waves

Angry Turtle

Description

This Lego turtle gets angry and vibrates whenever there is light on the light sensor. There is a DC motor inside the turtle. The motor has a piece of cork on it, so running the motor makes it vibrate. If the light sensor reading is over 500 (about 50%), then the turtle will pulse vibration for 0.2 seconds, then pause for 0.5 seconds. This makes it sound angry without being overwhelming. The speed of the motor is directly related to the light reading.

Materials

  • 1 cork
  • Legos
  • Masking tape
  • 1 Arduino
  • 1 DC motor
  • 1 red LED
  • 1 light sensor
  • 1 220 Ω resistor
  • 1 10 KΩ resistor
  • 1 1 KΩ resistor
  • wires
  • 1 diode
  • 1 battery pack
  • 2 AA batteries
  • 1 transistor

Image

Angry Turtle

int lightSensorPin = 0;   // select the input pin for the light sensor
int motorPin = 9; // select the pin for the Motor
int val = 0;      // variable to store the value coming from the sensor
void setup() {
  Serial.begin(9600);
}
void loop() {
  val = analogRead(lightSensorPin);    // read the value from the sensor, between 0 - 1024
  Serial.println(val);
  if (val > 500) {
      analogWrite(motorPin, val/4); // analogWrite can be between 0-255
    delay(200);
  }
  analogWrite(motorPin, 0); // turn off
  delay(500);

Lab 06 – DC motor-powered barber pole

Description:
For this lab, I wanted to test how much power our little DC motors have. Since it’s acknowledged that they don’t have much torque, I didn’t want to choose something too heavy, but I did want to extend the range of the spinning motion so that it would be visible from far away. Looking around my apartment, I happened to have a poster tube sitting around, which I realized would make the perfect object: it’s long but slender, doesn’t weigh much but it stable, and is round, so I could fairly easily spin it with the motor without getting too much vibration.

So, I created a monochrome version of a barber’s pole:
molly-lab06

First, I used the potentiometer as the speed control so that I could “lock in” a spin speed:
img_1248

But after that, I wanted to try out using the FSR so that I could control the spin while holding the motor, so that I’d have I/O coincidence. That’s what I’ll be demonstrating in class.

One interesting observation I had was that with a heavy-ish weight, the motor takes quite a bit of “revving” to get to a level of power sufficient to overcome the inertia. And then, after removing power, my barber pole keeps spinning for quite some time. Interesting to watch it in action.

Components:

  • Arduino Uno
  • breadboard
  • 1 DC motor
  • 1 Transistor
  • 1 Diode
  • 2 resistors (one 1KΩ, one 10KΩ)
  • 1 FSR (or potentiometer)
  • 1 poster tube, decorated
  • piece of cork (to provide friction and hold the motor in place on the end of the tube)
  • battery pack
  • two AA batteries
  • jumper wires

 

Code:
(This is the final code, using the FSR rather than the potentiometer.)


int potPin = 0; // select the input pin for the potentiometer/FSR
int motorPin = 9; // select the pin for the Motor
int val = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(potPin); // read the value from the sensor, between 0 - 1023
val = map(val, 0, 1023, 0, 255);
Serial.println(val);
analogWrite(motorPin, val); // analogWrite can be between 0-255
}

Whirlygig

Description

I started this project by wanting to create a moving cat toy for my kitten, Juno. She’s home by herself most of the day and gets quite bored. This would be a way to keep her entertained, as well as healthy. I failed to see the flaws in my plan, however: 1. cats are afraid of loud noises, and 2. they’re more interested in playing with wires than the toy.

Juno, ruining her chances of a new toy

I changed direction and decided to create a toy for myself from my childhood: a pinwheel. I’m quite a fan of origami, so I welcomed the exercise. I created the pinwheel from a large piece of orange construction paper (a tribute to the Giants who just lost the series), used a ceramic straw to form a sturdy base, and two LEDs on either side to create a fun, multi-colored spiral effect. I also added a piece of cork to keep the pinwheel from flying off the motor. Finally, the potentiometer controls how quickly the pinwheel spins.

Watch the video!


Components:

  • 1 Arduino
  • 1 Breadboard
  • 1 Resistor (1kΩ)
  • 1 potentiometer
  • 1 DC motor
  • 1 Transistor
  • 1 Diode
  • Several jumper cables
  • Tape
  • 1 Ceramic straw
  • 1 Piece of cork from a wine bottle
  • 1 Piece of orange construction paper (and 1 paper cut)
  • 2 LED lights
  • 2 Cell batteries

View the set-up


Code

/*
 * one pot fades one motor
 * modified version of AnalogInput
 * by DojoDave &lt;http://www.0j0.org&gt;
 * http://www.arduino.cc/en/Tutorial/AnalogInput 
 * Modified again by dave
 */

int potPin = 0; // select the input pin for the potentiometer
int motorPin = 9; // select the pin for the Motor
int val = 0; // variable to store the value coming from the sensor
void setup() {
 Serial.begin(9600);
}
void loop() {
 val = analogRead(potPin); // read the value from the sensor, between 0 - 1024
 Serial.println(val);
 analogWrite(motorPin, val/4); // analogWrite can be between 0-255
}

Lab06: Hands of a Clock

Description:

Unfortunately, the wires I soldered to my DC motor snapped off and additionally got stuck in the breadboard; but, I’ve seriously considered certain applications that I was in the middle of developing. When the FSR has pressure applied to it, the DC motor spins more swiftly. So, as pressure is applied to the FSR, it is as though we are rushing forward through time (similar to Hermione’s time-turner pendant). Additionally, I considered this process to be similar to how an electric pencil sharpener works. When pressure is applied to the pencil sharpener, it knows to spin and sharpen your pencil.

Components Used:

  • 1 Arduino
  • 1 Resistor (1kΩ)
  • 1 Breadboard
  • 1 FSR potentiometer
  • 1 DC motor
  • 1 transistor
  • 1 diode

Code:

/*
 * one pot fades one motor
 * modified version of AnalogInput
 * by DojoDave &lt;http://www.0j0.org&gt;
 * http://www.arduino.cc/en/Tutorial/AnalogInput 
 * Modified again by dave
 */

int potPin = A0; // select the input pin for the potentiometer
int motorPin = 9; // select the pin for the Motor
int val = 0; // variable to store the value coming from the sensor
void setup() {
 Serial.begin(9600);
}
void loop() {
 val = 1024 - analogRead(potPin); // read the value from the sensor, between 0 - 1024, and then subtract from 1024
 Serial.println(val);
 analogWrite(motorPin, val/11); // analogWrite can be between 0-255
}

<img class="alignnone size-medium wp-image-1591" src="http://blogs.ischool.berkeley.edu/i262/files/2016/10/IMG_6316-300x225.jpg" alt="img_6316" width="300" height="225" />

The Coffee Cup That Stirs Itself

For this lab, I chose to make a coffee cup that stirs itself. I used the DC motor to power the spinning/mixing of the spoon within the coffee cup and I programmed the potentiometer to control how quickly the spoon stirs the coffee.

Components:

  • Arduino board
  • Breadboard
  • Jumper wires
  • 1 DC motor
  • 1 potentiometer
  • 1 1k resistor
  • 1 diode
  • 1 battery pack

Code:

/*
 * one pot fades one motor
 * modified version of AnalogInput
 * by DojoDave &lt;http://www.0j0.org&gt;
 * http://www.arduino.cc/en/Tutorial/AnalogInput 
 * Modified again by dave
 */

int potPin = 0; // select the input pin for the potentiometer
int motorPin = 9; // select the pin for the Motor
int val = 0; // variable to store the value coming from the sensor
void setup() {
 Serial.begin(9600);
}
void loop() {
 val = analogRead(potPin); // read the value from the sensor, between 0 - 1024
 Serial.println(val);
 analogWrite(motorPin, val/4); // analogWrite can be between 0-255
}
 

img_7446 img_7447

Ghost Writer

Description:

South Hall is haunted by a ghost!
Just kidding (maybe) – I used the setup given in lab to explore how movement of pens would work when attached to a motor. I used the same circuit from the basic lab instructions, and connected different types of pens to to the motor and let it draw across the paper.
I found that the pens with the larger tip perform better, and they are more stable. The motor tends to just drag the pen across the paper, as you speed up the motor with the pot, it moves faster. If you change the speeds rapidly, it creates more of a “bend” pattern as the weight of the pen is distributed on the motor.
Is it the ghost telling us to finish our homework? Probably.

This is similar to Spinbot: http://www.makershed.com/products/make-spinbot-kit-bagged
img_1607img_1608-2img_1609

 

Components

  • 1x Bread board
  • 1x Arduino
  • 1x pot
  • 1x 1k resistor
  • 1x transistor
  • 1x diode
  • 1x DC motor
  • 1x battery pack

Code

/*
 * one pot fades one motor
 * modified version of AnalogInput
 * by DojoDave <http://www.0j0.org>
 * http://www.arduino.cc/en/Tutorial/AnalogInput 
 * Modified again by dave
 */

int potPin = 0;   // select the input pin for the potentiometer
int motorPin = 9; // select the pin for the Motor
int val = 0;      // variable to store the value coming from the sensor
void setup() {
  Serial.begin(9600);
}
void loop() {
  val = analogRead(potPin);    // read the value from the sensor, between 0 - 1024
  Serial.println(val);
  analogWrite(motorPin, val/4); // analogWrite can be between 0-255
}
 

 

DC motor and Dancing Wires

Description

For this mini project, I made a small installation where people can control the rotational speed of dancing wires and see the change in the form of the dancing wires as the speed changes.

Components

  • Arduino Uno
  • Wires
  • 1 Potentiometer
  • 1 DC motor
  • Batteries
  • 1 Resistor
  • 1 Diode
  • 1 Transistor
  • Tape

Code

int potPin = 0; // select the input pin for the potentiometer
int motorPin = 9; // select the pin for the Motor
int val = 0; // variable to store the value coming from the sensor
void setup() {
 Serial.begin(9600);
}
void loop() {
 val = analogRead(potPin); // read the value from the sensor, between 0 - 1024
 Serial.println(val);
 analogWrite(motorPin, val/4); // analogWrite can be between 0-255
}
Images

The whole connected device:

img_0943

The wires dancing at different radiuses, when the rotational speed of the  DC motor changes:

img_0944 img_0952 img_0948 img_0957