Archive by Author
Image

Final Project – Wine Wall – Tyler Cook & Casey Henrichs

19 Dec

photo photo (3) photo (1)Final Project - Wine Wall - Tyler Cook & Casey Henrichs

Our project used RFID technology to interact with a wine rack. There were two levels of interaction; the LEDs and the displayed text. Ideally we had planned to tag each bottle of wine with an RFID tag and then have those tags display a text when scanned pertaining to that type of wine. The information was a broad definition of a Riesling or Shiraz wine giving information about the grapes, history, and food pairings. This would allow the same tag to be reapplied to another bottle without it being the exact brand of wine.

The ceramic tiles which held the wine bottles were then fitted with LEDs. The idea developed to a point where scanning the tag would interrupt the LED loop and turn certain tile’s LEDs off. The idea behind this was that empty tiles would be dark until a bottle replaced to old one.

For the actual project budget constraints led to a few alterations in the design. Each bottle of wine contained an RFID tag. Due to the financial restraints of the project we were only able to display the piece with 5 wine bottles. These 5 tiles then had LEDs wired separately to transistors on the arduino board to stop the current when that particular tag was scanned. Unfortunately not all of the transistors were compatible and only 2 where able to be displayed with the correct changes in lighting.

Another issue we faced was getting the desired text to be read through processing. Processing would not display character strings received from Arduino. Our way around this was to type the phrases directly into processing or into Firefly. This was not ideal as it did not sync to the scanning of the tags. The information appeared though with the click of the mouse. The other problem with Firefly is that the tool used to display text only allows three inputs. This meant that the final project had two wine bottle tiles that had LEDs turning off when the RFID tags were scanned and three that projected a text when scanned.

Here is the code we used:

// RFID reader for Arduino
// Wiring version by BARRAGAN
// Modified for Arudino by djmatic

int val = 0;
char code[10];
int bytesread = 0;

void setup() {

Serial.begin(2400); // RFID reader SOUT pin connected to Serial RX pin at 2400bps
pinMode(2,OUTPUT); // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin
//pinMode(5,OUTPUT); //Send to second arduino
digitalWrite(2, LOW); // Activate the RFID reader
digitalWrite(5,HIGH); //LEDs on in tiles
digitalWrite(3,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(9,HIGH);
digitalWrite(11,LOW);
digitalWrite(12,LOW);
digitalWrite(13,LOW);
}

void loop() {

if(Serial.available() > 0) { // if data available from reader
if((val = Serial.read()) == 10) { // check for header
bytesread = 0;
while(bytesread 0) {
val = Serial.read();
if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading
break; // stop reading

}
code[bytesread] = val; // add the digit
bytesread++; // ready to read next digit
}
}
if(bytesread == 10) { // if 10 digit read is complete
//Serial.print(“TAG code is: “); // possibly a good TAG
Serial.println(val); // print the TAG code
}
if (val==65){
Serial.println(“Shiraz originated in the Rhône region of France.”);
Serial.println(“Wines made from Syrah are often powerfully flavoured and full-bodied. While there is a wide range of aromas, two that are often noticed in Shiraz wines are that of blackberry and pepper.”);
Serial.println(“Shiraz is a heavy red with big bodied flavor and therefore pairs well with meets such as beef and lamb.”);
digitalWrite(5,LOW); // LEDs off when scanned
digitalWrite(11,HIGH);
//delay(500);
//digitalWrite(5,LOW);
}
if(val==53){
Serial.println(“Malbec originated in the Bordeaux region of France and has spread to South America.” );
Serial.println(“Wines made from Malbec grapes have hints of ripe fruits and earthy greens.”);
Serial.println(“Malbec is a medium bodied red wine pairing well with red meats and dishes of Mexican, Cajun, or Italian cuisine.”);
digitalWrite(6,LOW);
digitalWrite(12,HIGH);

}
if(val==48){
Serial.println(“Rosé wine originated in the Provence region of France which was settled by ancient Greeks around 600 BC.”);
Serial.println(“Wines of this sort rely on the skins of the grapes to color the wine but remove them before they add a harshness to the flavor.”);
Serial.println(“Since rosés are made with a variety of grapes the flavor ranges from light and fruity to a darker heartier wine.”);
Serial.println(“Due to it’s wide variety of blends a rosé pairs well with an endless possibility of foods.”);
digitalWrite(3,LOW);
}
if(val==50){
Serial.println(“Sauvignon blanc is a green grape that originated in the Bordeaux region of France”);
Serial.println(“The grapes were named after the French word for wild, sauvage, and produce wines with flavors ranging from zesty lime to a flowery peach. “);
Serial.println(“This herbaceous wine pairs well with simple greens and herbs.”);
digitalWrite(7,LOW);
digitalWrite(13,HIGH);
}
if(val==52){
Serial.println(“Riesling originated in the Rhine region of Germany.”);
Serial.println(“Riesling wines tend to exhibit notes of apple and tree fruit.”);
Serial.println(“Noble rot is a term used when Riesling grapes were harvested after a harsh freeze creating a much sweeter wine.”);
Serial.println(“Sweet riesling wines pair well with dessert as they are semi-carbonated like dessert champagnes.”);
digitalWrite(9,LOW);
}

bytesread = 0;
digitalWrite(2, HIGH); // deactivate the RFID reader for a moment so it will not flood
delay(1500); // wait for a bit
digitalWrite(2, LOW); // Activate the RFID reader
}
}
}

