Stupid Pet Trick: Boxing Trainer, setup

I’m preparing my project the Stupid Pet Trick. First I want to get the circuit ready before building the interface (the part I’m most nervous about).

My plan is to use two piezo elements to detect knocks on the focus mitts. I will be using 8 LED lights for indicators:

The Rounds
1. Round 1
2. Round 2
3. Round 3
The Punches
4. Jab
5. Cross
The Feedback
6. Nope
7. Not Bad
8. Knock Out

If I have time, I will also include a switch for making the game lefty or righty.

Stupid Pet Trick Ideas

For my stupid pet trick assignment, I have two ideas I would like to discuss in class.

The first is a boxing trainer. I will hook up two Peizo elements, one to each focus mitt. The output will  be a box with some words cut out. There will be lights behind the words that will light up depending on the output. The Arduino will keep track of rounds, punch combinations, and amount of pressure received from the punch.

The game will look something like this:

Round one begins.
Arduino spits out a random combination of jabs and crosses (up to 4 punches total), always beginning with a jab (because in training and in fighting, you would never start a combination with a cross).
Lights turn on to show the combination to the player.
The player then punches that combination on the focus mitts.
The output lights up to tell the player whether they were successful or failed.
There’s also an output for a successful combination If the player failed, the same combination is displayed; the round continues.
If the player successfully completes the combination, the next round starts.
There are three rounds. Round 2 has a combination of 5 punches. Round 3 has a combination of 7 punches.
There’s a switch on the display for choosing lefty or righty. Choosing lefty will switch the sensors for a jab and a cross.

The second idea is a contraption that attaches to your feet and it will measure how much pressure is applied to your step. The output is a series of lights. If all the lights light up, your step is too hard and the neighbors downstairs are grumbling. This is similar to the Strength-o-meter.

Strength-o-meter with Arduino and LEDs

There are 5 red LEDs that light up progressively and one by one as you press on the sensor. Here is the code but it is not working as expected. They don’t dim or turn off when you let go. I think I need to nest the if-statements. I need to keep working on this.

int pressureVal = 0;
int mappedVal;
float voltageIn =0;

const int ledPin = 9; // pin that the LED is attached to
const int ledPin2 = 10;
const int ledPin3 = 11;
const int ledPin4 = 6;
const int ledPin5 = 5;

void setup(){
//this opens a debug window, that speaks at 96bits per second
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
pinMode(ledPin5, OUTPUT);
}

void loop(){
pressureVal = analogRead(0);

Serial.print("\n Potentiometer Value = ");
Serial.print(pressureVal);

// goes from 1023 to 0
// we can set mapped values so they mean more to us
mappedVal = map(pressureVal,0, 1023,0, 255);
Serial.print("\n Mapped Value = ");
Serial.print(mappedVal);

//reset the RDC, good practice, 10 ms
delay(10);

if (mappedVal > 255 / 5){
analogWrite(ledPin, mappedVal);
}
if ( mappedVal > 255 * 2/5 ){
analogWrite(ledPin2, mappedVal);
}
if ( mappedVal > 255 * 3/5 ){
analogWrite(ledPin3, mappedVal);
}
if ( mappedVal > 255 * 4/5 ){
analogWrite(ledPin4, mappedVal);
}
if ( mappedVal == 255 ){
analogWrite(ledPin5, mappedVal);
}
}

Analog Input with Arduino (P Comp Lab)


This is the lab using analog inputs. I used a potentiometer to control the brightness of the LED.

Here’s the code:
const int ledPin = 9; // pin that the LED is attached to
int analogValue = 0; // value read from the pot
int brightness = 0; // PWM pin that the LED is on.

void setup(){
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}

void loop(){
//read analog value
analogValue = analogRead(A0);
brightness = analogValue / 4;
analogWrite(ledPin, brightness);
Serial.print(analogValue + "/n");
}

Introducing the SmartShelf for Refrigerators and the People Who Love Leaving Empty Containers in the Them

Fantasy Device: smart shelf for fridges

How it works:

Continue reading

Sensor Walk

Motion Sensor Light outside the building

Paying attention to the sensors capturing information throughout my day, I found a few things.

