Introduction: Tweeting Arduino Alarm With One PIR Sensor. Aka AlarmIno

Picture of Tweeting Arduino Alarm With One PIR Sensor. Aka AlarmIno

Hi today I will be showing you how to make a tweeting Arduino alarm with a PIR sensor.

You will need:

  • A parallax PIR sensor 3 pin
  • Ethernet cable
  • Ethernet shield (i use this one)
  • Breadboard
  • Arduino UNO
  • 6 jumper wires

Step 1: Wiring the Thing Up!

Picture of Wiring the Thing Up!
  1. First you'll need to attach the ethernet shield to Arduino.
  2. Attach the PIR sensor to the breadboard.
  3. Wire up the PIR. ( gnd goes to -, vcc or anything like that goes to +, out goes to pin 7)
  4. Attach ethernet cable to seeeduino ethernet shield v 1.1.

Step 2: The Code

#if defined(ARDUINO) && ARDUINO > 18   // Arduino 0019 or later
#include <SPI.h>
#endif
#include <Ethernet.h>
//#include <EthernetDNS.h>  Only needed in Arduino 0022 or earlier
#include <Twitter.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = {<<<a open ip here>>>};
// get your token from http://arduino-tweet.appspot.com
Twitter twitter("<<<token goes here>>>");
int alarm = 7;
int lever = 6;
int greenLED = 4;

void setup()
{
   delay(1000);
  Ethernet.begin(mac, ip);
  Serial.begin(9600);
  pinMode(alarm, INPUT);
  pinMode(lever, INPUT);
  pinMode(greenLED, OUTPUT);
}

void loop() {
if (alarm == HIGH)
{
   twitter.post("alarm activated");
}

else
{
  digitalWrite(greenLED, HIGH);
}


}

Comments

dadinodj (author)2015-03-26

Great job on this. I'm trying to use it as well but I'm receiving an error in the <<<a open ip here>>> line and the "<<<token goes here>>>" line. When I replace those lines with my internet name and my twitter token, it tells me they are not defined or something similar. Any ideas of what to do? Maybe I am missing a basic concept here as I am new to arduino.

Thanks!