Jump to content

Annoy someone you work with


Recommended Posts

Darren, the guy that sits in the cube next to me, got this cubical door bell type thing called the cubicaller and attached it to the front of his cube. Everybody that walks by apparently loves to press the button (even when he is not in his cube).

While amusing at first, this quickly gets annoying when you're the guy sitting next to him and you get to hear it go off all day long. Sooooooo, I decided to get him back by making the "Annoy-O-Darren".

The Annoy-O-Darren is basically a keychain toy that has buttons and plays sound that I hooked up to an Arduino which is then attached to my computer. When someone presses the button on the toy, the Arduino senses that the button has been pressed and then calls a web page with php code that basically sends and email anytime it is accessed. I have it setup so that it emails my coworker a text message informing him that someone has pushed the Annoy-O-Darren.

The Keychain Toy bought from Target for $3.99.


The Annoy-O-Darren installed with a sticker that I printed out informing everyone that walks by what the device does.


The Arduino setup - unfortunately this is the best picture I had.


It's been up for a few days now and is a big hit with everyone except for Darren who is currently plotting his revenge.

Link to comment
Share on other sites

Should write up an instructibles so people can download a pdf or such of instructions.


Another idea is to build the email function into his doorbell without him knowing, so he can't stop the emails coming from his own pc. Maybe tie it into a pop up on his machine so when they hit his doorbell, it tells him how annoying he is.

Link to comment
Share on other sites

Doing an instructable is a great idea. I will try and do one soon. For right now I will quickly try and give a little more detail on how to do this so it’s there if someone wants it.

I first got the idea on how to do this by reading a book called “Making Things Talk” which is a must have book if your looking to do crazy projects like this with an Arduino. One of the projects in this book explains how to build a cat mat where you put a sensor in the mat so that it will email you when your cat is on the mat. You are then suppose to point your webcam at the mat so you can go online and see your cat from work. I took that idea and instead of a cat mat I have a toy from Target and instead of a cat I have people walking by my cube to push the button. So vola’ the Annoy-O-Darren concept is born.

Parts you will need:


BreadBoard (optional but helpful)

33 ohm Resistor


Computer w/ internet connection

Websever that support php

Software you will need:

Arduino Software

Processing Software

Code you will need (see below):

****disclamer: I haven’t gotten around to clean up the code from the cat on mat project. I only changed the variables I needed to make it work for me. If you see a lot of cat on mat stuff in the code you now know why. Also, there is code that limits an email being sent to once every minute. Obviously you can remove this but I didn’t want to because I actually do want to remain friends with the guy that sits next to me.

code_for_arduino.pde -resides on the arduino, it senses whether or not the button has been pushed

code_for_processing.pde - resides on computer, listens to the arduino and if the button was pushed it access the send_email.php page

send_email.php - when this web page is accessed it sends an email to the address of your choosing.


  Analog sensor reader
  Language: Arduino/Wiring

  Reads an analog input on Analog in 0, prints the result
  as an ASCII-formatted  decimal value.
    FSR analog sensor on Analog in 0

int sensorValue;            // outgoing ADC value

void setup()
  // start serial port at 9600 bps:

void loop()
  // read analog input:
  sensorValue = analogRead(0); 

  // send analog value out in ASCII decimal format:
  Serial.println(sensorValue, DEC);

  // wait 10ms for next reading:


  Cat graphing and email program
  Language: Processing

  Reads in a string of characters until it gets a linefeed (ASCII 10).
  Then converts the string into a number. Then graphs it. If the
  number has changed significantly, and there hasn't been a big
  change in more than a minute, the program calls a PHP script
  to send an email message.

import processing.serial.*;
import processing.net.*;  // gives you access to the net library

int linefeed = 10;      // linefeed in ASCII
Serial myPort;          // The serial port
int sensorValue = 0;    // the value from the sensor
int graphPosition = 0;  // the horizontal position of the latest
                        // line to be drawn on the graph

int prevSensorValue = 0;    // the previous sensor reading
boolean catOnMat = false;   // whether or not the cat's on the mat
int threshold = 10;        // above this number, the cat is on the mat.

