Project 2 Response

Description:

For Project 2 I created a boxing bag that measures acceleration when it is hit. The bag is mobile so that it can be set up at different heights and angles. This allows it to be used for a variety of muay thai techniques including: jabs (front straight punch), crosses (back straight punch), hooks, upper cuts, round kicks, teeps (push kicks), knees, and elbows. I used the acceleration output to create a game that requires the player to hit the bag within a given range of a goal value. When the goal value is achieved the user scores a point and a new goal value is set. The range is determined by a difficulty setting. Easy has a high range (+/- 0.45g), moderate has a lower range (+/- 0.35g), and difficult has the lowest range (+/- 0.25g). I also made all the navigation for the game accessible though hits. This way if the player is wearing boxing gloves then they would not have to take them off in order to play multiple rounds of the game. When the user scores 10 points they win the game. The purpose of the game is to help the player learn control. Control is very important for muay thai because having good control while sparing/training can save your partner.  Elbows and knees in particular can easily injure a person even if you hit them lightly. Additionally, this game can be used to practice the timing of your hits. Even professional fighters only hit about 3 consecutive strikes at full force. They throw many lighter hits in between the full force hits. This game helps the user practice both full force hits and lighter hits that they need to set up for full force hits.

Process:

I started by putting my circuit on a breadboard. This was fairly simple as the circuitry for my project is not very complicated. The SparkFun website had very helpful instructions for how to set up and use the triple axis accelerometer.

18336697_10209119472369290_132067477_n
Circuit on a breadboard

Next, I took the circuit off the breadboard and soldered it to protoboard. It was somewhat difficult to solder to the accelerometer becuase the pins are very close together.

18309000_10209119472409291_337533675_n
Back of the protoboard with the accelerometer and resistors mounted to it

Next I build the bag frame from wood and a spring door hinge. I used the ban saw and the drill to make the frame. I had to counter sink the holes in the bottom of the frame to hold the post onto the top. At this point I also determined how to angle the device so that it could be used for knees, upward elbows, and round kicks. I used two pipe brackets that can be placed on the top of the base when it need to lie flat and the bottom of the base when the bag needs to be angled down.

Then I mounted the accelerometer to the top of the bag frame. I drilled a small hole behind the accelerometer to make room for the pins.

18302247_10209119472329289_350274751_n
Accelerometer mounted to the top of the frame

Next, I began covering the frame. I used upholstery nails to attach the leather to the base. At this point I also started programing the Processing for the game. Having picked out all the fabric for the exterior I could now make a game that matched that exterior. I found the fist logo online then I changed the fill color to green, yellow, red, and none in illustrator. Other than those colors, I kept to red, white, and black so that the bag and the game would match.

18308896_10209119472289288_1295058351_n
Bottom of the frame with upholstered leather

Then, I started adding padding to the post. Unfortunately, this made the post two heavy for the door hinge spring to pull the post back up.

18360832_10209119472449292_986347168_n
The post is being held down by the weight of the padding

To solve this problem I added a spring to the front of the bag as well. This allowed the bag to hold a lot of padding and still spring back after it is hit.

18337298_10209119472489293_1422178802_n
Post with extra spring on the front

Having solved the weight problem, I continued to pad the post with insulation pads until it could be punched at full force without being painful. I covered the padding with tape so that it could be easily removed and the Arduino and accelerometer could be accessed if need be.

18308635_10209120166306638_162223356_n
Back of the bag; the slit in the padding allows it to be easily removed

Lastly, I sewed a custom cover for the bag complete with a zipper, elastic, and lettering. The zipper allows the cover to be easily removed. The elastic keeps the cover tight at the bottom of the bag so that it fits snugly. The lettering on the front provides the user with a hint as to which direction the bag has to be hit from. To keep the bottom of the base from scratching furniture, I put sticky felt pads on the bottom of the base. I also added a level select to my game and an instructions screen.

18361758_10209120228988205_1202544229_n
Front view of the completed bag cover

I put the bag in the Atlas Expo which was a really cool experience in addition to being useful testing for my boxing bag. The frame stood up very well to being hit fairly continuously for an hour and a half. However, the padding was too lose at the bottom and would fly off the post if it was hit too hard. I solved this problem by simply tying the bottom of the padding tight with some string. With the cover on the bag looked just the same but the padding stayed on the post.