At home, there light sensors in MacBook Pro so that when the light in the room changes, the keyboard and backlight dim or brighten accordingly. In the hallway and near the kitchen, we have carbon monoxide sensors. For the television, we have remote controls for the Roku Player and the TV itself both with infrared sensors.

As I leave the apartment, I pass the motion sensor light outside my door. It turns on as you approach it. It’s really handy when I’m coming home and it’s dark out. I also pass my neighbor’s motion sensor light across the street. Theirs is set at a much higher sensitivity than ours so both lights come on when our is activated.

A couple more sensors I run into are the sensors in the elevator that prevent the doors from closing on someone or something. If the doors are held open long enough, the elevator will begin to beep loudly. Also at the Brooklyn Public Library, the bathrooms are fitted with automatic toilet flushing when you stand, automatic hand dryers, and automatic faucets.

Finally, where I encountered the most sensors happen to be in my pocket. My Motorola Droid has GPS and a magnetometer to sense coordinates and direction, an accelerometer and pedometer to sense speed, and a tilt sensor used in games like Abduction. There’s a light sensor that adjusts the backlight and the keyboard brightness; it also can determine whether I need the flash turned on for the camera. And of course there are touch sensors for the screen.

What is physical interaction?

I have to say that I agree with Crawford in his definition of interaction. He describes interaction as two actors taking turns listening, thinking, and speaking. In computing terms, this means inputting, processing, and outputting. He also talks about confusing interaction with reaction, and that reactions happen when there is no thought involved. Like when the light turns on in the refrigerator, or when he jumped out the way of a falling branch, he argues that these are examples of reactions.

One could also argue that Crawford jumping out of the way of the branch can be called an interaction:

input = seeing the falling branch
process = hmmm, what to do
output = jump out of the way

We couldn’t do the same break down of the refrigerator’s light turning on. Therefore, I’d like to agree with Crawford again, because there is no process involve. Either the switch is on or it is off. Either the electricity is running through there or it is not. It is binary. And there is nothing there to compute.

I think that good interaction is defined by smart thinking or smart processing. For example, say I was really craving some McDonald’s one day. I type into a Google search bar “mcdonalds.” Not only does it bring up McDonlad’s homepage as the top option, but it shows me a map of my area with the closes restaurants, their address, their phone number, and a star rating of each restaurant. I gave me all that information with just one word that inputted in the search bar. I didn’t explicitly say I wanted to eat at the restaurant, or where I lived, but the algorithm took information from past searches, from my GPS location or past location searches (and God knows what other inputs it used with my knowing) and was able to compute them into a list that answers my need pretty closely. That is good interaction, I think.

The “Talk to Me” exhibit at the MoMA looks at how human and things communicate. How do things get information from people, how people give information to things, how things try to give us information, and ultimately how people use things to give other people information. The pieces in the exhibit therefore weren’t necessarily interactive by our definition. There was a significant portion of the exhibit that was dedicated to infographics, like Nick Feltron’s Annual Reports. They were interesting ways of displaying information and for getting a story across, but I wouldn’t say that they were interactive.

Selfish Teddy

Teddy love his stuffed elephant Paco and he feels very possessive about him. He hates to share. If you take Paco away, watch out!

Here’s the code that produced this:

const int buttonPin = 2; // the number of the pushbutton pin
const int ledRightEye = 9; // the number of the LED pins
const int ledLeftEye = 10;
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
int buttonState; // variable for reading the pushbutton status

void setup() {
pinMode(ledRightEye, OUTPUT);
pinMode(ledLeftEye, OUTPUT);
pinMode(buttonPin, INPUT);
}

void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

if (buttonState == HIGH) {
// set the brightness of the pins:
analogWrite(ledRightEye, brightness);
analogWrite(ledLeftEye, brightness);

// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;

// reverse the direction of the fading at the ends of the fade:
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
}
// wait for 30 milliseconds to see the dimming effect
delay(3);
}else{
analogWrite(ledRightEye, 0);
analogWrite(ledLeftEye, 0);
}
}

But before I could even get to that I had to figure out a few things. Continue reading

Proudly powered by WordPress
Theme: Esquire by Matthew Buchanan.