snooze feature

Peeking into electronics prototyping with the Arduino Uno

With so many passionate engineers here at Tumblr, meetings can get a little, well, heated. When staff turns up the fire in the kitchen, it’s time to crack a window.

Open windows can have their disadvantages. Wasted heat, wasted cooling, and unexpected visitors.

Don’t let them in.

However, it’s easy to forget to close the windows when leaving the room. To that end, I decided to build a reminder system during our most recent Hack Day.

The system, as shown above, uses an Arduino Uno to which a flexiforce pressure sensor has been wired. When the window is opened, a “start up” tune is played, and a timer begins. Once a certain amount of time has passed (say, 30 minutes,) a warning sound plays. Then, a reminder sound will play at another customizable interval. There’s also a button that activates a snooze feature to mute the reminder sound, during which an LED will blink. The logic for the main loop is below. Since this is Hack Day code, keep in mind it may be a bit wonky.


void loop() {
  timer.run(); 

  int sensorValue = analogRead(sensorPin);
  int buttonState = digitalRead(buttonPin);

  if (started && buttonState == HIGH) snooze();

  int difference = sensorValue - lastVoltage;
  if (difference < 0) difference = difference * -1;
  if ((difference < 150) && (lastVoltage > -1)) return;

  if (sensorValue <= threshold) {    
    //window is open
    if(! started) {
      playTune();
      started = true;
    }
    if(! triggered) {
      timer.enable(open_start_id);
      timer.enable(reminder_id);
    }
    lastVoltage = sensorValue;
  } else {
    //window is closed
    if(started) { 
      //reset everything
      open_start_id = timer.setTimeout(warnAfter, play_warn);
      triggered = false;
      started = false;
    }

    timer.disable(open_start_id);
    timer.disable(reminder_id);
    lastVoltage = sensorValue;
  }
}

And since we’d be remiss in not showing you this baby in action:

https://aloria.tumblr.com/post/143120428399

Apologies to Lipps Inc.

A list of components can be found here: https://aloria.tumblr.com/post/143121827147/arduino-project-components. Also, https://www.tumblr.com/jobs

- @aloria

itskudji:

My leopard gecko having a little snooze.

New FEATURE: FlatFat Bumbertoote! *this gecko is nannouncing the feature in high voices* Get one on your pet, friedns and family do ask how DOES that head work, it aint got eyes&moth, but then they SPOT the trap that trickd THEM! It was a tooter booter not a snouting snooter!!!! 9.85/10 But this it was all a dream incepticon????

Gmail reportedly testing new inbox tabs, ‘snooze’ feature for messages
Gmail may be getting some new inbox-wrangling features. Android screenshots leaked by Geek.com suggest that Google is testing a version of Gmail with new tabs for travel, purchases, and finance, which will supplement the current Social, Promotional, Updates, and Forums tabs that users can add alongside their default inbox. These extra options were added to Gmail’s Smartlabels lab feature earlier this year, but they’d be a set of fairly specific expansions for Gmail tabs. The leaked version is also said to include some new tools for making sure important messages don’t get lost. In place of the old stars, there’s apparently a system for pinning messages to the top of your inbox, and a snooze feature lets you read an email, then set it to be marked as unread and moved back to the top of the inbox after a set period of time.