UnKrHo5FhPJYhjq-NxT1jUD-vb70jDScLvJpOGE36GI
My boxing bag at the Atlas Expo

Schematic:

Screen Shot 2017-05-05 at 2.33.34 PM

Code:


//Name: Project02Arduino
//By: Claudia Escue
//Purpose: send the values from an accelerometer to a processing file
#include <Wire.h> // Must include Wire library for I2C
#include <SFE_MMA8452Q.h> // Includes the SFE_MMA8452Q library
MMA8452Q accel; // Default MMA8452Q object create. (Address = 0x1D)
//create variables for the x, y, and z acceleration
float xAcceleration;
float yAcceleration;
float zAcceleration;
char val;
void setup() {
Serial.begin(9600);
accel.init(); //initialize the accelerometer
}
void loop() {
//check if the accelerometer is available
if (accel.available()) {
accel.read(); // First, use accel.read() to read the new variables:
printCalculatedAccels();
Serial.println(); // Print new line every time.
}
}
void printCalculatedAccels() {
if(Serial.available() > 0){
char input = Serial.read();
val = Serial.read();
//display accelerations as "x, y, z" so that it can be read in processing
xAcceleration = accel.cx;
Serial.print(xAcceleration, 3);
Serial.print(",");
yAcceleration = accel.cy;
Serial.print(yAcceleration, 3);
Serial.print(",");
zAcceleration = accel.cz;
Serial.print(zAcceleration, 3);
delay(250);
}
}

view raw

Project02.ino

hosted with ❤ by GitHub


