3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Home 9000 - The ULTIMATE Doorbell

Step 10The (Hard) Hardware

The (Hard) Hardware
Now I am a hardware kinda guy, really that is where talent lies. If you look at any of my past 'structables you see I love to tinker. However, this was my first time using a Arduino, and, like a newbie, I ordered one, plugged it in, loaded the software and fainted. Well, not exactly fainted, but felt like I’d been thrown back in time to my first foray with a soldering iron when I worried I was about to burn myself, the project I was working on, followed by incinerating my house!

THIS helped me get started.

The basic logic of the program was this:

Someone pushes the doorbell, It activates a relay that rings the doorbell and activates the Arduino.

The Arduino then:

1) Ignores all activation commands for 4 mins (in case someone rings the doorbell again)
2) Starts a Applescript command on the host Mac computer
3) Activates a second relay (for future ideas)
4) Resets after 4 mins, and goes back to stand-by

Here is the code:

int ledPin = 13; // LED connected to digital pin 13
int potPin = 0; // white doorbell wire to analog pin 0
int val = 0;

long time = 0;

long debounce = 1000;

void setup() {
pinMode(ledPin, OUTPUT); // sets the digital pin as output
Serial.begin(9600); // open serial port at 9600 baud
digitalWrite(14 + potPin, HIGH); // set pullup on the analog pin
// (analog 0 = digital 14, a1 = d15, etc)
}

void loop() {
val = analogRead(potPin);
if (val < 100) { // if the circuit is completed
// (for me, it generally drops from 1023 to ~ 15 when 'ringing')
if (millis()-time > debounce) {
Serial.println("A");
delay(500);
Serial.println("A");
delay(500);
Serial.println("A");
digitalWrite(ledPin, HIGH); // sets the LED on
delay(120000); // ... 240000 = 4 mins
digitalWrite(ledPin, LOW); // and turns the LED off
time = millis();
}
}
}


NOTE: The Appleshare Proxy program was only accepting every third "A" from my Arduino, so I send three and the board now responds instantly without error (I am sure it's sloppy code, but HEY it works!) The 'delay' is where the board ignores all key presses, so the program does not restart if someone keeps ringing the doorbell.



« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
71
Followers
24
Author:macgeek(Zoltar Speaks / Macgeek.com)