Arduino based Office-WTF-Counter
As in any office, my co-workers and I experience several WTF-Situations during our working day. So we decided to implement a simple system to count the WTF's and use them as a metric for our working climate :-)
we use an "emergency stop"-Button which is connected to an arduino. This arduino sends the string "WTF" on the serial line a little python scrip writes them to a file, another processing app count's the lines in the file and offers the result via http, which is read by a processing app for visualisation ...
Arduino Part:
const int buttonPin = 2;
const int ledPin = 13;
int ledState = HIGH;
int buttonState;
int lastButtonState = LOW;
long lastDebounceTime = 0;
long debounceDelay = 200;
void setup() {
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
Serial.println("Hello");
}
void loop() {
buttonState = digitalRead(buttonPin);
if ((buttonState == HIGH) && (lastButtonState == LOW) && (millis() - lastDebounceTime) > debounceDelay) {
Serial.println( "WTF" );
if (ledState == HIGH) {
ledState = LOW;
} else {
ledState = HIGH;
}
lastDebounceTime = millis();
}
digitalWrite(ledPin, ledState);
lastButtonState = buttonState;
}
Python server part1:
import serial
f = open("wtf/current", "aw");
ser = serial.Serial( '/dev/ttyUSB0', 9600, timeout = None )
line = ser.readline()
while line:
if line[0:3] == "WTF" :
f.write( line )
f.flush()
line = ser.readline()
ser.close()
Python server part2:
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
class WtfHandler(BaseHTTPRequestHandler):
def do_GET(self):
f = open('wtf/current')
count = 0;
l = f.readline()
while l:
count = count + 1
l = f.readline()
self.send_response(200)
self.send_header("Content-type", "text/plain")
self.end_headers()
self.wfile.write("%d" %count)
f.close()
return
if __name__ == "__main__":
try:
server = HTTPServer(('',8888), WtfHandler)
server.serve_forever()
except KeyboardInterrupt:
server.socket.close()
Processing Part:
void setup() {
size(500, 100);
smooth();
textFont( loadFont( "Verdana-Bold-48.vlw"));
noLoop();
start( 10 * 1000 );
}
void draw() {
background(0);
fill(255);
String[] lines = loadStrings("http://armleuchter:8888");
text( "WTF's so far: " + lines[0], 30, 70 );
}
void start( final int mil ) { //<- mil has to be final to be accessible in run()
new Thread() {
public void run() {
while( true ) {
delay( mil );
redraw();
}
}
}.start();
}
See also:
Smiley-O-Mat
My name is 192.168.159.16
processing ical-flowers-2.0
Training Bike Visualization
That is something a coupland novel would include.
WTF?!?
In this economy, with the management brainstorming like mad, and patting themselves on the back for every free-association business enhancement they come up with, I've decided to install one in our advertising department.
In our case WTF actually will be called CRINGE-IN-HORROR, like some of our customer response emails indicate.
This is good, but it would be better if a siren and a red light beacon went off as well.
Somebody just the all the comments!
This type of device would be better left on the PC (assuming everyone has access to one) That way you have to make a conscience decision to make such a claim.
Also: I was in jail once (or should I say this one time I was in jail) they had these buttons around the gen pop for indoor officers to hit in case of emergency. That button got bumped into and hit on accident more often than it’s intended use. Since then I was in the same jail and they now have a cover over it. It can still be used for it’s intended purpose but you now have to make a conscience decision.
...and the idea is that this be anonymous - bells and whistles and lights and sh*t would ruin that aspect
This has good use as to employee reflections on the direction of the project or business, if you log the problem (maybe one of those really cool giant electronic white boards, so you can have some input) then you can see where the company is going -- how it reflects in the market place, enabling you to develop strategies to combat situations
really nice and simple implementation. love that you can actaully post the code from all these different technologies on the one page.
The Arduino is not necessary here. It would have been simpler/cheaper to hook the switch directly to the RS232's DCD line, and have the Python script trigger directly off of that.
What a waste of time and resources.
Interiot: As for the Arduino being a more expensive and complicated, my PC does not have an onboard serial port, which is the trend on most any PC newer than about 3 years old. You can get good USB-RS232 adapters and you can get flaky ones. Good ones are more expensive than an Arduino. Therefore it was actually less wasteful of resources to use the Arduino than it would have been to directly use RS232. Plus the Arduino could be used to handle more buttons and even drive indicators (such as the lava lamps pictured behind the Arduino.)
Andy M: If you mean wasted time and materials, all indications point to this being done by a fellow geek who probably tinkers with this sort of thing for fun. Remember those things, called hobbies, you did when you were a kid? Most adults still enjoy having hobbies, many of them relating to electronics and tinkering. This was probably entirely built in spare time with spare/discarded hardware just laying around.
Worst case its providing a few moments of humor and stress relief in what sounds like a fairly stressful environment. Can you really define at what point that benefit is paid back by a waste of resources?
Well said Jeremy!!
Andy M - You are the waste of time and resources.
Awesome project!
I´m working on something that needs some sort of similar interface. Could you fill me in on what arduino hardware you had to buy?
Sorry if you already posted this, but I didn´t see anything.
Thanks so much!
tnx eric,
i just used a arduino, a emergency-stop button, and a restistor
the schematics are the same as the digital-input examples on the processing site
WHY COULDN'T SOMEONE JUST DO THIS AS A LED DISPLAY WITH AN UP COUNTER, SO EVERY TIME IT GETS HIT THE LED DISPLAY WILL COUNT UP. THEN ADD A RESET BUTTON, SO YOU CAN KILL THE COUNT AT THE END OF THE DAY? KEEP IT SIMPLE.
To Sparky: I think that being able to see what the count is day of leads to folks trying to game the results. In other words, saying "my day is worse than aht the counter shows, so I will hit the button some more times." I think that this could lead to WTF inflation, and nobody wants WTF inflation.
sparky = moron
this is the best project i've seen since i've came back from the bits!!
you should totally build a global net WHATTHEFUCK application, where all of us could contribute ;)
just picture the simultaneous cascades from the entire world!!!
this just made my day;)
please post oin the p5 foruns when you do it!
i would totally do a vizualization in p5 for this! so fucking great !!!
Great project! Where did you purchase the emergency stop button?
@karmic
the button is from www.conrad.at (search for "not-aus-taster")
The best part of this product is we can use in any emergency....
i love the use of comic sans
wtf!!!
Thanks for sharing such a useful stuff!
WSOOOOOSWOOO
WSOOOOOSWOOO
WSOOOOOSWOOO
You realize you could have just used a ticket counter right? Instead of writing code, and installing a button that goes to a module that goes to a computer. Way to overthink it.
distinctive|special|exclusive} {design|style|layout|design and style} {demonstrates|shows|displays|illustrates} {unparalleled|unequalled|unmatched|unrivaled} {quality|high quality|top quality|good quality} {and an|as well as an|plus an|with an} {innate|natural|inborn|inbuilt} sultriness.{Ladies|Girls|Females|Women} {are|tend to be|are usually|are generally} {crazy about|in love with|fond of|excited about} {Christian Louboutin|Louboutin|Christian louboutin uk|Christian louboutin shoes} {shoes|footwear|sneakers|shoes or boots}. {If you want|If you would like|If you'd like|If you need} {keep the|keep your|maintain the|maintain your} {same|exact same|identical|very same} {pace|speed|tempo|rate} {with the|using the|with all the|while using} {trend|pattern|craze|development}.{Cheap|Inexpensive|Low-cost|Low cost} {Christian Louboutin|Louboutin|Christian louboutin uk|Christian #file_links\Users\Administrator\Desktop\D1\key.txt,1,N]
http://www.my-chicken-heart.com/2012/11/3d_cad_1.html#comments