A Short Week

October 16th, 2009 by Lizabeth Arum Leave a reply »

I finished my soft circuit. Now when you pet it it purrs and flashes its eyes. I added a homemade capacitance sensor and a vibrating motor. I started with this information, but ended up using Paul Badger’s CapacitiveSense003 library which worked great. My circuit uses a 2.2MΩ resistor to connect pins 2 and 5 and the sensor itself is made of conductive frabric from LessEMF. The piece came from the Fabric Sample Set (Cat. #SAMPLER) and I cut in in half and connected it to pin 2 through conductive thread and a 22 AWG hookup wire.

Here’s the code:

#include
const int purr = 9; // pin that the LED is attached to
const int led = 3; // pin that the LED is attached to
const int eye1=10;
const int eye2=11;
const int mouth=4;
boolean purring=false;
boolean openEyes=false;
CapSense cs_1_2 = CapSense(1,2);

void setup(){
pinMode(purr, OUTPUT);
pinMode(led, OUTPUT);
pinMode(eye1, OUTPUT);
pinMode(eye2, OUTPUT);
pinMode(mouth, INPUT);
pinMode(led,OUTPUT);

pinMode(purr,OUTPUT);
digitalWrite(purr, LOW);
Serial.begin(9600);
}

int touch_sensor(){
long start = millis();
long total1 = cs_1_2.capSense(30);
if (total1<02){
return 1;
}else{
return 0;
}

/*Serial.print(millis() - start); // check on performance in milliseconds
Serial.print("\t"); // tab character for debug windown spacing

Serial.print(total1); // print sensor output 1
// print sensor output 3

delay(10); */
}

void loop(){
int touch=touch_sensor();
if (digitalRead(mouth)){
openEyes=true;
}
else{
openEyes=false;
}

if(!touch){
if(purring){
for(int i=255;i> 0;i-=10){
analogWrite(purr,i);
delay(20);
}

purring=false;
}
else{
analogWrite(purr,0);
openEyes=false;
}
digitalWrite(led,LOW);

}
else{
purring=true;
digitalWrite(led,HIGH);

analogWrite(purr,200);
openEyes=true;

}
if (openEyes){
for(int i=65;i<255;i+=10){
analogWrite(eye1,i);
analogWrite(eye2,i);
delay(10);
}
for(int i=255;i>65;i-=10){
analogWrite(eye1,i);
analogWrite(eye2,i);
delay(10);
}}else{
analogWrite(eye1,0);
analogWrite(eye2,0);
}
}


Students worked on their own soft circuits this week with different enthusiasm levels. Students used to working through labs, but not producing pieces, enjoyed this assignment far less than those who like to make crafts. Still, I believe introducing students to conductive thread and conductive fabrics will help them construct later projects.

We did run into a few glitches this week as well. One student plugged 12V into the freeduino. The 12V plug was used in our first experiments, and I had mentioned that the freeduino could be powered by the USB or a battery. I had extra Atmega chips and, apart from the chip, the board seemed fine.

Another student had trouble finding the usbserial port. At first I thought that the FTDI Drivers for Intel Macs was not installed, but then he moved to another computer with the same problem. His circuit seemed fine. In the end, it turned out that the USB cable was to blame. As soon as we switched cables, everything worked. It was a brand new cable and it surprised both of us that this was the source of the problems.

IPhone programming is going a bit slower than I anticipated. The class was still working on the second version of the Browser assignment this week. In the meantime, I came up with a way for students to create web pages to document their work:


Background-color:

Application name:


Notes:


File Name:


Code:

 

The Blender class is going well. Students have started working with armatures and materials. They have made short quicktime movies of the experiments and everyone is still engaged in the process.

Advertisement

Leave a Reply