int timeThreshold = 1;    // minimum number of minutes between emails
int timeLastSent[] = {
  hour(), minute() };      // the time that your last message was sent

// HTTP client variables:
Client client;              // a new net client
boolean requestInProgress = false;  //  whether a net request is in progress
String responseString = "";     // string of text received by client

void setup() {
  // List all the available serial ports

  // I know that the first port in the serial list on my mac
  // is always my  Arduino, so I open Serial.list()[0].
  // Open whatever port is the one you're using.
 // myPort = new Serial(this, Serial.list()[0], 9600);
 myPort = new Serial(this, Serial.list()[1], 9600);
  // read bytes into a buffer until you get a linefeed (ASCII 10):
  println(hour() + ":" + minute());

void draw() {

  if (sensorValue > threshold ) {
    // if the last reading was less than the threshold,
    // then the cat just got on the mat.
//    if (prevSensorValue <= threshold) {
//      delay(100);
//      if (sensorValue > threshold) {
        catOnMat = true;
//      }
//    }
  else {
    // if the sensor value is less than the threshold,
    // and the previous value was greater, then the cat
    // just left the mat
    if (prevSensorValue >= threshold) {
      catOnMat = false;
  // save the sensor value as the previous value
  // so you can take new readings:
  prevSensorValue = sensorValue;

  if (requestInProgress == true) {

// serialEvent  method is run automatically by the Processing applet
// whenever the buffer reaches the  byte value set in the bufferUntil()
// method in the setup():

void serialEvent(Serial myPort) {
  // read the serial buffer:
  String myString = myPort.readStringUntil(linefeed);
  // if you got any bytes other than the linefeed:
  if (myString != null) {
    //trim off the carriage return and convert the string to an integer:
    sensorValue = int(trim(myString)) /2 -100;
    // print it:
    // println(sensorValue);

void drawGraph() {
  int lineHeight = sensorValue /2;
  // draw the line:
  if (catOnMat) {
    // draw green:
  else {
    // draw red:
  line(graphPosition, height, graphPosition, height - lineHeight);
  // at the edge of the screen, go back to the beginning:
  if (graphPosition >= width) {
    graphPosition = 0;
  else {

void sendMail() {
  // calculate the current time in minutes:
  int[] presentTime = {
    hour(), minute()              };

  // print the current time and the last time you sent a message:
  print(sensorValue + "\t");
  print( presentTime[0] + ":" + presentTime[1] +"\t");
  println(timeLastSent[0] + ":" + timeLastSent[1]);

  // if you're still in the same hour as the last message,
  // then make sure at least the minimum number of minutes has passed:
  if (presentTime[0] == timeLastSent[0]) {
    if (presentTime[1] - timeLastSent[1] >= timeThreshold) {
      println("This is where you'd send a mail.");
      // take note of the time this message was sent:
      timeLastSent[0] = hour();
      timeLastSent[1] = minute();

  // if the hour has changed since the last message,
  // then the difference in minutes is a bit more complex.
  // Use !+ rather than > to make sure the shift
  // from 23:59 to 0:00 is covered as well:
  if (presentTime[0] != timeLastSent[0]) {
    // calculate the difference in minutes:
    int minuteDifference = (60 - timeLastSent[1]) + presentTime[1];

    if (minuteDifference >= timeThreshold) {
      println("This is where you'd send a mail.");
      // take note of the time this message was sent:
      timeLastSent[0] = hour();
      timeLastSent[1] = minute();

void makeHTTPCall() {
  if (requestInProgress == false) {
    // Open a connection to the host:
    client = new Client(this, "mydomain.com", 80);

    // form the request string:
    String requestString = "/send_email.php?sensorValue=" + sensorValue;
    // Send the HTTP GET request:
    client.write("GET  " + requestString + " HTTP/1.1\n");
    client.write("HOST: mydomain.com.com\n\n");
    // note that you've got a request in progress:
    requestInProgress = true;

void checkNetClient() {
  // available() returns how many bytes have been received by the client:
  if (client.available() > 0) {
    // read a byte, convert it to a character, and add it to the string:
    responseString +=char(client.read());    

    // add to a line of |'s on the screen (crude progress bar):
  // if there's no bytes available, either the response hasn't
  // started yet, or it's done:
  else {
    // if responseString is longer than 0 bytes, the response has started:
    if(responseString.length() > 0 )  {
      // you've got some bytes, but now there's no more to read. Stop:
      if(requestInProgress == true) {
        // print the response:
        // note that the request is over:
        requestInProgress = false;
        // reset the string  for future requests:
        responseString = "";


Mail sender
Language: PHP
Expects a parameter called SensorValue, an integer. Sends an email
if sensorValue is above a threshold value.



$threshold = -1000;    // minimum sensor value to trigger action.
                     // change this value to whatever your
                     // sensor threshold is.

// print the beginning of an HTML page:
echo "<html><head></head><body>\n";

// read all the parameters and assign them to local variables:
foreach ($_REQUEST as $key => $value)
      if ($key == "sensorValue") {
          $sensorValue = $value;

if ($sensorValue > $threshold) {
    $messageString =
      "Somebody has pushed the Annoy-O-Darren!";
    echo $messageString;
    send_mail("phonenumber@tmomail.net", "Somebody has pushed the Annoy-O-Darren!", $messageString);
} else {
    echo "<p> the cat is not on the mat.</p>\n";
// finish the HTML:
echo "</body></html>\n";


// end of the main script. Anything after here won't get run
// unless it's called in the code above this line


function send_mail($to, $subject, $message) {
    $from = "Annoy-O-Darren@mydomain.com";
    mail($to, $subject, $message, "From: $from");

How it is wired:


I connected the keychain toy by taking off the back and found the positive and negative leads coming from the batteries. I attached two wires to these leads and removed the batteries since the power was now going to come from the Arduino instead. (If you use some other pushbutton/sound toy it is probably 3.3v but check with a mulitmeter to be sure)

When the button gets pushed, the circuit is complete and current flows through the arduino and to ground however the resistor allows some current to go to pin 0 on the arduino letting it know the button was pushed. I used a 33 ohm resistor but what I found was that if I used a higher resistor the sound wouldn’t play but it would register on pin 0 but too low of a resistor and the sound would play but it wouldn’t register on pin 0 so you might have to do some trial and error to find the sweet spot so both work.

Code Changes you will need to make:


-no change


-might need to change the “[1]” in this line of code: “myPort = new Serial(this, Serial.list()[1], 9600);” to the correct port number your arduino is on.

-under the “void makeHTTPCall” you will need to change “mydomain.com” to the domain of the webserver you are using on these two lines:

client = new Client(this, "mydomain.com", 80);

client.write("HOST: mydomain.com.com\n\n");


-change the to and from email address to your choosing to these two lines:

send_mail(“phonenumber@tmomail.net”, ….

$from = "Annoy-O-Darren@mydomain.com";


1. Wire everything up

2. Install Arduino Software on your computer and export “code_for_arduino.pde” to the arduino

3. Upload send_email.php to your webserver and test by accessing the web page. (make sure you add ?sensorValue=1 to the end of the address. For example http://www.mydomain.com/send_email.php?sensorValue=1 This should send an email/text message.

4. Install Processing Software on your computer and run “code_for_processing.pde” so your computer is listening to the arduino. You will notice another box will pop up – this graphs the amount of current that is coming into pin 0 when the button is pushed- it’s there to troubleshoot. If the graph lines are all red when you push the button then you might need to increase the resistor amount slightly, once you see a green line when you push the button your good.

5. Right after you click run in the previous step, wait one minute and then press any button on the Annoy-O-Darren and it should make it’s sound and send an email/text message. (you have to wait 1 min. when you first run it because of the code. After that you can push the button once a min. from there on and it will send an email)

Other thoughts:

Apologies again for the code - I wish I had a cleaned up version so it’s more straight forward.

One of the limitations of this project is that you have to have your computer on and the program running. Reading through the “Making Things Talk” book will teach you how to take it to the next level if you want so that all you need is a power outlet and an Ethernet cable to run. You can also learn to make it wireless if you wanted.

If your first starting out with learning about the Arduino you might want to check out one of the starter kits like this one .

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...