// extra stuff
// digitalWrite(2, HIGH); // deactivate RFID reader

Video

Homework 05 – Arduino and Processing – Casey Henrichs

14 Nov

Here I changed the background color as well as changed the “stroke” values to include the “xPos” input which gave a colored gradient in the processing window.

This is the processing code run with a potentiometer.

import processing.serial.*;

Serial myPort; // The serial port
int xPos = 1; // horizontal position of the graph

void setup () {
// set the window size:
size(1000, 300);

println(Serial.list());// List all the available serial ports
myPort = new Serial(this, Serial.list()[0], 9600); // don’t generate a serialEvent() unless you get a newline character:
myPort.bufferUntil(‘\n’);

background(50); // set inital background:
}
void draw () {

}

void serialEvent (Serial myPort) {// get the ASCII string:

String inString = myPort.readStringUntil(‘\n’);

if (inString != null) { // trim off any whitespace:

inString = trim(inString);// convert to an int and map to the screen height:

float inByte = float(inString); //inbyte is storing all inpute data
inByte = map(inByte, 0, 1023, 0, height);//map incomming value to height of screen, fourth value here is 0-300

//can add ellipse command determined by the potentiometer, to get it to move all the way across the screen find the “size” (1000) above and [multiply by three due to the “inbyte scale” already intact]
stroke(150, xPos, xPos);// draw the line: changing the value here can change color
line(xPos, height, xPos, height – inByte);

// at the edge of the screen, go back to the beginning:
if (xPos >= width) {
xPos = 0;
background(120);
}
else {
// increment the horizontal position:
xPos++;
}
}
}

Image

Homework 04- Combine Circuits – Casey Henrichs

5 Nov

Homework 04- Combine Circuits - Casey Henrichs

I tried uploading a video this week but youtube is not accepting it as an upload.
Here I used the thermin sound and button to flash an LED. Reaching for the button affects the light sensor and then an LED is set to blink with a delay.

(having difficulty with the blinking delay)

int LED = 13;
int Button = 6;
int previous_value = 0;
int value = 0;
int state = 0;
int blue = 5;

void setup () {
pinMode (LED, OUTPUT);
pinMode (LED, INPUT);
Serial.begin (9600);
pinMode (blue, OUTPUT);
}

void loop () {
digitalWrite (blue, HIGH);
delay (3);
digitalWrite (blue, LOW);
delay (5);
digitalWrite (blue, HIGH);
delay (2);
digitalWrite (blue, LOW);
delay (5);
digitalWrite (blue, HIGH);
delay (2);
digitalWrite (blue, LOW);
delay (5);
digitalWrite (blue, HIGH);
delay (2);
digitalWrite (blue, LOW);
delay (5);
value = digitalRead (Button);

if ((value ==HIGH) && (previous_value == LOW)) {
state = 1 – state;
delay (1);
}
{
int sensorReading = analogRead(A0); //read thesensor
Serial.println(sensorReading); //print the sensor reading to serial monitor, ln means it starts a new line at intervals
int thisPitch = map(sensorReading, 7, 90, 120, 800); //map the analog input range to desired output
tone (9, thisPitch, 10); // play the pitch
delay (1); // delay in between reads for stability
}

previous_value = value;

if (state == 1) {
digitalWrite (LED, HIGH);
} else {
digitalWrite (LED, LOW);
}
}

Video

Homework 03 – LED/Servo Motor Controlled by Variable Resistor – Casey Henrichs

31 Oct

WP_20131029_013

The servo motor powered by light sensor.

The greater the “val map” the further the rotation. Change 179 value to 1024 for greater rotation.

#include <Servo.h>

Servo myservo;

int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin

void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}

void loop()
{
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val);
delay(15);
}

I used the light sensor to fade an LED in and out. It was interesting to play around with the “analogWrite” value divided by. The greater the number the less variation seen in brightness.

const int LED = 9;

int val = 0;

void setup () {
pinMode (LED, OUTPUT);
}

void loop () {
val = analogRead (0);
analogWrite (LED, val/2);
delay (10);
}

Video

Homework 02 – LED and Sound with Potentiometer – Casey Henrichs

29 Oct

int red = 3; //setting red led variable
int blue = 5; //setting blue led variable
int green = 6; //setting green led variable
int pot = 0;

void setup() {
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(blue,OUTPUT);
}

void loop () {
pot = (analogRead(A0));
digitalWrite(red, HIGH);
delay(pot);
digitalWrite(red,LOW);
delay(pot);
digitalWrite(red, HIGH);
delay(pot);
digitalWrite(red,LOW);
delay(pot);
digitalWrite(green, HIGH);
delay(pot);
digitalWrite(green,LOW);
delay(pot);
digitalWrite(blue, HIGH);
delay(pot);
digitalWrite(blue,LOW);
delay(pot);
digitalWrite(blue, HIGH);
delay(pot);
digitalWrite(blue,LOW);
delay(pot);
digitalWrite(green, HIGH);
delay(pot);
digitalWrite(green,LOW);
}