Build an Arduino-Powered Smart Doorbell 

Connect a pushbutton between the 5V pin and analog input pin A0 on an Arduino. Pushing the button applies 5V to A0. Connect the Arduino to a computer via USB.

Upload a sketch to the Arduino that repeatedly reads the voltage at A0 and writes to the serial port if the voltage is high.

#define SERIAL_BAUDRATE 9600

void setup()
{
  Serial.begin( SERIAL_BAUDRATE);
}

void loop()
{
  if( analogRead(0) > 800)
  {
     Serial.write(1);
  }
}

Connect the Wolfram Language to the Arduino using the serial driver.

In[1]:=
Click for copyable input
X
Out[1]=

Use a ScheduledTask to periodically check the serial port for the Arduino's doorbell signal. Send an email with an image of the person at the door when the button is pressed.

In[2]:=
Click for copyable input
X
Out[2]=