//Name: BTU Boxing
//By: Claudia Escue
//Purpose: * Creates a game that is navigated through with acceleration of a punching bag
// * Teaches control of strikes
//import serial library
import processing.serial.*;
//create a variable to control what screen is displayed
int start = 0;
//create a variable to hold the number of points scored
int points = 0;
//create a maximum value the goal to be set to
float goalMax = 4.000;
//create sensor values measured in units of g
float x;
float y;
float z;
//create a value to hold the total acceleration
float total;
//create and initialzies variables for the maximum hit, difficulty setting, and goal hit
float maxNum = 0;
float difficulty = .45;
float goal = random(0.500, goalMax);
//create images for the background and for the point display
PImage imgGreen;
PImage imgYellow;
PImage imgRed;
PImage imgWhite;
//create and instance of the serial libaray
Serial myPort;
//create an instance of a font
PFont f;
void setup() {
//set the size of the game screen
size(500, 500);
//my port is: /dev/tty.usbmodem1411
String portName = "/dev/tty.usbmodem1411";
myPort = new Serial(this, portName, 9600);
//create a font of size 16 Helvetica
f = createFont("Helvetica", 16, true);
//load images
imgGreen = loadImage("fistGreen.png");
imgYellow = loadImage("fistYellow.png");
imgRed = loadImage("fistRed.png");
imgWhite = loadImage("fistWhite.png");
}
void draw() {
//set the background color to black the the font to size 36
background(#000000);
textFont(f,36);
//calculate the total acceleration
total = sqrt(sq(x) + sq(y) + sq(z));
//determine whether the bag is speeding up or slowing down my comparing the total to the maxNum
maxNum = max(total, maxNum);
//call the score update function
ScoreUpdate();
//determine the color of the image based on the goal and the size of the fist based on the number of points scored
imageMode(CENTER); //orrient the image based on the center point
if (goal <= 1.666) {
image(imgGreen, 250, 245, 110+(30*points), 110+(30*points)); //display the green fist (light hit)
} else if (goal > 1.666 && goal <= 3.333) {
image(imgYellow, 250, 245, 110+(30*points), 110+(30*points)); //display the yellow fist (medium hit)
} else {
image(imgRed, 250, 245, 110+(30*points), 110+(30*points)); //display the red fist (hard hit)
}
//set the text fill color to white, display the goal and hit texts, and the goal and acceleration to 1 decimal
fill(#ffffff);
String goalText = "Goal: " + nf(goal, 1, 1);
text(goalText, 10, 40);
String hitText = "Hit: " + nf(maxNum, 1, 1);
text(hitText, 380, 40);
//create the strings for the difficulty setting
String difEasy = "Difficulty: Easy";
String difMed = "Difficulty: Moderate";
String difDif = "Difficulty: Difficult";
//determine which difficulty setting string to display based on the difficulty selected on the instructions screen
if (difficulty == .45) {
text(difEasy, 10, 480);
} else if (difficulty == .35) {
text(difMed, 10, 480);
} else if (difficulty == .25) {
text(difDif, 10, 480);
}
//call the screen function
Screen();
}
//determing what screen to show
void Screen() {
if (start == 0) {
Main(); //shown first becuase the start variable is initialized to 0
} else if (start == 2) {
Instructions(); //move to instructions screen
} else if (points == 10) {
YouWin(); //move to win screen
}
}
//create the main screen
void Main() {
//create a black background with a white fist
background(#000000);
image(imgWhite, 250, 250, 490, 490);
//show the title of the game
textFont(f,78);
fill(#bc091b); //red fill color
String BTUText = "BTU BOXING";
text(BTUText, 10, 230);
//show instructions to get to the next screen
textFont(f, 25);
String startText = "Hit to see instructions and select level!";
text(startText, 35, 260);
//if the bag is hit set the start variable to 2 to move to the instructions screen
if (total > .5 && x < 0 && y < 0 && z < 0) {
delay(1000);
start = 2;
}
}
//creates the display for the instructions screen
void Instructions() {
background(#000000);
//set font size to 30
textFont(f,30);
fill(#bc091b); //red fill color
String instructText = "Instructions:";
text(instructText, 175, 100-30);
//set text size to 25
textFont(f,25);
//display line by line instructions
String instructText1 = "1. Try to hit the bag to match the goal";
text(instructText1, 10, 130-30);
String instructText2 = "2. The fist will grow when you score a point";
text(instructText2, 10, 160-30);
String instructText3 = "3. The fist will change color based on how";
text(instructText3, 10, 190-30);
String instructText4 = " hard you must hit it";
text(instructText4, 10, 220-30);
//display small green fist and text
image(imgGreen, 50, 240-30, 25, 25);
String instructText6 = ":light hit";
text(instructText6, 70, 250-30);
//display small yellow fist and text
image(imgYellow, 50, 270-30, 25, 25);
String instructText8 = ":meduium hit";
text(instructText8, 70, 280-30);
//display small red fist and text
image(imgRed, 50, 300-30, 25, 25);
String instructText10 = ":hard hit";
text(instructText10, 70, 310-30);
//display more instructions
String instructText11 = "4. You win when the fist wont fit the screen";
text(instructText11, 10, 340-30);
//display instructions for how to select level
String instructText12 = "5. Hit to select level:";
text(instructText12, 10, 370-30);
String instructText13 = " Hit light for easy";
text(instructText13, 10, 400-30);
String instructText14 = " Hit meduium for moderate";
text(instructText14, 10, 430-30);
String instructText15 = " Hit hard for difficult";
text(instructText15, 10, 460-30);
//set the difficulty and start points at 0
if (total > .25 && total <= 1.666 && x < 0 && y < 0 && z < 0) {
delay(1000);
start = 1;
points = 0;
difficulty = 0.45; //easy difficulty
} else if (total > 1.666 && total <= 3.333 && x < 0 && y < 0 && z < 0) {
delay(1000);
start = 1;
points = 0;
difficulty = 0.35; //moderate difficulty
} else if (total > 3.333 && x < 0 && y < 0 && z < 0) {
delay(1000);
start = 1;
points = 0;
difficulty = 0.25; //difficult difficulty
}
}
//Updates the score when a point is scored
void ScoreUpdate() {
//compare the maxNum to the goal +/- the difficulty
//if x, y, and z are less than 0 then the bag is moving back
if (maxNum > (goal-difficulty) && maxNum < (goal+difficulty) && x < 0 && y < 0 && z < 0){
points += 1;
delay(1000); //something to delay for a moment so the bag does not hit the goal on the way back down
maxNum = total;
goal = random(0.500, goalMax); //create a new goal
} maxNum = total; //reset the maxNum
}
//create the win screen
void YouWin() {
//create a balck background with a white fist
background(#000000);
image(imgWhite, 250, 250, 490, 490);
//create and display win text
textFont(f,78);
fill(#bc091b);
String winText = "YOU WIN!";
text(winText, 60, 230);
//display how to play again
textFont(f, 25);
String returnText = "Hit to play again!";
text(returnText, 155, 260);
//return to main screen if the bag is hit harder than 1.50g
if (total > 1.50 && x < 0 && y < 0 && z < 0) {
delay(1000);
points = 0;
start = 0;
Screen();
}
}
//listening for serial events
void serialEvent(Serial myPort) {
String input = myPort.readStringUntil('\n');
if (input != null) {
input = trim(input);
float[] sensors = float(split(input, ',')); //create an array for the sensor values
println(sensors);
// if the length of the sensors array is longer than 2
if (sensors.length > 2) {
//set each variable to its given value from the potentiometer
x = sensors[0] – 0.98; //subtract gravity
y = sensors[1] – 0.06; //start at about 0
z = sensors[2] – 0.25; //start at about 0
}
}
myPort.write('x');
}

view raw

Project2.pde

hosted with ❤ by GitHub

Final Photos:

Screen Shot 2017-05-05 at 2.13.56 PM
Start Screen
Screen Shot 2017-05-05 at 2.14.22 PM
Instructions Screen
Screen Shot 2017-05-05 at 2.14.44 PM
Play Screen
Screen Shot 2017-05-05 at 2.19.42 PM
End Screen

IMG_7780 copy
Front View
IMG_7786 copy
Side View

Video:

Lab 8 Response

For Lab 8 we had to use at least 2 sensors to send data serially into processing. I used three potentiometers that would send a value of 0-1026. This was fairly simple to wire (Figure 1). I used Arduino code to make the value from 0 to 255 by dividing the value sent in from the potentiometers (0-1026) by 4. It was somewhat difficult to get all three potentiometers working with a range that went all the way to 0. I then created an interface where the background would change colors based on these three values where one potentiometer controlled the amount of red, another the amount of green, and the third the amount of blue. The interface would also tell the user the exact amount of each color (Figure 2). I also made the text color change based on the color. For example, if the color was black then the text would be white but if the color was yellow then the text would be black. This made these values easier to see regardless of the background color. Below you will find figures as well as my Arduino and Processing code and a video of my final product.

17821565_10208876435173512_391280222_n.jpg
Figure 1: Wiring the potentiometers
Screen Shot 2017-04-10 at 11.00.59 AM
Figure 2: Interface


// create instances of the sensors
int sensor1;
int sensor2;
int sensor3;
char val;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println('0');
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available() > 0){
char input = Serial.read();
val = Serial.read();
// input from potentiometers
sensor1 = analogRead(A0);
sensor2 = analogRead(A1);
sensor3 = analogRead(A2);
// print out the lines of the potentiometers divided by 4 to get a value from 0-255
Serial.print(sensor1/4);
Serial.print(",");
Serial.print(sensor2/4);
Serial.print(",");
Serial.println(sensor3/4);
}

view raw

lab8 arduino

hosted with ❤ by GitHub

 


//import serial library
import processing.serial.*;
//create sensor values
int sensorVal1;
int sensorVal2;
int sensorVal3;
//create and instance of the serial libaray
Serial myPort;
//create an instance of a font
PFont f;
void setup() {
//set up the size fo the screen
size(570, 500);
//my port is: /dev/tty.usbmodem1411
String portName = "/dev/tty.usbmodem1411";
myPort = new Serial(this, portName, 9600);
//create a font of size 16 Helvetica
f = createFont("Helvetica", 16, true);
}
void draw() {
// create a background that changed color based on the input from 3 potentiometers
background(sensorVal1, sensorVal2, sensorVal3);
// create strings to hold the values of each potentiometer
String message1 = "Red: " + sensorVal1;
String message2 = "Green: " + sensorVal2;
String message3 = "Blue: " + sensorVal3;
textFont(f,36);
// change the color of the display text based on the amount of red and green in the background color
if (sensorVal1>150 || sensorVal2>150) {
fill(0);
} else {
fill(255);
}
// display the text
text(message1,10,35);
text(message2,190,35);
text(message3,410,35);
}
//listening for serial events
void serialEvent(Serial myPort) {
String input = myPort.readStringUntil('\n');
if (input != null) {
input = trim(input);
int[] sensors = int(split(input, ','));
println(sensors);
// if the length of the sensors array is longer than 2
if (sensors.length > 2) {
//set each variable to its given value from the potentiometer
sensorVal1 = sensors[0];
sensorVal2 = sensors[1];
sensorVal3 = sensors[2];
}
}
myPort.write('x');
}

view raw

lab8 processing

hosted with ❤ by GitHub

 

 

Project 2 Proposal

For Project 2 I decided to make a boxing bag that measures acceleration. Because I am going to make it stand up and be moveable/repositionable, this device will be able to be used for a wider range of punches, kicks, knees, and elbows than a bag that hangs down. It will be small enough so that someone could hold it steady while another person hits it. Another option would be to clamp it to a table (for round kicks, teeps, push kicks, and body punches) or attach it to the floor (for low kicks). This gives the device much more versatility than other devices that measure punch acceleration or force. As the device can only measure acceleration if it is struck from one direction, I will use the laser cutter to create a sign with arrows to inform the user which way to hit the device. This will also force the use to move around the device and work on their footwork as they throw different shots (ie. a round kick cannot be thrown from the same angle as a jab on this device).

I will I am also going to make a game in processing that requires the boxer to obtain certain accelerations. The closer they are to the given acceleration the better. This game will help the user learn to control their punches and kicks. It will also help them learn which of their shots are the most powerful and which are the weakest.
Timeline:

Week 1 4/6: Order parts from Spark Fun and submit proposal

Week 2 4/13: Complete wiring and Arduino Coding and begin enclosure

Week 3 4/20: Complete enclosure and laser cut sign

Week 4 4/27: Begin programing game in processing

Week 5 5/4: Finish programing game in processing and fix inevitable problems

Materials:

– accelerometer

– Arduino Uno

– wire

– solder

– square wooden rod

– spring hinge

– wood for base

– thin wood for sign

– noodle

Screen Shot 2017-04-05 at 12.45.37 PMScreen Shot 2017-04-05 at 12.45.47 PM

 

Lab 7 Response

 

For lab 7 we learned how to use a DC motor, stepper motor, and h bridge. For the first part we used a DC motor. A DC motor has “two terminals, and when you apply direct current to one terminal and ground the other, the motor spins in one direction. When you apply current to the other terminal and ground the first terminal, the motor spins in the opposite direction” (Igoe 2014). A stepper motor has a precise position by turning a particular number of steps/pulses. I did not find this lab to be particularly difficult. The schematics were fairly easy to follow (Figures 1 and 2). After determining that there was supposed to be a lot of connections between the h bridge and ground, the circuitry was fairly simple (Figures 3 and 4). For the coding aspect of this lab I used some online resources to figure out what to do (Figures 5 and 6). The SparkFun website had a lot of useful information on it for how to code motors. Below you will find all of my documentation as well as working videos of my circuits.

lab7-01
Figure 1: Part 1 schematic
lab7-03
Figure 2: Part 2 schematic
17474796_10208764261969252_1441454670_n
Figure 3: Part 1 wiring
17495556_10208764257609143_2123191942_n-1
Figure 4: Part 2 wiring
Screen Shot 2017-03-23 at 11.33.09 AM
Figure 5: Part 1 code

i

Screen Shot 2017-03-23 at 11.33.22 AM
Figure 6: Part 2 code

 

 

 

Project 1 Response

Summary of Project:

For Project 1 I originally planed on making a “study buddy” that acted as a timer (with a stepper motor that spins when the timer ends) and a sound sensor. However, I was unable to figure out how to code the timers into the system so I had to change my plans a little. My new plan was to make a sound sensing book that could go in a classroom, library, or study space and alert the user if the space is too loud.

I started with the hardware. In order to create this sound sensing book I used SparkFun Sound Detector, an Arduino Uno, three LEDs (1 red, 1 yellow, and 1 green), and a mini breadboard. The main obstacle I had when I was creating the circuit was when I accidentally created a short circuit. I thought the problem was with the Ardunio Uno at first resulting in the use of several other Ardunios before I determined the problem was with the soldering. I ended up having to re-solder the entire project. This ended up being okay because I had not color coded the wires the first time. After re-soldering the project with color coded wires it was much easier to follow the circuit. Also, I had originally soldered the LEDs tight to the protoboard and they could not reach through the spine of the book so I made the much loser the second time.

Next, I did the code. The sound detector has three output options: audio, envelope, and gate. As I was unsure which of these outputs would be the correct one to use, I decided to wire all of them in so that I could test different options with the code. I needed an output that would return how loud it was with a range of values. I would then assign three different ranges from quiet, shown in a green LED, to medium, a yellow LED, to loud, a red LED. I found that I needed to use the envelope output because it returns the amplitude of the sound. In the serial monitor this shows up as a range of values between about 250 and 375. I then coded a series of if else statements to turn on and off the LEDs based on the envelope value. I also decided to leave in the hardware for the other outputs as well just in case I needed to used them later in the project.

Finally, I moved on to the enclose. I found a large book at a consignment store with the intent of hollowing it out entirely to make room for the electronics. I used a box cutter to cut out the page but I found that hollowing out a book is surprisingly difficult. After about two hours I had only succeeded in removing about .75in of pages. At this point I decided that, as there was enough space to place all my hardware inside the book, I had removed enough pages. I then used a drill to make holes for the LEDs in the spine of the book and removed small sections of the hollowed out pages to make holes for a power cord and for the sound sensor to stick out of the book a little bit.

The end project actually turned out better than my original proposal (in my opinion). It easily fits into the environment that it is made for. On my own desk it blends in nicely with my other books and it does not take up any extra space.

Schematic of Circuit:

Screen Shot 2017-03-17 at 4.08.07 PM

Photos of the Project Through Different Phases:

17391891_10208718545386366_172026255_n
My original idea on a breadboard. The sound sensor here is functioning but the stepper motor is not.
17360670_10208718546306389_1416387166_n
Taking the circuit off the breadboard. This circuit is a short circuit.
17355122_10208718546546395_283717986_n
Here I have re-soldered the circuit using color coded the wires (red=power, yellow=ground, blue=input). The other Arduino is because mine was not working.
17355086_10208718546586396_210033639_n
These are all the other Arduino’s I tried before I figured out the problem was just from the short circuit and not from the Arduino itself.
17360920_10208718546066383_593979872_n
My original book before I hollowed it out and inserted the circuit.
16651639_10208718545666373_195952973_n
My book after 1 hour of hollowing.
17361375_10208718546426392_1108368091_n
1 light inserted into the spine of the book. The LEDs are not tight on the protoboard so that they can reach though the spine.
17391939_10208718546666398_722150807_n
Everything is inside the book and functioning properly.

Code:


#define PIN_GATE_IN A0
int ledPinGreen = 10;
int ledPinYellow = 11;
int ledPinRed = 12;
void setup() {
Serial.begin(9600);
// sound detector setup
pinMode(ledPinRed, OUTPUT);
pinMode(ledPinYellow, OUTPUT);
pinMode(ledPinGreen, OUTPUT);
pinMode(PIN_GATE_IN, INPUT);
// Display status
Serial.println("Initialized");
}
void loop() {
// sound detector loop
int value;
// Check the gate input
value = analogRead(PIN_GATE_IN);
// Convert gate value into a message
Serial.print("Value: ");
if (value <= 315) {
digitalWrite(ledPinGreen, LOW); //LOW turns on the LEDs instead of HIGH
digitalWrite(ledPinRed, HIGH); //HIGH turns of LEDs
digitalWrite(ledPinYellow, HIGH);
Serial.println(value);
} else if ( (value > 315) && ( value <= 335) ) {
digitalWrite(ledPinYellow, LOW);
digitalWrite(ledPinGreen, HIGH);
digitalWrite(ledPinRed, HIGH);
Serial.println(value);
} else if (value > 335) {
digitalWrite(ledPinRed, LOW);
digitalWrite(ledPinGreen, HIGH);
digitalWrite(ledPinYellow, HIGH);
Serial.println(value);
}
// pause for .3 seconds
delay(300); //This makes the transistions between LEDs smooth
}

view raw

Project 1

hosted with ❤ by GitHub

Photos of Finished Project:

IMG_9985IMG_9995

Video of Finished Project:

 

Lab 6 Response

 

For Lab six we learned how to use servomotors and speakers.

For the first part of this lab we had to build a circuit with a servomotor. The schematic to this is seen in Figure 1. The servomotor is controlled by a potentiometer (Figure 2). After comping the circuit, I began working on the code which was a bit more complicated (Figure 3). Initially the motor was only turning 90 degrees instead of 180. Once I figured out to map the motor from 523 to 1023 instead of 0 to 1023, based on the output from the print function, the motor rotated 180 degrees.

screen-shot-2017-02-27-at-3-01-39-pm
Figure 1: Schematic of Circuit 1
17077990_10208583128281023_75735732_n
Figure 2: Circuit 1
Screen Shot 2017-02-27 at 7.37.51 PM.png
Figure 3: Circuit 1 code (NOTE: GitHub would not let me upload so I just took a screen shot)

For the second part of this lab we had to create a circuit that utilized a speaker. The schematic for this circuit can be found in Figure 5. Once I figured out what a photoresistor is and what it does, this part of the lab was fairly simple. The wiring of the circuit was pretty straight forward (Figure 6). Additionally, the code for this part was much simpler than the code for the first part of this lab (Figure 7).

screen-shot-2017-02-27-at-3-01-49-pm
Figure 5: Schematic of Circuit 2

 

 

 

 

https://gist.github.com/anonymous/23b35216936df9699c8798b024fabab7.js

17028796_10208583128321024_491473183_n
Figure 6: Circuit 2
screen-shot-2017-02-27-at-7-47-59-pm
Figure 7: Code for Circuit 2

For my creative enclosure I decided to make something that I think a lot of people in our class can relate to: a Senioritis-O-Meter. I used the servomotor from the first part of the lab to create a dial that spins when the potentiometer is rotated. The dial has a range of senioritis feelings (Figure 9). I used a raisin box and card stock to create the enclosure. It was a bit difficult to get all the wires and boards inside the enclosure (which is good to know for my project as far as determining what size PVC pipe to get). I placed the controls on the back so that it would not interfere with the design on the front (Figure 10). The end result is fairly amusing (at least to me anyways…).

17006158_10208583128441027_1341646896_n
Figure 9: Dial for Senioritis-O-Meter
17012419_10208583128401026_1401369711_n
Figure 10: Finally got all the components inside the box
17078059_10208583128561030_1081280153_n
Figure 11: Back of the Senioritis-O-Meter

Project 1 Proposal

Description: For Project 1 I want to make an interactive “Study Buddy” that can keep track of time and alert you when it is time to take a break and get back to work. To turn on Study Buddy, you would push a switch on his back. During study time, Study Buddy would display the sound level with three LEDs. Red would indicate that it is too loud for studying, yellow would indicate that it is getting too loud, and green would indicate that it is quiet enough to study. At the end of study time, Study Buddy’s head would spin. To start break time you would squeeze Study Buddy’s body. At the end of break time, Study Buddy’s head would spin again alerting you that it is time to start studying again. Squeezing the body again would begin the study timer and resume the sound sensor with LEDs.

For example, if you want to take a 5 min break every hour then Study Buddy would keep track of the time for you and after 55 min of studying his head would spin letting you know that it is time to take a break.

To turn Study Buddy on I will use a switch. To spin Study Buddy’s head I will use a stepper motor and motor driver. To stop spinning Study Buddy’s head I will use input from a pressure sensor. The sound alerts will come from a sound sensor and 3 LEDs. To connect all of these components together i will use wire and solder. To program this project I will use an Arduino Uno microcontroller.

Parts List:

  • switch
  • red, yellow, and green LEDs
  • stepper motor
  • motor driver
  • pressure sensor
  • sound sensor
  • Arduino Uno
  • wire
  • solder

 

screen-shot-2017-02-14-at-12-17-38-pm

Lab 5 Response

In this lab we explored a variety of variable resistors. For the first circuit we used a potentiometer to dim an LED (Figures 1 and 2).

screen-shot-2017-02-13-at-2-45-03-pm
Figure 1: Schematic of first circuit
16735916_10208475416668300_181292680_n
Figure 2: First circuit wiring only

Below you can my code and a video of the working circuit.


#define lego 9
int analogValue = 0;
int brightval = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(lego, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
analogValue = analogRead(A0);
brightval = analogValue/4;
analogWrite(lego, brightval);
Serial.println(analogValue);
}

view raw

lab 5 Part 1

hosted with ❤ by GitHub

For the second part of this lab we had to make a circuit that used two different variable resistors. One of my variable resistors was a pressure resistor and the other was a flex resistor (Figures 3 and 4).

screen-shot-2017-02-13-at-2-50-42-pm
Figure 3: Second circuit shematic
16735941_10208475417788328_1744328808_n
Figure 4: Second circuit wiring only

In order to get the full range of the variable resistor, I used the map() function. This made the LEDs have a wide range of brightness values. Below are my code and a video of my second circuit.


#define lego 9
#define red 10
int analogValue = 0;
int analogValueB = 0;
int brightval = 0;
int brightvalB = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(lego, OUTPUT);
pinMode(red, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
analogValue = analogRead(A0);
brightval = map(analogValue, 100, 300, 255, 0);
analogWrite(lego, brightval);
Serial.println(analogValue);
analogValueB = analogRead(A1);
brightvalB = analogValueB/4;
analogWrite(red, brightvalB);
Serial.println(analogValueB);
}

view raw

gistfile1.txt

hosted with ❤ by GitHub

The most confusing part of this lab, in my opinion, was the coding. The map function was difficult to figure out but it was effective when completed. I hope to use some of these variable sensors in my Project 1 specifically the flex sensor. I think it is a pretty interesting way to input information into a system.

Lab 4 Response

For this lab we had to learn how to use an arduino and Processing. Figure 1 shows my diagram of the circuit that I drew on Illustrator so that it would be extremely clear.

screen-shot-2017-02-08-at-10-52-34-pm
Figure 1: Schematic of circuit

Figure 2 shows my attempt at setting up the switch. I later figured out that the circuit had to go through the power and ground sections of the breadboard.

16700188_10208440503875502_1968473053_n
Figure 2: Setting up the switch

Figure 3 shows my completed circuit. Next I coded the arduino to switch from one light to another when the button is clicked.

16684825_10208440504355514_1228664091_n
Figure 3: Completed circuit

My processing code and a video of my working circuit and code can be found below:


int ledPin = 4;
int ledPinTwo = 6;
int inPin = 2;
void setup() {
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(inPin) == LOW) {
digitalWrite(ledPin, HIGH); // sets red the LED on
digitalWrite(ledPinTwo, LOW); // sets the yellow LED off
} else {
digitalWrite(ledPin, LOW); // sets red the LED off
digitalWrite(ledPinTwo, HIGH); } // sets the yellow LED on
}

view raw

Lab4.ino

hosted with ❤ by GitHub

The yellow light is quite dim because of the 220Ω resistor outlined in the lab requirements. A lower resistor value would have allowed this LED to be brighter.

I found this project extremely confusing because I have never worked with Arduino and I have not used processing in several years. But I did get a working circuit eventually. My process included a lot of guess and checking.

Note on the reading Speculative Everything:

I did understand this reading. I just don’t agree with it. I understand the concept of designing for the preferable future and how that makes sense in theory. It makes sense to design for the future you want to achieve however, it does not make sense, to me, to ignore half of the possibilities for the future. I think it is important to think about the un-preferable future when you are designing because that is just as likely to happen as the preferable future. Additionally, as someone who studies culture and archaeology in particular, it actually isn’t that difficult to imagine how our culture is going to change as Dune and Raby claim. The details of cultural change may be hard to determine but generalities and various scenarios can certainly be made. For example, back my example of climate change, I can soundly predict that climate change will cause mass migration which will cause over crowding which will cause warfare. I can predict this because that is what has happened throughout the history of our species when the climate has changed. I can predict that it will be significantly worse this time because the number of individuals in our species is MUCH higher than it has ever been meaning the overcrowding will be more severe. The warfare will obviously be more devastating because of the technological advances made in the last roughly 200 years. So if I was designing for the future I would want to consider this outcome, even though it is not at all preferable, because that is just as likely to occur as the preferable outcome. And if/when the un-preferable future occurs it would be beneficial if someone had considered what that reality would be like and what designs need to accommodate that future as well as the preferable one.