A reader responds…

According to an anonymous blog reader (thanks!), the automated laundry system is already in the works.

The first step in making the automation easier was replacing the clothing tags with tags that are more computer-friendly, removing the need for us humans to manually sort clothes.

Why hadn’t I thought of that?  Washable computer-readable clothing tags…cool!

What will they think of next?

  • Clothes that automatically adjust to your changing body shape?
  • Clothes that help maintain your posture while seated/standing?
  • Clothes that heat/cool you?
  • Clothes that monitor your body condition?
  • Clothes that act like a good friend, hugging you when you need a good hug, giving you the Heimlich maneuver when you choke on food, reminding you to smile politely at your in-laws, stopping you from chewing your nails?

Today’s Arduino programming lesson

The last update on my Arduino-based yard art sculpture showed the addition of a servo to a circuit with eight LEDs.

Today, I want to figure out if I can set the servo and LEDs to activate only after a PIR (passive infrared) motion sensor has been triggered.

The PIR motion sensor I’ll use for this experiment is sold through Radio Shack (product number 276-135) and available online at Parallax, Inc.  (product number 555-28027, rev B).

Via info at Parallax, here’s how to wire the sensor to your Arduino (note: I’m using digital port 12, not 2 as shown):

PIR-6

The question for me is how complex/sophisticated do I want the code for the yard art sculpture to be?  For example, let’s look at two code samples, a simple one and one that’s more sophisticated.

First, the simple code from here:

/*
 * PIR sensor tester
 */

int ledPin = 13;                // choose the pin for the LED
int inputPin = 2;               // choose the input pin (for PIR sensor)
int pirState = LOW;             // we start, assuming no motion detected
int val = 0;                    // variable for reading the pin status

void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare sensor as input

  Serial.begin(9600);
}

void loop(){
  val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    digitalWrite(ledPin, HIGH);  // turn LED ON
    if (pirState == LOW) {
      // we have just turned on
      Serial.println("Motion detected!");
      // We only want to print on the output change, not state
      pirState = HIGH;
    }
  } else {
    digitalWrite(ledPin, LOW); // turn LED OFF
    if (pirState == HIGH){
      // we have just turned of
      Serial.println("Motion ended!");
      // We only want to print on the output change, not state
      pirState = LOW;
    }
  }
}

And now, the more sophisticated code from here:

/* 
 * //////////////////////////////////////////////////
 * //making sense of the Parallax PIR sensor's output
 * //////////////////////////////////////////////////
 *
 * Switches a LED according to the state of the sensors output pin.
 * Determines the beginning and end of continuous motion sequences.
 *
 * @author: Kristian Gohlke / krigoo (_) gmail (_) com / http://krx.at
 * @date:   3. September 2006 
 *
 * kr1 (cleft) 2006 
 * released under a creative commons "Attribution-NonCommercial-ShareAlike 2.0" license
 * http://creativecommons.org/licenses/by-nc-sa/2.0/de/
 *
 *
 * The Parallax PIR Sensor is an easy to use digital infrared motion sensor module. 
 * (http://www.parallax.com/detail.asp?product_id=555-28027)
 *
 * The sensor's output pin goes to HIGH if motion is present.
 * However, even if motion is present it goes to LOW from time to time, 
 * which might give the impression no motion is present. 
 * This program deals with this issue by ignoring LOW-phases shorter than a given time, 
 * assuming continuous motion is present during these phases.
 *  
 */

/////////////////////////////
//VARS
//the time we give the sensor to calibrate (10-60 secs according to the datasheet)
int calibrationTime = 30;        

//the time when the sensor outputs a low impulse
long unsigned int lowIn;         

//the amount of milliseconds the sensor has to be low 
//before we assume all motion has stopped
long unsigned int pause = 5000;  

boolean lockLow = true;
boolean takeLowTime;  

int pirPin = 3;    //the digital pin connected to the PIR sensor's output
int ledPin = 13;

/////////////////////////////
//SETUP
void setup(){
  Serial.begin(9600);
  pinMode(pirPin, INPUT);
  pinMode(ledPin, OUTPUT);
  digitalWrite(pirPin, LOW);

  //give the sensor some time to calibrate
  Serial.print("calibrating sensor ");
    for(int i = 0; i < calibrationTime; i++){
      Serial.print(".");
      delay(1000);
      }
    Serial.println(" done");
    Serial.println("SENSOR ACTIVE");
    delay(50);
  }

////////////////////////////
//LOOP
void loop(){

     if(digitalRead(pirPin) == HIGH){
       digitalWrite(ledPin, HIGH);   //the led visualizes the sensors output pin state
       if(lockLow){  
         //makes sure we wait for a transition to LOW before any further output is made:
         lockLow = false;            
         Serial.println("---");
         Serial.print("motion detected at ");
         Serial.print(millis()/1000);
         Serial.println(" sec"); 
         delay(50);
         }         
         takeLowTime = true;
       }

     if(digitalRead(pirPin) == LOW){       
       digitalWrite(ledPin, LOW);  //the led visualizes the sensors output pin state

       if(takeLowTime){
        lowIn = millis();          //save the time of the transition from high to LOW
        takeLowTime = false;       //make sure this is only done at the start of a LOW phase
        }
       //if the sensor is low for more than the given pause, 
       //we assume that no more motion is going to happen
       if(!lockLow && millis() - lowIn > pause){  
           //makes sure this block of code is only executed again after 
           //a new motion sequence has been detected
           lockLow = true;                        
           Serial.print("motion ended at ");      //output
           Serial.print((millis() - pause)/1000);
           Serial.println(" sec");
           delay(50);
           }
       }
  }

Conclusion?

So, what do you think?  Should I go with the first or second code sample for the yard art sculpture?

I’ll get input from you — the loyal, happy reader — and let everyone else know what you said.  Then, I’ll show you what I did and if it differs from you, I’ll try your suggestions and show the world the results.

Until next time!

Death missed me last night…

Death missed me last night.
I should laugh or cry?
Matters not.
I love everyone equally,
Desire them,
Wish to devour them,
Eat every drop of sweat,
Regardless of skin category,
Regardless of thought set pattern embodiment.

As far as I’m concerned,
If you can’t say “fuck” on network television
Then the illusion of subcultural restraint
Is no more reassuring than the government spying
That our local/national cultures condone.

Thank goodness for random acts of violence.

Thank goodness that my thoughts are in contradiction…

My thoughts say that I am omnisexual,
Yet my actions say I am celibate and live in a monogamous relationship.

I take interest in local subcultures in order to show interest in individuals
With whom I cannot express directly to them my thoughts for them
That contradict the legal obligations I made in front of a crowd of friends and family years ago.

I live in this luxury of contradictory thought patterns,
Unable to care about starving kids anywhere,
Regardless of “income inequality” that is a substitute phrase for saying people are unable to form their own local economies
(i.e., lack initiative to create money out of thin air which buys the necessities of life and more).

I lack sympathy for [pick your favourite ailment] survivors.
What did you survive?
What do you say you survived for?
Not for me, you didn’t.
One less survivor means more for the rest of us!

There is nothing I can give anyone that I haven’t already tried once and failed to get my point across,
Or succeeded in proving I am a total fuckup.

Yes, I am part of a financially-successful family living in a suburban-based rotting hull of a house,
Waiting to die.

I say I want certain things, certain people to hold, certain phrases to say, places to see,
But then I do what I say and I am still left at the end of the day with me as I am,
New experiences notched on my old, stained leather belt falling apart.

Fuck this world.
It doesn’t matter anymore.

Let me figure out how to backup this blog to my local hard drive,
Erase the online contents,
Delete the website,
And slip into oblivion from whence I came,
Just as I did with myself on a popular social media site.

We humans have such a tiny view of existence,
Measuring life in revolutions around our local star, the Sun,
Thinking that adding words like millions and billions somehow gives us added [in]significance.

No matter.
No matter what.

Death missed me last night…
Again!

I laugh because I cried for no reason,
The reason being the death of a ten-year young girl,
And I’m still here for no reason that a subculture couldn’t quickly twist into eternal purposes to sustain itself.

“No” and “not” and double-negatives,
Double-entendres and doublespeak.

Matters not.

I believed I loved two women at once,
More than once,
This time the pain is just as great,
The sorrow greater,
The distance closer yet farther away in age.

How much more, how much longer, can I survive myself?

I want to start a new charity,
It’s called “I’m a self survivor and I’m in remission, if not remiss.”

Time for another vacation from myself.

Time to start a paper “blog” and say goodbye to cultural affirmation of paranoid government spying,
Say goodbye to texting,
Say goodbye to social media updates;
Say hello to a new self that sits in public and meditates upon the meaningless mystery of dark matter,
Get power from dark energy,
Disregard the need for pop culture references to tie myself to the artificial construct of zeitgeist time.